Skip to content

Instantly share code, notes, and snippets.

@bokutin
Created May 12, 2024 06:11
Show Gist options
  • Save bokutin/548f44e19c9ce1d4d53174a0bb17fdd0 to your computer and use it in GitHub Desktop.
Save bokutin/548f44e19c9ce1d4d53174a0bb17fdd0 to your computer and use it in GitHub Desktop.
I ran JavaScript::V8 0.11 on FreeBSD 13.3 ports 2024Q1. make test also passes all the tests.
# This is a shell archive. Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file". Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
# make_test.log
# Makefile
# files/patch-Makefile.PL
# files/patch-V8Context.cpp
# distinfo
# pkg-descr
# pkg-plist
#
echo x - make_test.log
sed 's/^X//' >make_test.log << 'c9891b13d8d0ca1e6710989b08242cf1'
X# uname -a
XFreeBSD host1 13.3-STABLE FreeBSD 13.3-STABLE n257699-c39938ddd3a7 MYKERNEL amd64
X# git branch
X* local-2024Q1
X# pkg query %n-%v v8
Xv8-10.4.132.20_3
X# pwd
X/usr/ports/lang/p5-JavaScript-V8
X# make test
X===> p5-JavaScript-V8-0.11 depends on file: /usr/local/sbin/pkg - found
X===> Fetching all distfiles required by p5-JavaScript-V8-0.11 for building
X===> Extracting for p5-JavaScript-V8-0.11
X=> SHA256 Checksum OK for JavaScript-V8-0.11.tar.gz.
X===> Patching for p5-JavaScript-V8-0.11
X===> Applying FreeBSD patches for p5-JavaScript-V8-0.11 from /usr/ports/lang/p5-JavaScript-V8/files
X===> p5-JavaScript-V8-0.11 depends on package: p5-Devel-CheckLib>=0.92 - found
X===> p5-JavaScript-V8-0.11 depends on package: p5-ExtUtils-CppGuess>=0.19 - found
X===> p5-JavaScript-V8-0.11 depends on package: p5-ExtUtils-XSpp>=0.11 - found
X===> p5-JavaScript-V8-0.11 depends on package: perl5>=5.36<5.37 - found
X===> p5-JavaScript-V8-0.11 depends on shared library: libv8.so - found (/usr/local/lib/libv8.so)
X===> Configuring for p5-JavaScript-V8-0.11
XChecking if your kit is complete...
XLooks good
XGenerating a Unix-style Makefile
XWriting Makefile for JavaScript::V8
XWriting MYMETA.yml and MYMETA.json
X===> Building for p5-JavaScript-V8-0.11
X--- blib/lib/JavaScript/.exists ---
X--- blib/arch/.exists ---
X--- blib/lib/auto/JavaScript/V8/.exists ---
X--- blib/arch/auto/JavaScript/V8/.exists ---
X--- blib/bin/.exists ---
X--- blib/script/.exists ---
X--- blib/man1/.exists ---
X--- blib/man3/.exists ---
X--- config ---
X--- subdirs ---
X--- dynamic ---
X--- WithV8Context.c ---
X--- V8.bs ---
X--- V8Context.o ---
X--- pm_to_blib ---
X--- WithV8Context.c ---
X"/usr/local/bin/perl" "/usr/local/lib/perl5/5.36/ExtUtils/xsubpp" -C++ -hiertype -typemap '/usr/local/lib/perl5/5.36/ExtUtils/typemap' -typemap '/usr/ports/lang/p5-JavaScript-V8/work/JavaScript-V8-0.11/perlobject.map' -typemap '/usr/ports/lang/p5-JavaScript-V8/work/JavaScript-V8-0.11/typemap' WithV8Context.xs > WithV8Context.xsc
XRunning Mkbootstrap for V8 ()
X--- V8Context.o ---
Xc++ -c -I. -O2 -pipe -DV8_COMPRESS_POINTERS=1 -DV8_31BIT_SMIS_ON_64BIT_ARCH=1 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DVERSION=\"0.11\" -DXS_VERSION=\"0.11\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.36/mach/CORE" V8Context.cpp
X--- V8.bs ---
Xchmod 644 "V8.bs"
X--- blib/arch/auto/JavaScript/V8/V8.bs ---
X"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- V8.bs blib/arch/auto/JavaScript/V8/V8.bs 644
X--- blibdirs ---
X--- config ---
X--- pm_to_blib ---
Xcp lib/JavaScript/V8.pm blib/lib/JavaScript/V8.pm
Xcp lib/JavaScript/V8/Context.pm blib/lib/JavaScript/V8/Context.pm
X--- WithV8Context.c ---
XPlease specify prototyping behavior for WithV8Context.xs (see perlxs manual)
Xmv WithV8Context.xsc WithV8Context.c
X--- WithV8Context.o ---
Xc++ -c -I. -O2 -pipe -DV8_COMPRESS_POINTERS=1 -DV8_31BIT_SMIS_ON_64BIT_ARCH=1 -fstack-protector-strong -isystem /usr/local/include -fno-strict-aliasing -O2 -pipe -fstack-protector-strong -fno-strict-aliasing -DVERSION=\"0.11\" -DXS_VERSION=\"0.11\" -DPIC -fPIC "-I/usr/local/lib/perl5/5.36/mach/CORE" WithV8Context.c
Xc++: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
XWithV8Context.c:515:1: warning: duplicate 'extern' declaration specifier [-Wduplicate-decl-specifier]
X 515 | XS_EXTERNAL(boot_JavaScript__V8); /* prototype to pass -Wmissing-prototypes */
X | ^
X/usr/local/lib/perl5/5.36/mach/CORE/XSUB.h:146:29: note: expanded from macro 'XS_EXTERNAL'
X 146 | # define XS_EXTERNAL(name) extern "C" XSPROTO(name)
X | ^
X--- V8Context.o ---
XV8Context.cpp:699:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
X 699 | prototype->Set(this->get_local_context(), name, (new PerlMethodData(this, SvPV_nolen(key)))->object.Get(isolate));
X | ^~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XV8Context.cpp:797:13: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
X 797 | array->Set(this->get_local_context(), Integer::New(isolate, i), sv2v8(*sv, seen));
X | ^~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XV8Context.cpp:812:16: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
X 812 | while (val = hv_iternextsv(hv, &key, &len)) {
X | ~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XV8Context.cpp:812:16: note: place parentheses around the assignment to silence this warning
X 812 | while (val = hv_iternextsv(hv, &key, &len)) {
X | ^
X | ( )
XV8Context.cpp:812:16: note: use '==' to turn this assignment into an equality comparison
X 812 | while (val = hv_iternextsv(hv, &key, &len)) {
X | ^
X | ==
XV8Context.cpp:813:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
X 813 | object->Set(this->get_local_context(), v8::String::NewFromUtf8(isolate, key, v8::NewStringType::kNormal).ToLocalChecked(), sv2v8(val, seen));
X | ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
XV8Context.cpp:1033:1: warning: non-void function does not return a value [-Wreturn-type]
X 1033 | }
X | ^
X--- WithV8Context.o ---
X1 warning generated.
X--- V8Context.o ---
X5 warnings generated.
X--- blib/arch/auto/JavaScript/V8/V8.so ---
Xrm -f blib/arch/auto/JavaScript/V8/V8.so
XLD_RUN_PATH="/usr/local/lib" c++ -shared -L/usr/local/lib/perl5/5.36/mach/CORE -lperl -L/usr/local/lib -fstack-protector-strong V8Context.o WithV8Context.o -lc++ -o blib/arch/auto/JavaScript/V8/V8.so -lv8 -lv8_libplatform
Xchmod 755 blib/arch/auto/JavaScript/V8/V8.so
X--- dynamic ---
X--- linkext ---
X--- pure_all ---
X--- manifypods ---
XManifying 2 pod documents
X--- all ---
X===> Staging for p5-JavaScript-V8-0.11
X===> p5-JavaScript-V8-0.11 depends on package: perl5>=5.36<5.37 - found
X===> Generating temporary packing list
X"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- V8.bs blib/arch/auto/JavaScript/V8/V8.bs 644
XManifying 2 pod documents
XFiles found in blib/arch: installing files in blib/lib into architecture dependent library tree
XInstalling /usr/ports/lang/p5-JavaScript-V8/work/stage/usr/local/lib/perl5/site_perl/mach/5.36/auto/JavaScript/V8/V8.so
XInstalling /usr/ports/lang/p5-JavaScript-V8/work/stage/usr/local/lib/perl5/site_perl/mach/5.36/JavaScript/V8.pm
XInstalling /usr/ports/lang/p5-JavaScript-V8/work/stage/usr/local/lib/perl5/site_perl/mach/5.36/JavaScript/V8/Context.pm
XInstalling /usr/ports/lang/p5-JavaScript-V8/work/stage/usr/local/lib/perl5/site_perl/man/man3/JavaScript::V8::Context.3
XInstalling /usr/ports/lang/p5-JavaScript-V8/work/stage/usr/local/lib/perl5/site_perl/man/man3/JavaScript::V8.3
X====> Compressing man pages (compress-man)
X===> Testing for p5-JavaScript-V8-0.11
X===> p5-JavaScript-V8-0.11 depends on package: p5-Test-Number-Delta>=0 - found
X"/usr/local/bin/perl" -MExtUtils::Command::MM -e 'cp_nonempty' -- V8.bs blib/arch/auto/JavaScript/V8/V8.bs 644
XPERL_DL_NONLAZY=1 "/usr/local/bin/perl" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t
Xt/00-report-prereqs.t .. #
X# Versions for all modules listed in MYMETA.json (including optional ones):
X#
X# === Configure Requires ===
X#
X# Module Want Have Where Howbig
X# ------------------- ---- ---- ------------------------------ ------
X# Devel::CheckLib 0.92 1.16 /usr/local/lib/perl5/site_perl 18784
X# ExtUtils::CppGuess 0.19 0.27 /usr/local/lib/perl5/site_perl 16076
X# ExtUtils::MakeMaker 6.64 7.64 /usr/local/lib/perl5/5.36 109482
X#
X# === Build Requires ===
X#
X# Module Want Have Where Howbig
X# -------------- ---- ---- ------------------------------ ------
X# ExtUtils::XSpp 0.11 0.18 /usr/local/lib/perl5/site_perl 108
X#
X# === Test Requires ===
X#
X# Module Want Have Where Howbig
X# ------------------- ---- ---- ------------------------------ ------
X# Test::Number::Delta any 1.06 /usr/local/lib/perl5/site_perl 19391
X#
Xt/00-report-prereqs.t .. ok
Xt/01load.t ............. ok
Xt/basic.t .............. ok
Xt/bind_function.t ...... ok
Xt/bind_object.t ........ ok
Xt/boolean.t ............ ok
Xt/circular.t ........... ok
Xt/error.t .............. ok
Xt/eval_array.t ......... ok
Xt/eval_object.t ........ ok
Xt/global.t ............. ok
Xt/interrupt.t .......... ok
Xt/jsobj.t .............. ok
Xt/null.t ............... ok
Xt/plobj.t .............. ok
Xt/refcnt.t ............. ok
Xt/syntax_error.t ....... ok
Xt/types.t .............. ok
Xt/void.t ............... ok
Xt/zzmem_plojb1.t ....... skipped: apparent memory-leak, fixes welcome
Xt/zzmem_plojb2.t ....... ok
Xt/zzmem_sub.t .......... ok
XAll tests successful.
X
XTest Summary Report
X-------------------
Xt/interrupt.t (Wstat: 0 Tests: 2 Failed: 0)
X TODO passed: 2
XFiles=22, Tests=2104, 6 wallclock secs ( 0.12 usr 0.02 sys + 6.25 cusr 0.30 csys = 6.70 CPU)
XResult: PASS
c9891b13d8d0ca1e6710989b08242cf1
echo x - Makefile
sed 's/^X//' >Makefile << 'b67911656ef5d18c4ae36cb6741b7965'
XPORTNAME= JavaScript-V8
XPORTVERSION= 0.11
XCATEGORIES= lang perl5
XMASTER_SITES= CPAN
XMASTER_SITE_SUBDIR=CPAN:ETJ
XPKGNAMEPREFIX= p5-
X
XMAINTAINER= bokutin@bokut.in
XCOMMENT= Perl interface to the V8 JavaScript engine
X
XBUILD_DEPENDS= p5-Devel-CheckLib>=0.92:devel/p5-Devel-CheckLib \
X p5-ExtUtils-CppGuess>=0.19:devel/p5-ExtUtils-CppGuess \
X p5-ExtUtils-XSpp>=0.11:devel/p5-ExtUtils-XSpp
XLIB_DEPENDS= libv8.so:lang/v8
XTEST_DEPENDS= p5-Test-Number-Delta>=0:devel/p5-Test-Number-Delta
X
XUSES= perl5 localbase:ldflags
XUSE_PERL5= configure
X
XCC= c++
XCFLAGS+= -DV8_COMPRESS_POINTERS=1 -DV8_31BIT_SMIS_ON_64BIT_ARCH=1
X
X.include <bsd.port.mk>
b67911656ef5d18c4ae36cb6741b7965
echo x - files/patch-Makefile.PL
sed 's/^X//' >files/patch-Makefile.PL << '492eac760546ef81beff3720b53ed455'
X--- Makefile.PL.orig 2022-12-18 20:03:30 UTC
X+++ Makefile.PL
X@@ -30,7 +30,7 @@ WriteMakefile(
X },
X ABSTRACT_FROM => 'lib/JavaScript/V8.pm',
X AUTHOR => 'Pawel Murias <pawelmurias@gmail.org>',
X- LIBS => [($V8_DIR ? "-L$V8_DIR " : '') . '-lv8'],
X+ LIBS => [($V8_DIR ? "-L$V8_DIR " : '') . '-lv8 -lv8_libplatform'],
X INC => '-I.' . ($V8_DIR ? " -I$V8_DIR/include" : ''),
X OBJECT => '$(O_FILES)', # link all the C files too
X XSOPT => '-C++ -hiertype',
492eac760546ef81beff3720b53ed455
echo x - files/patch-V8Context.cpp
sed 's/^X//' >files/patch-V8Context.cpp << '45010345c41f6fdf65e66720125c9ae8'
X--- V8Context.cpp.orig 2022-12-18 23:52:31 UTC
X+++ V8Context.cpp
X@@ -47,9 +47,9 @@ check_perl_error() {
X const char *err = SvPV_nolen(ERRSV);
X
X if (err && strlen(err) > 0) {
X- Handle<String> error = v8::String::NewFromUtf8(isolate, err, v8::String::kNormalString);
X+ MaybeLocal<String> error = v8::String::NewFromUtf8(isolate, err, v8::NewStringType::kNormal);
X sv_setsv(ERRSV, &PL_sv_no);
X- Handle<Value> v = isolate->ThrowException(Exception::Error(error));
X+ Handle<Value> v = isolate->ThrowException(Exception::Error(error.ToLocalChecked()));
X return v;
X }
X
X@@ -223,7 +223,7 @@ class V8FunctionData : public V8ObjectData {
X public:
X V8FunctionData(V8Context* context_, Handle<Object> object_, SV* sv_)
X : V8ObjectData(context_, object_, sv_)
X- , returns_list(object_->Has(context_->get_local_context(), String::NewFromUtf8(isolate, "__perlReturnsList", v8::String::kNormalString)).FromMaybe(0))
X+ , returns_list(object_->Has(context_->get_local_context(), String::NewFromUtf8(isolate, "__perlReturnsList", v8::NewStringType::kNormal).ToLocalChecked()).FromMaybe(0))
X { }
X
X bool returns_list;
X@@ -356,8 +356,9 @@ V8Context::V8Context(
X
X Local<FunctionTemplate> tmpl = FunctionTemplate::New(isolate, PerlFunctionData::v8invoke);
X
X- context->Global()->Set(
X- v8::String::NewFromUtf8(isolate, "__perlFunctionWrapper", v8::String::kNormalString),
X+ (void) context->Global()->Set(
X+ context,
X+ v8::String::NewFromUtf8(isolate, "__perlFunctionWrapper", v8::NewStringType::kNormal).ToLocalChecked(),
X tmpl->GetFunction(context).ToLocalChecked()
X );
X
X@@ -372,13 +373,13 @@ V8Context::V8Context(
X " return __perlFunctionWrapper.apply(this, args)"
X " };"
X "})",
X- v8::String::kNormalString
X- )
X+ v8::NewStringType::kNormal
X+ ).ToLocalChecked()
X ).ToLocalChecked();
X
X make_function.Reset(isolate, Handle<Function>::Cast(script->Run(context).ToLocalChecked()));
X
X- string_wrap.Reset(isolate, String::NewFromUtf8(isolate, "wrap"));
X+ string_wrap.Reset(isolate, String::NewFromUtf8(isolate, "wrap").ToLocalChecked());
X
X number++;
X }
X@@ -440,7 +441,7 @@ V8Context::bind(const char *name, SV *thing) {
X Local<Context> local_context = Local<Context>::New(isolate, context);
X Context::Scope context_scope(local_context);
X
X- local_context->Global()->Set(v8::String::NewFromUtf8(isolate, name, v8::String::kNormalString), sv2v8(thing));
X+ (void) local_context->Global()->Set(local_context, v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal).ToLocalChecked(), sv2v8(thing));
X }
X
X void
X@@ -453,7 +454,7 @@ V8Context::bind_ro(const char *name, SV *thing) {
X
X bool result = context.Get(isolate)->Global()->DefineOwnProperty(
X isolate->GetCurrentContext(),
X- v8::String::NewFromUtf8(isolate, name, v8::String::kNormalString),
X+ v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal).ToLocalChecked(),
X sv2v8(thing),
X v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete)
X ).IsJust();
X@@ -467,7 +468,7 @@ void V8Context::name_global(const char *name) {
X
X bool result = context.Get(isolate)->Global()->DefineOwnProperty(
X isolate->GetCurrentContext(),
X- v8::String::NewFromUtf8(isolate, name, v8::String::kNormalString),
X+ v8::String::NewFromUtf8(isolate, name, v8::NewStringType::kNormal).ToLocalChecked(),
X context.Get(isolate)->Global(),
X v8::PropertyAttribute(v8::ReadOnly | v8::DontDelete)
X ).IsJust();
X@@ -476,13 +477,13 @@ void V8Context::name_global(const char *name) {
X // I fucking hate pthreads, this lacks error handling, but hopefully works.
X class thread_canceller {
X public:
X- thread_canceller(int sec)
X+ thread_canceller(int sec, bool *p_timeouted_arg)
X : sec_(sec)
X {
X+ p_timeouted = p_timeouted_arg;
X if (sec_) {
X pthread_cond_init(&cond_, NULL);
X pthread_mutex_init(&mutex_, NULL);
X- pthread_mutex_lock(&mutex_); // passed locked to canceller
X pthread_create(&id_, NULL, canceller, this);
X }
X }
X@@ -509,16 +510,19 @@ class thread_canceller { (private)
X ts.tv_sec = tv.tv_sec + me->sec_;
X ts.tv_nsec = tv.tv_usec * 1000;
X
X+ pthread_mutex_lock(&me->mutex_); // passed locked to canceller
X if (pthread_cond_timedwait(&me->cond_, &me->mutex_, &ts) == ETIMEDOUT) {
X isolate->TerminateExecution();
X+ *me->p_timeouted = true;
X }
X pthread_mutex_unlock(&me->mutex_);
X return NULL;
X }
X
X pthread_t id_;
X- pthread_cond_t cond_;
X- pthread_mutex_t mutex_;
X+ bool *p_timeouted;
X+ pthread_cond_t cond_ = PTHREAD_COND_INITIALIZER;
X+ pthread_mutex_t mutex_ = PTHREAD_MUTEX_INITIALIZER;
X int sec_;
X };
X
X@@ -532,7 +536,7 @@ V8Context::eval(SV* source, SV* origin) {
X
X // V8 expects everything in UTF-8, ensure SVs are upgraded.
X sv_utf8_upgrade(source);
X- ScriptOrigin orig(origin ? sv2v8str(origin) : String::NewFromUtf8(isolate, "eval", v8::String::kNormalString));
X+ ScriptOrigin orig(isolate, origin ? sv2v8str(origin) : String::NewFromUtf8(isolate, "eval", v8::NewStringType::kNormal).ToLocalChecked());
X MaybeLocal<Script> script = Script::Compile(
X local_context,
X sv2v8str(source),
X@@ -543,11 +547,18 @@ V8Context::eval(SV* source, SV* origin) {
X set_perl_error(local_context, try_catch);
X return &PL_sv_undef;
X }
X- thread_canceller canceller(time_limit_);
X+
X+ bool timeouted = false;
X+ thread_canceller canceller(time_limit_, &timeouted);
X MaybeLocal<Value> val = script.ToLocalChecked()->Run(local_context);
X
X if (val.IsEmpty()) {
X- set_perl_error(local_context, try_catch);
X+ if (timeouted) {
X+ sv_setpv(ERRSV, "timeouted terminated");
X+ }
X+ else {
X+ set_perl_error(local_context, try_catch);
X+ }
X return &PL_sv_undef;
X }
X sv_setsv(ERRSV,&PL_sv_undef);
X@@ -564,7 +575,7 @@ V8Context::sv2v8(SV *sv, HandleMap& seen) {
X if (SvPOK(sv)) {
X // Upgrade string to UTF-8 if needed
X char *utf8 = SvPVutf8_nolen(sv);
X- return String::NewFromUtf8(isolate, utf8, v8::String::kNormalString);
X+ return String::NewFromUtf8(isolate, utf8, v8::NewStringType::kNormal).ToLocalChecked();
X }
X if (SvUOK(sv)) {
X UV v = SvUV(sv);
X@@ -593,7 +604,7 @@ Handle<String> V8Context::sv2v8str(SV* sv)
X {
X // Upgrade string to UTF-8 if needed
X char *utf8 = SvPVutf8_nolen(sv);
X- return String::NewFromUtf8(isolate, utf8, v8::String::kNormalString, SvCUR(sv));
X+ return String::NewFromUtf8(isolate, utf8, v8::NewStringType::kNormal, SvCUR(sv)).ToLocalChecked();
X }
X
X SV* V8Context::seen_v8(Handle<Object> object) {
X@@ -641,8 +652,8 @@ V8Context::v82sv(Handle<Value> value, SvMap& seen) {
X }
X
X if (value->IsArray() || value->IsObject() || value->IsFunction()) {
X- Handle<Object> object = value->ToObject(isolate);
X-
X+ Handle<Object> object = value->ToObject(ctx).ToLocalChecked();
X+
X if (SV *cached = seen_v8(object))
X return cached;
X
X@@ -680,12 +691,12 @@ V8Context::fill_prototype(Handle<Object> prototype, HV
X HE *he;
X while ((he = hv_iternext(stash))) {
X SV *key = HeSVKEY_force(he);
X- Local<String> name = v8::String::NewFromUtf8(isolate, SvPV_nolen(key), v8::String::kNormalString);
X+ Local<String> name = v8::String::NewFromUtf8(isolate, SvPV_nolen(key), v8::NewStringType::kNormal).ToLocalChecked();
X
X if (prototype->Has(this->get_local_context(), name).FromMaybe(0))
X continue;
X
X- prototype->Set(name, (new PerlMethodData(this, SvPV_nolen(key)))->object.Get(isolate));
X+ prototype->Set(this->get_local_context(), name, (new PerlMethodData(this, SvPV_nolen(key)))->object.Get(isolate));
X }
X }
X
X@@ -783,7 +794,7 @@ V8Context::av2array(AV *av, HandleMap& seen, long ptr)
X seen[ptr] = array;
X for (i = 0; i < len; i++) {
X if (SV** sv = av_fetch(av, i, 0)) {
X- array->Set(Integer::New(isolate, i), sv2v8(*sv, seen));
X+ array->Set(this->get_local_context(), Integer::New(isolate, i), sv2v8(*sv, seen));
X }
X }
X return array;
X@@ -799,7 +810,7 @@ V8Context::hv2object(HV *hv, HandleMap& seen, long ptr
X Handle<Object> object = Object::New(isolate);
X seen[ptr] = object;
X while (val = hv_iternextsv(hv, &key, &len)) {
X- object->Set(v8::String::NewFromUtf8(isolate, key, v8::String::kNormalString), sv2v8(val, seen));
X+ object->Set(this->get_local_context(), v8::String::NewFromUtf8(isolate, key, v8::NewStringType::kNormal).ToLocalChecked(), sv2v8(val, seen));
X }
X return object;
X }
X@@ -817,7 +828,7 @@ V8Context::array2sv(Handle<Array> array, SvMap& seen)
X seen.add(array, PTR2IV(av));
X
X for (int i = 0; i < array->Length(); i++) {
X- Handle<Value> elementVal = array->Get( Integer::New( isolate, i ) );
X+ Handle<Value> elementVal = array->Get(this->get_local_context(), Integer::New( isolate, i ) ).ToLocalChecked();
X av_push(av, v82sv(elementVal, seen));
X }
X return rv;
X@@ -825,7 +836,7 @@ V8Context::array2sv(Handle<Array> array, SvMap& seen)
X
X SV *
X V8Context::object2sv(Handle<Object> obj, SvMap& seen) {
X- if (enable_blessing && obj->Has(this->get_local_context(), v8::String::NewFromUtf8(isolate, "__perlPackage", v8::String::kNormalString)).FromMaybe(0)) {
X+ if (enable_blessing && obj->Has(this->get_local_context(), v8::String::NewFromUtf8(isolate, "__perlPackage", v8::NewStringType::kNormal).ToLocalChecked()).FromMaybe(0)) {
X return object2blessed(obj);
X }
X
X@@ -837,10 +848,10 @@ V8Context::object2sv(Handle<Object> obj, SvMap& seen)
X Local<Array> properties = obj->GetPropertyNames(this->get_local_context()).ToLocalChecked();
X for (int i = 0; i < properties->Length(); i++) {
X Local<Integer> propertyIndex = Integer::New( isolate, i );
X- Local<String> propertyName = Local<String>::Cast( properties->Get( propertyIndex ) );
X+ Local<String> propertyName = Local<String>::Cast( properties->Get(this->get_local_context(), propertyIndex ).ToLocalChecked() );
X String::Utf8Value propertyNameUTF8( isolate, propertyName );
X
X- Local<Value> propertyValue = obj->Get( propertyName );
X+ Local<Value> propertyValue = obj->Get(this->get_local_context(), propertyName ).ToLocalChecked();
X if (*propertyValue)
X hv_store(hv, *propertyNameUTF8, 0 - propertyNameUTF8.length(), v82sv(propertyValue, seen), 0);
X }
X@@ -899,7 +910,7 @@ my_gv_setsv(pTHX_ GV* const gv, SV* const sv){
X count = array->Length(); \
X EXTEND(SP, count - items); \
X for (int i = 0; i < count; i++) { \
X- ST(i) = sv_2mortal(self->v82sv(array->Get(Integer::New(isolate, i)))); \
X+ ST(i) = sv_2mortal(self->v82sv(array->Get(ctx, Integer::New(isolate, i)).ToLocalChecked())); \
X } \
X } \
X else { \
X@@ -939,7 +950,7 @@ XS(v8method) {
X SV*
X V8Context::function2sv(Handle<Function> fn) {
X CV *code = newXS(NULL, v8closure, __FILE__);
X- V8ObjectData *data = new V8FunctionData(this, fn->ToObject(isolate), (SV*)code);
X+ V8ObjectData *data = new V8FunctionData(this, fn, (SV*)code);
X return newRV_noinc((SV*)code);
X }
X
X@@ -947,7 +958,13 @@ SV*
X V8Context::object2blessed(Handle<Object> obj) {
X char package[128];
X
X- String::Utf8Value stringified( isolate, obj->Get( String::NewFromUtf8(isolate, "__perlPackage") )->ToString(isolate));
X+ String::Utf8Value stringified(
X+ isolate,
X+ obj->Get(
X+ this->get_local_context(),
X+ String::NewFromUtf8(isolate, "__perlPackage").ToLocalChecked()
X+ ).ToLocalChecked()
X+ );
X
X snprintf(
X package,
X@@ -961,14 +978,14 @@ V8Context::object2blessed(Handle<Object> obj) {
X HV *stash = gv_stashpv(package, 0);
X
X if (!stash) {
X- Local<Object> prototype = obj->GetPrototype()->ToObject(isolate);
X+ Local<Object> prototype = obj->GetPrototype()->ToObject(this->get_local_context()).ToLocalChecked();
X
X stash = gv_stashpv(package, GV_ADD);
X
X Local<Array> properties = prototype->GetPropertyNames(this->get_local_context()).ToLocalChecked();
X for (int i = 0; i < properties->Length(); i++) {
X- Local<String> name = properties->Get(i)->ToString(isolate);
X- Local<Value> property = prototype->Get(name);
X+ Local<String> name = properties->Get(this->get_local_context(), i).ToLocalChecked()->ToString(this->get_local_context()).ToLocalChecked();
X+ Local<Value> property = prototype->Get(this->get_local_context(), name).ToLocalChecked();
X
X if (!property->IsFunction())
X continue;
45010345c41f6fdf65e66720125c9ae8
echo x - distinfo
sed 's/^X//' >distinfo << '57677d168a5ec21bdf22c9501f075a8f'
XTIMESTAMP = 1715084932
XSHA256 (JavaScript-V8-0.11.tar.gz) = a49a32931436b14143acda738ff21b9bd3d2d82429bc1c62ec8035a889fa4a43
XSIZE (JavaScript-V8-0.11.tar.gz) = 72003
57677d168a5ec21bdf22c9501f075a8f
echo x - pkg-descr
sed 's/^X//' >pkg-descr << '7f9555c3c1089940396b503dd37f3979'
XPerl interface to the V8 JavaScript engine
X
XWWW: https://metacpan.org/release/JavaScript-V8
7f9555c3c1089940396b503dd37f3979
echo x - pkg-plist
sed 's/^X//' >pkg-plist << '842cde48cf18b70a11b15515ca566742'
X%%SITE_ARCH%%/JavaScript/V8.pm
X%%SITE_ARCH%%/JavaScript/V8/Context.pm
X%%SITE_ARCH%%/auto/JavaScript/V8/V8.so
X%%PERL5_MAN3%%/JavaScript::V8.3.gz
X%%PERL5_MAN3%%/JavaScript::V8::Context.3.gz
842cde48cf18b70a11b15515ca566742
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment