mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-31 22:31:52 +00:00
Merge pull request #314 from stesie/issue-313
Fix build against recent V8 6.0 versions
This commit is contained in:
commit
ba256d4bc5
4
Vagrantfile
vendored
4
Vagrantfile
vendored
@ -37,7 +37,7 @@ Vagrant.configure("2") do |config|
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
%w{5.9.35}.each { |version|
|
%w{5.9.35 6.0.318}.each { |version|
|
||||||
config.vm.define "v8-#{version}" do |i|
|
config.vm.define "v8-#{version}" do |i|
|
||||||
i.vm.synced_folder ".", "/data/v8js"
|
i.vm.synced_folder ".", "/data/v8js"
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ Vagrant.configure("2") do |config|
|
|||||||
|
|
||||||
# Install to /opt/libv8-#{version}/
|
# Install to /opt/libv8-#{version}/
|
||||||
sudo mkdir -p /opt/libv8-#{version}/{lib,include}
|
sudo mkdir -p /opt/libv8-#{version}/{lib,include}
|
||||||
sudo cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin /opt/libv8-#{version}/lib/
|
sudo cp out.gn/x64.release/lib*.so out.gn/x64.release/*_blob.bin out.gn/x64.release/icudtl.dat /opt/libv8-#{version}/lib/
|
||||||
sudo cp -R include/* /opt/libv8-#{version}/include/
|
sudo cp -R include/* /opt/libv8-#{version}/include/
|
||||||
SHELL
|
SHELL
|
||||||
end
|
end
|
||||||
|
32
config.m4
32
config.m4
@ -94,12 +94,7 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
save_LIBS="$LIBS"
|
save_LIBS="$LIBS"
|
||||||
LIBS="$LIBS $1 -lv8_libplatform -lv8"
|
LIBS="$LIBS $1 -lv8_libplatform -lv8"
|
||||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
namespace v8 {
|
#include <libplatform/libplatform.h>
|
||||||
namespace platform {
|
|
||||||
enum class IdleTaskSupport { kDisabled, kEnabled };
|
|
||||||
void* CreateDefaultPlatform($2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
], [ v8::platform::CreateDefaultPlatform(); ])], [
|
], [ v8::platform::CreateDefaultPlatform(); ])], [
|
||||||
dnl libv8_libplatform.so found
|
dnl libv8_libplatform.so found
|
||||||
AC_MSG_RESULT(found)
|
AC_MSG_RESULT(found)
|
||||||
@ -109,15 +104,11 @@ if test "$PHP_V8JS" != "no"; then
|
|||||||
LIBS="$save_LIBS"
|
LIBS="$save_LIBS"
|
||||||
])
|
])
|
||||||
|
|
||||||
V8_CHECK_LINK([], [int thread_pool_size = 0, IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled], [], [
|
V8_CHECK_LINK([], [], [], [
|
||||||
V8_CHECK_LINK([], [int thread_pool_size = 0], [], [
|
V8_CHECK_LINK([-lv8_libbase], [], [], [
|
||||||
V8_CHECK_LINK([-lv8_libbase], [int thread_pool_size = 0, IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled], [], [
|
|
||||||
V8_CHECK_LINK([-lv8_libbase], [int thread_pool_size = 0], [], [
|
|
||||||
AC_MSG_ERROR([could not find libv8_libplatform library])
|
AC_MSG_ERROR([could not find libv8_libplatform library])
|
||||||
])
|
])
|
||||||
])
|
])
|
||||||
])
|
|
||||||
])
|
|
||||||
|
|
||||||
|
|
||||||
dnl
|
dnl
|
||||||
@ -183,6 +174,23 @@ 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::ArrayBuffer::Allocator::NewDefaultAllocator
|
||||||
|
dnl
|
||||||
|
AC_CACHE_CHECK([for v8::ArrayBuffer::Allocator::NewDefaultAllocator], ac_cv_has_default_allocator, [
|
||||||
|
AC_LINK_IFELSE([AC_LANG_PROGRAM([
|
||||||
|
#include <v8.h>
|
||||||
|
], [ v8::ArrayBuffer::Allocator::NewDefaultAllocator(); ])], [
|
||||||
|
ac_cv_has_default_allocator=yes
|
||||||
|
], [
|
||||||
|
ac_cv_has_default_allocator=no
|
||||||
|
])
|
||||||
|
])
|
||||||
|
if test "x$ac_cv_has_default_allocator" = "xno"; then
|
||||||
|
AC_DEFINE([USE_INTERNAL_ALLOCATOR], [1],
|
||||||
|
[Define unless v8::ArrayBuffer::Allocator::NewDefaultAllocator is usable.])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_LANG_RESTORE
|
AC_LANG_RESTORE
|
||||||
LIBS=$old_LIBS
|
LIBS=$old_LIBS
|
||||||
LDFLAGS="$old_LDFLAGS"
|
LDFLAGS="$old_LDFLAGS"
|
||||||
|
@ -71,6 +71,7 @@ struct v8js_jsext {
|
|||||||
};
|
};
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
|
#ifdef USE_INTERNAL_ALLOCATOR
|
||||||
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||||
public:
|
public:
|
||||||
virtual void* Allocate(size_t length) {
|
virtual void* Allocate(size_t length) {
|
||||||
@ -80,6 +81,7 @@ public:
|
|||||||
virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
|
virtual void* AllocateUninitialized(size_t length) { return malloc(length); }
|
||||||
virtual void Free(void* data, size_t) { free(data); }
|
virtual void Free(void* data, size_t) { free(data); }
|
||||||
};
|
};
|
||||||
|
#endif /** USE_INTERNAL_ALLOCATOR */
|
||||||
|
|
||||||
|
|
||||||
static void v8js_free_storage(zend_object *object) /* {{{ */
|
static void v8js_free_storage(zend_object *object) /* {{{ */
|
||||||
@ -201,6 +203,10 @@ static void v8js_free_storage(zend_object *object) /* {{{ */
|
|||||||
c->modules_base.~vector();
|
c->modules_base.~vector();
|
||||||
|
|
||||||
zval_ptr_dtor(&c->zval_snapshot_blob);
|
zval_ptr_dtor(&c->zval_snapshot_blob);
|
||||||
|
|
||||||
|
#ifndef USE_INTERNAL_ALLOCATOR
|
||||||
|
delete c->create_params.array_buffer_allocator;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -353,8 +359,12 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
|
|
||||||
new (&c->create_params) v8::Isolate::CreateParams();
|
new (&c->create_params) v8::Isolate::CreateParams();
|
||||||
|
|
||||||
|
#ifdef USE_INTERNAL_ALLOCATOR
|
||||||
static ArrayBufferAllocator array_buffer_allocator;
|
static ArrayBufferAllocator array_buffer_allocator;
|
||||||
c->create_params.array_buffer_allocator = &array_buffer_allocator;
|
c->create_params.array_buffer_allocator = &array_buffer_allocator;
|
||||||
|
#else
|
||||||
|
c->create_params.array_buffer_allocator = v8::ArrayBuffer::Allocator::NewDefaultAllocator();
|
||||||
|
#endif
|
||||||
|
|
||||||
new (&c->snapshot_blob) v8::StartupData();
|
new (&c->snapshot_blob) v8::StartupData();
|
||||||
if (snapshot_blob) {
|
if (snapshot_blob) {
|
||||||
|
Loading…
Reference in New Issue
Block a user