0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-12-22 19:51:51 +00:00

Merge pull request #490 from stesie/issue-489

Support V8 10.5
This commit is contained in:
Stefan Siegl 2022-06-30 15:21:03 +02:00 committed by GitHub
commit 9afd1a941e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 33 additions and 3 deletions

View File

@ -39,11 +39,15 @@ if test "$PHP_V8JS" != "no"; then
AC_CACHE_CHECK(for C standard version, ac_cv_v8_cstd, [ AC_CACHE_CHECK(for C standard version, ac_cv_v8_cstd, [
ac_cv_v8_cstd="c++14" ac_cv_v8_cstd="c++17"
old_CPPFLAGS=$CPPFLAGS old_CPPFLAGS=$CPPFLAGS
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
CPPFLAGS="-std="$ac_cv_v8_cstd CPPFLAGS="-std="$ac_cv_v8_cstd
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],[],[ac_cv_v8_cstd="c++1y"],[]) AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],[],[
ac_cv_v8_cstd="c++14"
CPPFLAGS="-std="$ac_cv_v8_cstd
AC_RUN_IFELSE([AC_LANG_SOURCE([[int main() { return 0; }]])],[],[ ac_cv_v8_cstd="c++1y" ],[])
],[])
AC_LANG_POP([C++]) AC_LANG_POP([C++])
CPPFLAGS=$old_CPPFLAGS CPPFLAGS=$old_CPPFLAGS
]); ]);
@ -173,6 +177,24 @@ int main ()
V8_SEARCH_BLOB([snapshot_blob.bin], [PHP_V8_SNAPSHOT_BLOB_PATH]) V8_SEARCH_BLOB([snapshot_blob.bin], [PHP_V8_SNAPSHOT_BLOB_PATH])
dnl
dnl Check for v8::V8::InitializeSandbox
dnl
AC_CACHE_CHECK([for v8::V8::InitializeSandbox], ac_cv_has_initialize_sandbox, [
AC_LINK_IFELSE([AC_LANG_PROGRAM([
#define V8_ENABLE_SANDBOX 1
#include <v8.h>
], [ v8::V8::InitializeSandbox(); ])], [
ac_cv_has_initialize_sandbox=yes
], [
ac_cv_has_initialize_sandbox=no
])
])
if test "x$ac_cv_has_initialize_sandbox" = "xyes"; then
AC_DEFINE([V8_HAS_INITIALIZE_SANDBOX], [1],
[Define if V8::InitializeSandbox must be called.])
fi
dnl dnl
dnl Check for v8::ArrayBuffer::Allocator::NewDefaultAllocator dnl Check for v8::ArrayBuffer::Allocator::NewDefaultAllocator
dnl dnl

View File

@ -162,7 +162,11 @@ static PHP_MSHUTDOWN_FUNCTION(v8js)
if(v8_initialized) { if(v8_initialized) {
v8::V8::Dispose(); v8::V8::Dispose();
#if PHP_V8_API_VERSION >= 10000000
v8::V8::DisposePlatform();
#else
v8::V8::ShutdownPlatform(); v8::V8::ShutdownPlatform();
#endif
// @fixme call virtual destructor somehow // @fixme call virtual destructor somehow
//delete v8js_process_globals.v8_platform; //delete v8js_process_globals.v8_platform;
} }

View File

@ -71,6 +71,10 @@ void v8js_v8_init() /* {{{ */
v8js_process_globals.v8_platform = v8::platform::NewDefaultPlatform(); v8js_process_globals.v8_platform = v8::platform::NewDefaultPlatform();
v8::V8::InitializePlatform(v8js_process_globals.v8_platform.get()); v8::V8::InitializePlatform(v8js_process_globals.v8_platform.get());
#ifdef V8_HAS_INITIALIZE_SANDBOX
v8::V8::InitializeSandbox();
#endif
/* Set V8 command line flags (must be done before V8::Initialize()!) */ /* Set V8 command line flags (must be done before V8::Initialize()!) */
if (v8js_process_globals.v8_flags) { if (v8js_process_globals.v8_flags) {
size_t flags_len = strlen(v8js_process_globals.v8_flags); size_t flags_len = strlen(v8js_process_globals.v8_flags);

View File

@ -80,7 +80,7 @@ void v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8:
ctx->isolate = isolate; ctx->isolate = isolate;
/* Set the variable fetch callback for given symbol on named property */ /* Set the variable fetch callback for given symbol on named property */
php_obj->SetAccessor(V8JS_STRL(ZSTR_VAL(property_name), static_cast<int>(ZSTR_LEN(property_name))), v8js_fetch_php_variable, NULL, v8::External::New(isolate, ctx), v8::PROHIBITS_OVERWRITING, v8::ReadOnly, v8::AccessorSignature::New(isolate, php_obj_t)); php_obj->SetAccessor(V8JS_STRL(ZSTR_VAL(property_name), static_cast<int>(ZSTR_LEN(property_name))), v8js_fetch_php_variable, NULL, v8::External::New(isolate, ctx), v8::PROHIBITS_OVERWRITING, v8::ReadOnly);
/* record the context so we can free it later */ /* record the context so we can free it later */
accessor_list->push_back(ctx); accessor_list->push_back(ctx);