Re: [v8-users] Double Proxy resolve/reject causes segfault
Thanks! The issue is fixed. On Friday, February 23, 2018 at 1:09:11 AM UTC+2, Sathya Gunasekaran wrote: > > Thanks for the report. Fix out for review: > https://chromium-review.googlesource.com/c/v8/v8/+/932968 > > On Thu, Feb 22, 2018 at 12:17 PM, Bogdan Padalko > wrote: > >> Hi! >> >> While working on upgrading php-v8 extension from 6.5.144 to 6.6.275 I >> find a strange issue: when promise in non-pending stage get >> resolved/rejected, application fails with segfault. While it's an edge >> case, it still possible in userland and luckily it was covered by php-v8 >> unit tests. >> As v8 API says that calling resolve/reject on a promise in non-pending >> state should have no effect, I find this segfault a bit strange. Could it >> be some regression or so? >> >> Here's minimal example to reproduce the issue: hello_world.cpp >> >> #include >> #include >> >> #include >> #include >> >> using namespace v8; >> >> int main(int argc, char* argv[]) { >> // Initialize V8. >> //v8::V8::InitializeICU(); >> >> std::unique_ptr platform = v8::platform:: >> NewDefaultPlatform(); >> v8::V8::InitializePlatform(platform.get()); >> >> V8::Initialize(); >> >> v8::Isolate::CreateParams create_params; >> create_params.array_buffer_allocator = v8::ArrayBuffer::Allocator:: >> NewDefaultAllocator(); >> >> // Create a new Isolate and make it the current one. >> Isolate* isolate = v8::Isolate::New(create_params); >> >> v8::Persistent test; >> >> { >> Isolate::Scope isolate_scope(isolate); >> >> // Create a stack-allocated handle scope. >> HandleScope handle_scope(isolate); >> >> // Create a new context. >> Local context = Context::New(isolate); >> >> // Enter the context for compiling and running the hello world >> script. >> Context::Scope context_scope(context); >> >> Local local_value = String::NewFromUtf8(isolate, "test"); >> >> v8::MaybeLocal maybe_local_resolver = v8:: >> Promise::Resolver::New(context); >> v8::Local local_resolver = >> maybe_local_resolver.ToLocalChecked(); >> >> local_resolver->Resolve(context, local_value); >> local_resolver->Resolve(context, local_value); >> } >> >> // Dispose the isolate and tear down V8. >> isolate->Dispose(); >> V8::Dispose(); >> V8::ShutdownPlatform(); >> >> return 0; >> } >> >> Build on macOS with >> >> ROOT=/usr/local/opt/v8@6.6 >> LIB_DIR=$ROOT/lib/ >> >> SRC_DIR=$ROOT >> INCLUDE_DIR=$ROOT/include >> >> g++ hello_world.cpp -o hello_world \ >> -Wno-unused-result \ >> -g \ >> -O2 \ >> -std=c++14 \ >> -I$SRC_DIR \ >> -I$INCLUDE_DIR \ >> -L$LIB_DIR \ >> -lv8_libbase \ >> -lv8_libplatform \ >> -lv8 \ >> -lpthread >> >> install_name_tool -add_rpath $LIB_DIR hello_world >> >> And fails with >> $ ./hello_world >> Received signal 11 SEGV_MAPERR 000a >> >> C stack trace === >> >> [0x000106d8ff14] >> [0x7fff6ca6bf5a] >> [0x0001072d0984] >> [0x000106de95e8] >> [0x000106d79bb2] >> [0x7fff6c7ea115] >> [0x0001] >> [end of stack trace] >> Segmentation fault: 11 >> >> Same issue on linux - >> https://travis-ci.org/pinepain/php-v8/jobs/344550482 (scroll to the >> bottom). >> >> I would really appreciate any help here as I'm not quite sure whether >> it's an issue on my side or some regression/bug in v8. >> >> Regards, >> Bogdan >> >> -- >> -- >> v8-users mailing list >> v8-u...@googlegroups.com >> http://groups.google.com/group/v8-users >> --- >> You received this message because you are subscribed to the Google Groups >> "v8-users" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to v8-users+u...@googlegroups.com . >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Double Proxy resolve/reject causes segfault
Hi! While working on upgrading php-v8 extension from 6.5.144 to 6.6.275 I find a strange issue: when promise in non-pending stage get resolved/rejected, application fails with segfault. While it's an edge case, it still possible in userland and luckily it was covered by php-v8 unit tests. As v8 API says that calling resolve/reject on a promise in non-pending state should have no effect, I find this segfault a bit strange. Could it be some regression or so? Here's minimal example to reproduce the issue: hello_world.cpp #include #include #include #include using namespace v8; int main(int argc, char* argv[]) { // Initialize V8. //v8::V8::InitializeICU(); std::unique_ptr platform = v8::platform::NewDefaultPlatform (); v8::V8::InitializePlatform(platform.get()); V8::Initialize(); v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = v8::ArrayBuffer::Allocator:: NewDefaultAllocator(); // Create a new Isolate and make it the current one. Isolate* isolate = v8::Isolate::New(create_params); v8::Persistent test; { Isolate::Scope isolate_scope(isolate); // Create a stack-allocated handle scope. HandleScope handle_scope(isolate); // Create a new context. Local context = Context::New(isolate); // Enter the context for compiling and running the hello world script. Context::Scope context_scope(context); Local local_value = String::NewFromUtf8(isolate, "test"); v8::MaybeLocal maybe_local_resolver = v8::Promise ::Resolver::New(context); v8::Local local_resolver = maybe_local_resolver. ToLocalChecked(); local_resolver->Resolve(context, local_value); local_resolver->Resolve(context, local_value); } // Dispose the isolate and tear down V8. isolate->Dispose(); V8::Dispose(); V8::ShutdownPlatform(); return 0; } Build on macOS with ROOT=/usr/local/opt/v8@6.6 LIB_DIR=$ROOT/lib/ SRC_DIR=$ROOT INCLUDE_DIR=$ROOT/include g++ hello_world.cpp -o hello_world \ -Wno-unused-result \ -g \ -O2 \ -std=c++14 \ -I$SRC_DIR \ -I$INCLUDE_DIR \ -L$LIB_DIR \ -lv8_libbase \ -lv8_libplatform \ -lv8 \ -lpthread install_name_tool -add_rpath $LIB_DIR hello_world And fails with $ ./hello_world Received signal 11 SEGV_MAPERR 000a C stack trace === [0x000106d8ff14] [0x7fff6ca6bf5a] [0x0001072d0984] [0x000106de95e8] [0x000106d79bb2] [0x7fff6c7ea115] [0x0001] [end of stack trace] Segmentation fault: 11 Same issue on linux - https://travis-ci.org/pinepain/php-v8/jobs/344550482 (scroll to the bottom). I would really appreciate any help here as I'm not quite sure whether it's an issue on my side or some regression/bug in v8. Regards, Bogdan -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Undefined reference to v8::platform::NewDefaultPlatform
Indeed. By "relocation" I mean that it was built using one stdlib and moved to the system with another one, but I agree that it's more correct to name as stdlib issue rather then relocation issue. I tried to link with libc++.so that generated by v8 build, though, no luck with it for some reason. For now using is_clang=false works fine, apart that it increases php-v8 tests run time with valgrind enabled significantly. On Tuesday, January 2, 2018 at 7:59:48 AM UTC+2, Zac Hansen wrote: > > It's not a "relocation" issue, I'm pretty sure -- it's a stdlib issue. > It looks like the first symbol was from libc++ (the __1 gives it away) and > the second was most likely from libstdc++. <== just a guess but pretty > consistent with stuff I've seen before. > > On Monday, January 1, 2018 at 10:57:12 AM UTC-8, Bogdan Padalko wrote: >> >> Thanks Ben! This is it. It was my fault building with clang and hoping >> that the build will be relocatable. >> >> Building with GN args: >> is_debug: false, >> is_official_build: true, >> is_component_build: true, >> is_cfi: false, >> is_clang: false, >> v8_use_external_startup_data: false, >> treat_warnings_as_errors: false, >> use_custom_libcxx: false, >> use_sysroot: false, >> use_gold: false >> >> works perfect! >> >> Thank you all who's been helping me with this! Happy New Year! >> >> Regards, >> Bogdan >> >> >> >> >> On Monday, January 1, 2018 at 4:17:54 PM UTC+2, Ben Noordhuis wrote: >>> >>> On Mon, Jan 1, 2018 at 3:00 PM, Bogdan Padalko >>> wrote: >>> > Hi Zac, thanks for the quick reply! >>> > >>> > Here's what I see in library: >>> > >>> > $ objdump -T /opt/libv8-6.5/lib/libv8_libplatform.so | grep >>> NewDefault >>> > a850 gDF .text012e Base >>> > >>> _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingENSt3__110unique_ptrINS_17TracingControllerENS3_14default_deleteIS5_ >>> >>> >>> > >>> > >>> > and this is the error I get later when get php-v8 compiled and try to >>> load: >>> > >>> > >>> _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE >>> >>> >>> > >>> > As you see, they differs and it looks like I missed something, but >>> couldn't >>> > grasp what and it looks like this is the cause of >>> > >>> > /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined >>> reference >>> > to `v8::platform::NewDefaultPlatform(int, >>> v8::platform::IdleTaskSupport, >>> > v8::platform::InProcessStackDumping, >>> std::unique_ptr>> > std::default_delete >)' >>> > >>> > error too. >>> > >>> > Happy New Year! >>> > Bogdan >>> >>> If you run them through c++filt, you'll see the difference: >>> >>> v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, >>> v8::platform::InProcessStackDumping, >>> std::__1::unique_ptr>> std::__1::default_delete >) >>> >>> vs: >>> >>> v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, >>> v8::platform::InProcessStackDumping, >>> std::unique_ptr>> std::default_delete >) >>> >>> I'm guessing one is compiled against different headers than the other >>> or with a different -std=... flag. If you built V8 with the bundled >>> clang, try rebuilding it with clang=0. >>> >> -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Undefined reference to v8::platform::NewDefaultPlatform
Thanks Ben! This is it. It was my fault building with clang and hoping that the build will be relocatable. Building with GN args: is_debug: false, is_official_build: true, is_component_build: true, is_cfi: false, is_clang: false, v8_use_external_startup_data: false, treat_warnings_as_errors: false, use_custom_libcxx: false, use_sysroot: false, use_gold: false works perfect! Thank you all who's been helping me with this! Happy New Year! Regards, Bogdan On Monday, January 1, 2018 at 4:17:54 PM UTC+2, Ben Noordhuis wrote: > > On Mon, Jan 1, 2018 at 3:00 PM, Bogdan Padalko > wrote: > > Hi Zac, thanks for the quick reply! > > > > Here's what I see in library: > > > > $ objdump -T /opt/libv8-6.5/lib/libv8_libplatform.so | grep NewDefault > > a850 gDF .text012e Base > > > _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingENSt3__110unique_ptrINS_17TracingControllerENS3_14default_deleteIS5_ > > > > > > > > and this is the error I get later when get php-v8 compiled and try to > load: > > > > > _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE > > > > > > As you see, they differs and it looks like I missed something, but > couldn't > > grasp what and it looks like this is the cause of > > > > /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined > reference > > to `v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, > > v8::platform::InProcessStackDumping, > std::unique_ptr > std::default_delete >)' > > > > error too. > > > > Happy New Year! > > Bogdan > > If you run them through c++filt, you'll see the difference: > > v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, > v8::platform::InProcessStackDumping, > std::__1::unique_ptr std::__1::default_delete >) > > vs: > > v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, > v8::platform::InProcessStackDumping, > std::unique_ptr std::default_delete >) > > I'm guessing one is compiled against different headers than the other > or with a different -std=... flag. If you built V8 with the bundled > clang, try rebuilding it with clang=0. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Undefined reference to v8::platform::NewDefaultPlatform
Hi Zac, thanks for the quick reply! Here's what I see in library: $ objdump -T /opt/libv8-6.5/lib/libv8_libplatform.so | grep NewDefault a850 gDF .text012e Base _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingENSt3__110unique_ptrINS_17TracingControllerENS3_14default_deleteIS5_ and this is the error I get later when get php-v8 compiled and try to load: _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE As you see, they differs and it looks like I missed something, but couldn't grasp what and it looks like this is the cause of /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined reference to `v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::unique_ptr >)' error too. Happy New Year! Bogdan On Monday, January 1, 2018 at 6:47:13 AM UTC+2, Zac Hansen wrote: > > If you look at the symbols in your libs is it in there anywhere? > > On Saturday, December 30, 2017 at 10:01:28 AM UTC-8, Bogdan Padalko wrote: >> >> Thanks for quick reply! Unfortunately, it's the same. I ended up with >> hello world example after to trying out to use NewDefaultPlatform with >> php-v8 ( >> https://github.com/pinepain/php-v8/blob/53a562e10c23e5f835b2ccdb20967f9c4aef529e/src/php_v8_a.cc#L34), >> >> which yield me there >> >> /home/vagrant/.phpbrew/php/7.2-debug/bin/php: symbol lookup error: /home/ >> vagrant/php-v8/modules/v8.so: undefined symbol: >> _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE >> >> With CreateDefaultPlatform it works just fine, and there was no other >> changes to sources except of using v8 6.5.116 and using NewDefaultPlatform. >> Bare 6.5.116 with CreateDefaultPlatform works fine. >> >> >> On Saturday, December 30, 2017 at 7:28:25 PM UTC+2, Ben Noordhuis wrote: >>> >>> On Sat, Dec 30, 2017 at 5:54 PM, Bogdan Padalko >>> wrote: >>> > Hi! >>> > >>> > I'm trying to adapt changes from >>> > >>> https://github.com/v8/v8/commit/ffee558e14e28fc8b1f9a3c10ea3615e0d686c7b >>> to >>> > replace CreateDefaultPlatform with NewDefaultPlatform calls, however, >>> for >>> > some reason I'm getting >>> > >>> > /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined >>> reference >>> > to `v8::platform::NewDefaultPlatform(int, >>> v8::platform::IdleTaskSupport, >>> > v8::platform::InProcessStackDumping, >>> std::unique_ptr>> > std::default_delete >)' >>> > >>> > error with the following code: >>> > >>> > #include >>> > #include >>> > >>> > #include >>> > #include >>> > >>> > using namespace v8; >>> > >>> > void weak_callback(const >>> v8::WeakCallbackInfo>& >>> > data) { >>> > printf("Weak callback called\n"); >>> > data.GetParameter()->Reset(); >>> > } >>> > >>> > int main(int argc, char* argv[]) { >>> > // Initialize V8. >>> > v8::V8::InitializeICU(); >>> > // v8::Platform *platform = v8::platform::CreateDefaultPlatform(); >>> > // v8::V8::InitializePlatform(platform); >>> > >>> > std::unique_ptr platform = >>> > v8::platform::NewDefaultPlatform(); >>> > v8::V8::InitializePlatform(platform.get()); >>> > >>> > V8::Initialize(); >>> > >>> > v8::Isolate::CreateParams create_params; >>> > create_params.array_buffer_allocator = >>> > v8::ArrayBuffer::Allocator::NewDefaultAllocator(); >>> > >>> > // Create a new Isolate and make it the current one. >>> > Isolate* isolate = v8::Isolate::New(create_params); >>> > >>> > v8::Persistent test; >>> > >>> > { >>> > Isolate::Scope isolate_scope(isolate); >>> > >>> > // Create a stack-allocated handle scope. >>> > HandleScope handle_scope(isolate); >>> > >>> > // Create a new context. >>> > Local context = Context::New(isolate); >>> > >>> > // Enter the context for compiling and running the hello world >>> script. >>> > Context::Scope context_scope(context); >>> > >>> > >>> > test.Reset(isolate, String::NewFromUtf8(isolate, "Hello' + ', >>> > World!'")); >>> > test.SetWeak(&test, weak_callback, >>> v8::WeakCallbackType::kParameter); >>> > >>> > >>> > // Create a string containing the JavaScript source code. >>> > Local source = String::NewFromUtf8(isolate, "(2+2*2) + ' ' >>> + >>> > 'Hello' + ', World!'"); >>> > >>> > // Compile the source code. >>> > Local
Re: [v8-users] Undefined reference to v8::platform::NewDefaultPlatform
Thanks for quick reply! Unfortunately, it's the same. I ended up with hello world example after to trying out to use NewDefaultPlatform with php-v8 (https://github.com/pinepain/php-v8/blob/53a562e10c23e5f835b2ccdb20967f9c4aef529e/src/php_v8_a.cc#L34), which yield me there /home/vagrant/.phpbrew/php/7.2-debug/bin/php: symbol lookup error: /home/ vagrant/php-v8/modules/v8.so: undefined symbol: _ZN2v88platform18NewDefaultPlatformEiNS0_15IdleTaskSupportENS0_21InProcessStackDumpingESt10unique_ptrINS_17TracingControllerESt14default_deleteIS4_EE With CreateDefaultPlatform it works just fine, and there was no other changes to sources except of using v8 6.5.116 and using NewDefaultPlatform. Bare 6.5.116 with CreateDefaultPlatform works fine. On Saturday, December 30, 2017 at 7:28:25 PM UTC+2, Ben Noordhuis wrote: > > On Sat, Dec 30, 2017 at 5:54 PM, Bogdan Padalko > wrote: > > Hi! > > > > I'm trying to adapt changes from > > https://github.com/v8/v8/commit/ffee558e14e28fc8b1f9a3c10ea3615e0d686c7b > to > > replace CreateDefaultPlatform with NewDefaultPlatform calls, however, > for > > some reason I'm getting > > > > /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined > reference > > to `v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, > > v8::platform::InProcessStackDumping, > std::unique_ptr > std::default_delete >)' > > > > error with the following code: > > > > #include > > #include > > > > #include > > #include > > > > using namespace v8; > > > > void weak_callback(const > v8::WeakCallbackInfo>& > > data) { > > printf("Weak callback called\n"); > > data.GetParameter()->Reset(); > > } > > > > int main(int argc, char* argv[]) { > > // Initialize V8. > > v8::V8::InitializeICU(); > > // v8::Platform *platform = v8::platform::CreateDefaultPlatform(); > > // v8::V8::InitializePlatform(platform); > > > > std::unique_ptr platform = > > v8::platform::NewDefaultPlatform(); > > v8::V8::InitializePlatform(platform.get()); > > > > V8::Initialize(); > > > > v8::Isolate::CreateParams create_params; > > create_params.array_buffer_allocator = > > v8::ArrayBuffer::Allocator::NewDefaultAllocator(); > > > > // Create a new Isolate and make it the current one. > > Isolate* isolate = v8::Isolate::New(create_params); > > > > v8::Persistent test; > > > > { > > Isolate::Scope isolate_scope(isolate); > > > > // Create a stack-allocated handle scope. > > HandleScope handle_scope(isolate); > > > > // Create a new context. > > Local context = Context::New(isolate); > > > > // Enter the context for compiling and running the hello world > script. > > Context::Scope context_scope(context); > > > > > > test.Reset(isolate, String::NewFromUtf8(isolate, "Hello' + ', > > World!'")); > > test.SetWeak(&test, weak_callback, > v8::WeakCallbackType::kParameter); > > > > > > // Create a string containing the JavaScript source code. > > Local source = String::NewFromUtf8(isolate, "(2+2*2) + ' ' + > > 'Hello' + ', World!'"); > > > > // Compile the source code. > > Local
[v8-users] Re: how to install php-v8 version 0.2.1 on centos 7
Hi, php-v8 author is here (I don't look into this mailing often last time). Currently, php-v8 relies on v8 library provided by user or system (note what version is required). For Ubuntu and macOS I build v8 and make it publicly available. Unfortunately, I do not build v8 for Centos yet and currently have no plans to do that. Though, you may do that by yourself. On Tuesday, December 5, 2017 at 1:00:48 AM UTC+2, Felipe Salazar wrote: > > Hi everyone > > Currently, I am migration an application from Ubuntu 16.04 to Centos 7. > The application required that I install php7.1-v8 version 0.2.1. I have > been researching online and there is not a good documentation to install > it. Can anyone guide me? Thank you in advance. > -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Undefined reference to v8::platform::NewDefaultPlatform
Hi! I'm trying to adapt changes from https://github.com/v8/v8/commit/ffee558e14e28fc8b1f9a3c10ea3615e0d686c7b to replace CreateDefaultPlatform with NewDefaultPlatform calls, however, for some reason I'm getting /home/vagrant/php-v8/scripts/test_v8/hello_world.cpp:21: undefined reference to `v8::platform::NewDefaultPlatform(int, v8::platform::IdleTaskSupport, v8::platform::InProcessStackDumping, std::unique_ptr >)' error with the following code: #include #include #include #include using namespace v8; void weak_callback(const v8::WeakCallbackInfo>& data) { printf("Weak callback called\n"); data.GetParameter()->Reset(); } int main(int argc, char* argv[]) { // Initialize V8. v8::V8::InitializeICU(); // v8::Platform *platform = v8::platform::CreateDefaultPlatform(); // v8::V8::InitializePlatform(platform); std::unique_ptr platform = v8::platform::NewDefaultPlatform (); v8::V8::InitializePlatform(platform.get()); V8::Initialize(); v8::Isolate::CreateParams create_params; create_params.array_buffer_allocator = v8::ArrayBuffer::Allocator:: NewDefaultAllocator(); // Create a new Isolate and make it the current one. Isolate* isolate = v8::Isolate::New(create_params); v8::Persistent test; { Isolate::Scope isolate_scope(isolate); // Create a stack-allocated handle scope. HandleScope handle_scope(isolate); // Create a new context. Local context = Context::New(isolate); // Enter the context for compiling and running the hello world script. Context::Scope context_scope(context); test.Reset(isolate, String::NewFromUtf8(isolate, "Hello' + ', World!'" )); test.SetWeak(&test, weak_callback, v8::WeakCallbackType::kParameter); // Create a string containing the JavaScript source code. Local source = String::NewFromUtf8(isolate, "(2+2*2) + ' ' + 'Hello' + ', World!'"); // Compile the source code. Local
[v8-users] Re: Valgring reports memleak in v8 internals at 6.3.2
(For some reasons my messages get deleted) Hi Zac! Thanks for the suggestion. I tried different options but track-origins makes no noticable difference. For now I just suppressed these warnings and will wait for v8 folks reply, if any. For me the issue looks related to 6566. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Re: Valgring reports memleak in v8 internals at 6.3.2
Under certain circumstances when when I suppressed reports listed in a previous mail, I'm getting output similar to one in https://bugs.chromium.org/p/v8/issues/detail?id=6566, so I guess the overall issue is that how valgrind traits optimized v8 code (I'm using release build). Can someone validate my assumptions, please? While it looks like I get it, v8 internals is a tough piece of cake. For now I will suppress all reports which relates to v8 internals. Regards, Bogdan -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] How to call js function from C++ with default recv value?
Hi, I'm trying to deal with a case when user pass Function callback to C++ and it needs to be invoked from that C++ respecting this value, So Function::Call() does not fulfill this requirement. Are there any change to achieve that without creating new Script and run it within a new Context with, e.g. 'fnc(...args)' where fnc is callback user provided and args are function arguments to call it with, both set on global object of this context? -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] How to create generator function or object from C/C++ code?
Hi, is it possible to create generator function and/or generator object from v8 API? If no, are there any plans to do that? I do v8 engine integration and at this time I have to wrap raw functions into js generator function. P.S.: I would also ask the same question about async functions, but it goes behind the scope of main question. If there are any info about async function creation from v8 API please let me know. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [v8-users] Does changed timezone notification still required in latest v8?
Thanks for the clarification! -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Does changed timezone notification still required in latest v8?
Hi, after upgrading to latest v8 from master (say, v4.10.43) on linux (ubuntu 15.10) and os x (10.11.3) changing timezone with putennv("TZ=") (http://man7.org/linux/man-pages/man3/putenv.3.html) new timezone affects v8 runtime without calling v8::Date::DateTimeConfigurationChangeNotification. I guess it happens after "[runtime] Migrate several Date builtins to C++" (https://github.com/v8/v8/commit/065e9c536f14b3d7cb4d140c6f74e024e31ee1a2) commit. Here is some meta-code to demonstrate problem: putenv("TZ=America/New_York"); v8::Date::DateTimeConfigurationChangeNotification(); v8::MaybeLocal date = v8::Date::New(context, 144544494.0). ToLocalChecked(); date.ToLocalChecked()->ToString(context); // Wed Oct 21 2015 09:29:00 GMT-0700 (EDT) putenv("TZ=UTC"); date.ToLocalChecked()->ToString(context); // Wed Oct 21 2015 09:29:00 GMT-0700 (UTC) before (apr. that changes I mentioned above) both ToString() returned EDT time. Based on this, I have few questions: 1. How now TZ changes handled internally, if any? 2. What is recommended way to handle TZ changes? 3. Is using v8::Date::DateTimeConfigurationChangeNotification() still mandatory to notify TZ changes? -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[v8-users] Track script execution start and stop.
Hi, I'm embedding v8 and have to limit max time that arbitrary script execution may take. As to script running complete event, it is more or less clear - v8::Isolate::AddCallCompletedCallback() will do the job, but as to catching start I'm stuck a bit. There is v8::Isolate::SetEventLogger() which also may do the job, callback receives event name and start/end flag, so I can strcmp() event name (the target one is V8.Execute) and track it in this way, but maybe there are nicer solution, like v8::Isolate::AddCallCompletedCallback() but for start, not complete? Without hook, one have track any possible execution points, (not only v8::ScriptRun() but also v8::Value::ToString, v8::Function::Call and so on), which may lead to some missed execution point. -- -- v8-users mailing list v8-users@googlegroups.com http://groups.google.com/group/v8-users --- You received this message because you are subscribed to the Google Groups "v8-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.