mirror of
https://github.com/phpv8/v8js.git
synced 2024-11-08 14:48:40 +00:00
commit
9afd1a941e
24
config.m4
24
config.m4
@ -39,11 +39,15 @@ if test "$PHP_V8JS" != "no"; then
|
||||
|
||||
|
||||
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
|
||||
AC_LANG_PUSH([C++])
|
||||
CPPFLAGS="-std="$ac_cv_v8_cstd
|
||||
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++])
|
||||
CPPFLAGS=$old_CPPFLAGS
|
||||
]);
|
||||
@ -173,6 +177,24 @@ int main ()
|
||||
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 Check for v8::ArrayBuffer::Allocator::NewDefaultAllocator
|
||||
dnl
|
||||
|
@ -162,7 +162,11 @@ static PHP_MSHUTDOWN_FUNCTION(v8js)
|
||||
|
||||
if(v8_initialized) {
|
||||
v8::V8::Dispose();
|
||||
#if PHP_V8_API_VERSION >= 10000000
|
||||
v8::V8::DisposePlatform();
|
||||
#else
|
||||
v8::V8::ShutdownPlatform();
|
||||
#endif
|
||||
// @fixme call virtual destructor somehow
|
||||
//delete v8js_process_globals.v8_platform;
|
||||
}
|
||||
|
@ -71,6 +71,10 @@ void v8js_v8_init() /* {{{ */
|
||||
v8js_process_globals.v8_platform = v8::platform::NewDefaultPlatform();
|
||||
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()!) */
|
||||
if (v8js_process_globals.v8_flags) {
|
||||
size_t flags_len = strlen(v8js_process_globals.v8_flags);
|
||||
|
@ -80,7 +80,7 @@ void v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8:
|
||||
ctx->isolate = isolate;
|
||||
|
||||
/* 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 */
|
||||
accessor_list->push_back(ctx);
|
||||
|
Loading…
Reference in New Issue
Block a user