From 6dfe11f09bf3266bacd65a04ac367b9e91ff6c67 Mon Sep 17 00:00:00 2001 From: Bogdan Padalko Date: Thu, 22 Feb 2018 00:24:03 +0200 Subject: [PATCH 1/5] Bump required v8 version to 6.6.313, closes #93 --- .travis.yml | 2 +- CMakeLists.txt | 4 ++-- README.md | 2 +- config.m4 | 2 +- scripts/provision/provision.sh | 4 ++-- scripts/test_v8/hello_world.cpp | 8 +------- scripts/test_v8/hello_world_build_deb.sh | 2 +- scripts/test_v8/hello_world_build_osx.sh | 2 +- src/php_v8_exceptions.h | 8 ++++++++ src/php_v8_proxy.cc | 17 +++++++++++++---- stubs/src/ProxyObject.php | 8 ++++---- tests/001-verify_extension_entities.phpt | 4 ++-- tests/PromiseObject_methods.phpt | 2 ++ tests/ProxyObject_methods.phpt | 4 ++-- 14 files changed, 41 insertions(+), 28 deletions(-) diff --git a/.travis.yml b/.travis.yml index 28d8ce8..d1e2ffe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ services: env: global: - - V8=6.5.144 + - V8=6.6.313 matrix: - PHP=7.2 - PHP=7.2 TEST_PHP_ARGS=-m diff --git a/CMakeLists.txt b/CMakeLists.txt index b193a5f..ac962e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,8 +3,8 @@ project(php-v8) # NOTE: This CMake file is just for syntax highlighting in CLion -include_directories(/usr/local/opt/v8@6.5/include) -include_directories(/usr/local/opt/v8@6.5/include/libplatform) +include_directories(/usr/local/opt/v8@6.6/include) +include_directories(/usr/local/opt/v8@6.6/include/libplatform) include_directories(/usr/local/include/php) include_directories(/usr/local/include/php/TSRM) diff --git a/README.md b/README.md index 7c28812..100ee8f 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ on top of php-v8 extension and makes embedding JavaScript in PHP easier. ### Requirements #### V8 -You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.5.144 required. +You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.6.275 required. #### PHP This extension is PHP7-only. It works and tested with both PHP 7.0 and PHP 7.1. diff --git a/config.m4 b/config.m4 index 5273790..8b0cecc 100644 --- a/config.m4 +++ b/config.m4 @@ -19,7 +19,7 @@ if test "$PHP_V8" != "no"; then SEARCH_PATH="/usr/local /usr" SEARCH_FOR="include/v8.h" - V8_MIN_API_VERSION_STR=6.5.144 + V8_MIN_API_VERSION_STR=6.6.275 DESIRED_V8_VERSION=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%s.%s", [$]1, [$]2;}'` diff --git a/scripts/provision/provision.sh b/scripts/provision/provision.sh index 0a9a2b9..17ff7d3 100644 --- a/scripts/provision/provision.sh +++ b/scripts/provision/provision.sh @@ -5,7 +5,7 @@ echo Provisioning... # Add Ondřej Surý's PPA with co-installable PHP versions: sudo add-apt-repository -y ppa:ondrej/php # Add libv8 PPA: -sudo add-apt-repository ppa:pinepain/libv8-6.5 +sudo add-apt-repository ppa:pinepain/libv8-6.6 # Let's update packages list: sudo apt-get update @@ -19,7 +19,7 @@ sudo apt-get install -y git htop curl pkgconf # Build and development requirements -sudo apt-get install -y libv8-6.5 libv8-6.5-dev libv8-6.5-dbg +sudo apt-get install -y libv8-6.6 libv8-6.6-dev libv8-6.6-dbg sudo apt-get install -y dh-make valgrind sudo apt-get install -y libssl-dev openssl sudo apt-get install -y php7.2 php7.2-cli php7.2-dev php7.2-fpm diff --git a/scripts/test_v8/hello_world.cpp b/scripts/test_v8/hello_world.cpp index 6bb728b..4adb4be 100644 --- a/scripts/test_v8/hello_world.cpp +++ b/scripts/test_v8/hello_world.cpp @@ -6,15 +6,9 @@ using namespace v8; -void weak_callback(const v8::WeakCallbackInfo>& data) { - printf("Weak callback called\n"); - data.GetParameter()->Reset(); -// data.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(-(1024*1024*1024)); -} - int main(int argc, char* argv[]) { // Initialize V8. - v8::V8::InitializeICU(); + //v8::V8::InitializeICU(); std::unique_ptr platform = v8::platform::NewDefaultPlatform(); v8::V8::InitializePlatform(platform.get()); diff --git a/scripts/test_v8/hello_world_build_deb.sh b/scripts/test_v8/hello_world_build_deb.sh index cb6345c..c9644fe 100755 --- a/scripts/test_v8/hello_world_build_deb.sh +++ b/scripts/test_v8/hello_world_build_deb.sh @@ -1,6 +1,6 @@ #!/bin/bash -ROOT=/opt/libv8-6.5 +ROOT=/opt/libv8-6.6 LIB_DIR=$ROOT/lib/ SRC_DIR=$ROOT diff --git a/scripts/test_v8/hello_world_build_osx.sh b/scripts/test_v8/hello_world_build_osx.sh index 7616aff..18ff08c 100755 --- a/scripts/test_v8/hello_world_build_osx.sh +++ b/scripts/test_v8/hello_world_build_osx.sh @@ -1,6 +1,6 @@ #!/bin/bash -ROOT=/usr/local/opt/v8@6.5 +ROOT=/usr/local/opt/v8@6.6 LIB_DIR=$ROOT/lib/ SRC_DIR=$ROOT diff --git a/src/php_v8_exceptions.h b/src/php_v8_exceptions.h index 0f1861d..242fe4e 100644 --- a/src/php_v8_exceptions.h +++ b/src/php_v8_exceptions.h @@ -81,8 +81,15 @@ extern void php_v8_throw_try_catch_exception(php_v8_context_t *php_v8_context, v return; \ } +#define PHP_V8_THROW_EXCEPTION_WHEN_UNDEFINED_CE(value, message, ce) \ + if ((value)->IsUndefined()) { \ + PHP_V8_THROW_EXCEPTION_CE(message, ce); \ + return; \ + } + #define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(value, message) PHP_V8_THROW_EXCEPTION_WHEN_NOTHING_CE((value), (message), php_v8_value_exception_class_entry) #define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_EMPTY(value, message) PHP_V8_THROW_EXCEPTION_WHEN_EMPTY_CE((value), (message), php_v8_value_exception_class_entry) +#define PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(value, message) PHP_V8_THROW_EXCEPTION_WHEN_UNDEFINED_CE((value), (message), php_v8_value_exception_class_entry) #define PHP_V8_THROW_EXCEPTION_WHEN_NOTHING(value, message) \ @@ -97,6 +104,7 @@ extern void php_v8_throw_try_catch_exception(php_v8_context_t *php_v8_context, v return; \ } + #define PHP_V8_THROW_EXCEPTION_WHEN_LIMITS_HIT(php_v8_context) \ if ((php_v8_context)->php_v8_isolate->limits.time_limit_hit || (php_v8_context)->php_v8_isolate->limits.memory_limit_hit) { \ php_v8_throw_try_catch_exception((php_v8_context), NULL); \ diff --git a/src/php_v8_proxy.cc b/src/php_v8_proxy.cc index 6018869..95b3841 100644 --- a/src/php_v8_proxy.cc +++ b/src/php_v8_proxy.cc @@ -67,7 +67,13 @@ static PHP_METHOD(Proxy, getTarget) { PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); PHP_V8_ENTER_STORED_CONTEXT(php_v8_value); - v8::Local local_target = php_v8_value_get_local_as(php_v8_value)->GetTarget(); + v8::Local local_target = php_v8_value_get_local_as(php_v8_value)->GetTarget(); + + PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(local_target, "Failed to get Proxy target"); // this should never happen + + if (local_target->IsNull()) { + RETURN_NULL(); + } php_v8_get_or_create_value(return_value, local_target, php_v8_value->php_v8_isolate); } @@ -83,7 +89,10 @@ static PHP_METHOD(Proxy, getHandler) { v8::Local local_handler = php_v8_value_get_local_as(php_v8_value)->GetHandler(); - if (local_handler->IsUndefined()) { + // this should never happen + PHP_V8_THROW_VALUE_EXCEPTION_WHEN_UNDEFINED(local_handler, "Failed to get Proxy handler"); // this should never happen + + if (local_handler->IsNull()) { RETURN_NULL(); } @@ -121,10 +130,10 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 2) ZEND_ARG_OBJ_INFO(0, handler, V8\\ObjectValue, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getTarget, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getTarget, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 1) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getHandler, ZEND_RETURN_VALUE, 0, V8\\Value, 0) +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getHandler, ZEND_RETURN_VALUE, 0, V8\\ObjectValue, 1) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_TYPE_INFO_EX(arginfo_isRevoked, ZEND_RETURN_VALUE, 0, _IS_BOOL, 0) diff --git a/stubs/src/ProxyObject.php b/stubs/src/ProxyObject.php index 8872240..2a3be97 100644 --- a/stubs/src/ProxyObject.php +++ b/stubs/src/ProxyObject.php @@ -28,16 +28,16 @@ public function __construct(Context $context, ObjectValue $target, ObjectValue $ } /*** - * @return ObjectValue + * @return Value|ObjectValue|NullValue|null */ - public function getTarget(): ObjectValue + public function getTarget(): ?ObjectValue { } /** - * @return Value|ObjectValue|NullValue + * @return Value|ObjectValue|NullValue|null */ - public function getHandler(): Value + public function getHandler(): ?Value { } diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt index c411c34..4160347 100644 --- a/tests/001-verify_extension_entities.phpt +++ b/tests/001-verify_extension_entities.phpt @@ -810,8 +810,8 @@ class V8\ProxyObject extends V8\ObjectValue implements V8\AdjustableExternalMemoryInterface public function __construct(V8\Context $context, V8\ObjectValue $target, V8\ObjectValue $handler) - public function getTarget(): V8\ObjectValue - public function getHandler(): V8\Value + public function getTarget(): ?V8\ObjectValue + public function getHandler(): ?V8\ObjectValue public function isRevoked(): bool public function revoke() diff --git a/tests/PromiseObject_methods.phpt b/tests/PromiseObject_methods.phpt index 2d8bc33..febcf5b 100644 --- a/tests/PromiseObject_methods.phpt +++ b/tests/PromiseObject_methods.phpt @@ -1,5 +1,7 @@ --TEST-- V8\PromiseObject - object-specific methods +--XFAIL-- +Resolving/rejecting Promise in non-pending state leads to segfault - https://github.com/pinepain/php-v8/issues/95 --SKIPIF-- --FILE-- diff --git a/tests/ProxyObject_methods.phpt b/tests/ProxyObject_methods.phpt index c79e32c..74f279a 100644 --- a/tests/ProxyObject_methods.phpt +++ b/tests/ProxyObject_methods.phpt @@ -23,8 +23,8 @@ $helper->assert('Proxy returns valid handler', $value->getHandler(), $handler); $helper->assert('Proxy is not revoked', $value->isRevoked(), false); $value->revoke(); $helper->assert('Proxy is now revoked', $value->isRevoked(), true); -$helper->assert('Proxy returns valid target', $value->getTarget(), $target); -$helper->assert('Proxy returns null handler', $value->getHandler() instanceof V8\NullValue); +$helper->assert('Proxy returns valid target', $value->getHandler(), null); +$helper->assert('Proxy returns null handler', $value->getHandler(), null); ?> From c2ffd55d190f824125057a4a0eb674f7b972f052 Mon Sep 17 00:00:00 2001 From: Bogdan Padalko Date: Sat, 24 Feb 2018 23:33:08 +0200 Subject: [PATCH 2/5] Add support for integer->strings for GetOwnPropertyNames and GetPropertyNames, closes #96 --- src/php_v8_object.cc | 16 ++++++++++++---- stubs/src/ObjectValue.php | 16 +++++++++++----- tests/001-verify_extension_entities.phpt | 4 ++-- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/src/php_v8_object.cc b/src/php_v8_object.cc index 0b886dc..92f88b8 100644 --- a/src/php_v8_object.cc +++ b/src/php_v8_object.cc @@ -614,14 +614,17 @@ static PHP_METHOD(Object, getPropertyNames) { zend_long mode = static_cast(v8::KeyCollectionMode::kOwnOnly); zend_long property_filter = static_cast(v8::PropertyFilter::ALL_PROPERTIES); zend_long index_filter = static_cast(v8::IndexFilter::kIncludeIndices); + zend_bool convert_to_strings = '\0'; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lll", &context_zv, &mode, &property_filter, &index_filter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lllb", + &context_zv, &mode, &property_filter, &index_filter, &convert_to_strings) == FAILURE) { return; } mode = mode ? mode & PHP_V8_KEY_COLLECTION_MODE_FLAGS : mode; property_filter = property_filter ? property_filter & PHP_V8_PROPERTY_FILTER_FLAGS : property_filter; index_filter = index_filter ? index_filter & PHP_V8_INDEX_FILTER_FLAGS : index_filter; + v8::KeyConversionMode key_conversion = convert_to_strings ? v8::KeyConversionMode::kConvertToString : v8::KeyConversionMode::kKeepNumbers; PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); PHP_V8_CONTEXT_FETCH_WITH_CHECK(context_zv, php_v8_context); @@ -639,7 +642,8 @@ static PHP_METHOD(Object, getPropertyNames) { v8::MaybeLocal maybe_local_array = local_object->GetPropertyNames(context, static_cast(mode), static_cast(property_filter), - static_cast(index_filter)); + static_cast(index_filter), + key_conversion); PHP_V8_MAYBE_CATCH(php_v8_context, try_catch); PHP_V8_THROW_EXCEPTION_WHEN_EMPTY(maybe_local_array, "Failed to get property names") @@ -652,11 +656,13 @@ static PHP_METHOD(Object, getPropertyNames) { static PHP_METHOD(Object, getOwnPropertyNames) { zval *context_zv; zend_long filter = static_cast(v8::PropertyFilter::ALL_PROPERTIES); + zend_bool convert_to_strings = '\0'; - if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|l", &context_zv, &filter) == FAILURE) { + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o|lb", &context_zv, &filter, &convert_to_strings) == FAILURE) { return; } filter = filter ? filter & PHP_V8_PROPERTY_FILTER_FLAGS : filter; + v8::KeyConversionMode key_conversion = convert_to_strings ? v8::KeyConversionMode::kConvertToString : v8::KeyConversionMode::kKeepNumbers; PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); PHP_V8_CONTEXT_FETCH_WITH_CHECK(context_zv, php_v8_context); @@ -671,7 +677,7 @@ static PHP_METHOD(Object, getOwnPropertyNames) { PHP_V8_TRY_CATCH(isolate); PHP_V8_INIT_ISOLATE_LIMITS_ON_OBJECT_VALUE(php_v8_value); - v8::MaybeLocal maybe_local_array = local_object->GetOwnPropertyNames(context, static_cast(filter)); + v8::MaybeLocal maybe_local_array = local_object->GetOwnPropertyNames(context, static_cast(filter), key_conversion); PHP_V8_MAYBE_CATCH(php_v8_context, try_catch); PHP_V8_THROW_EXCEPTION_WHEN_EMPTY(maybe_local_array, "Failed to get own property names") @@ -1372,11 +1378,13 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getPropertyNames, ZEND_RET ZEND_ARG_TYPE_INFO(0, mode, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, property_filter, IS_LONG, 0) ZEND_ARG_TYPE_INFO(0, index_filter, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, convert_to_strings, _IS_BOOL, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getOwnPropertyNames, ZEND_RETURN_VALUE, 1, V8\\ArrayObject, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_TYPE_INFO(0, filter, IS_LONG, 0) + ZEND_ARG_TYPE_INFO(0, convert_to_strings, _IS_BOOL, 0) ZEND_END_ARG_INFO() PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getPrototype, ZEND_RETURN_VALUE, 0, V8\\Value, 0) diff --git a/stubs/src/ObjectValue.php b/stubs/src/ObjectValue.php index 95bdd2b..6c9a3a3 100644 --- a/stubs/src/ObjectValue.php +++ b/stubs/src/ObjectValue.php @@ -202,9 +202,10 @@ public function setNativeDataProperty( * be enumerated by a for-in statement over this object. * * @param Context $context - * @param int $mode One of KeyCollectionMode options + * @param int $mode One of KeyCollectionMode options * @param int $property_filter One or multiple PropertyFilter options - * @param int $index_filter One or multiple IndexFilter options + * @param int $index_filter One or multiple IndexFilter options + * @param bool $convert_to_strings Convert integer indices to strings * * @return ArrayObject */ @@ -212,7 +213,8 @@ public function getPropertyNames( Context $context, int $mode = KeyCollectionMode::kOwnOnly, int $property_filter = PropertyFilter::ALL_PROPERTIES, - int $index_filter = IndexFilter::kIncludeIndices + int $index_filter = IndexFilter::kIncludeIndices, + bool $convert_to_strings = false ): ArrayObject { } @@ -223,11 +225,15 @@ public function getPropertyNames( * * @param Context $context * @param int $filter One or multiple PropertyFilter options + * @param bool $convert_to_strings Will convert integer indices to strings * * @return ArrayObject */ - public function getOwnPropertyNames(Context $context, int $filter = PropertyFilter::ALL_PROPERTIES): ArrayObject - { + public function getOwnPropertyNames( + Context $context, + int $filter = PropertyFilter::ALL_PROPERTIES, + bool $convert_to_strings = false + ): ArrayObject { } /** diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt index 4160347..0de4d4d 100644 --- a/tests/001-verify_extension_entities.phpt +++ b/tests/001-verify_extension_entities.phpt @@ -698,8 +698,8 @@ class V8\ObjectValue public function setAccessor(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $settings, int $attributes): bool public function setAccessorProperty(V8\NameValue $name, V8\FunctionObject $getter, V8\FunctionObject $setter, int $attributes, int $settings) public function setNativeDataProperty(V8\Context $context, V8\NameValue $name, callable $getter, ?callable $setter, int $attributes): bool - public function getPropertyNames(V8\Context $context, int $mode, int $property_filter, int $index_filter): V8\ArrayObject - public function getOwnPropertyNames(V8\Context $context, int $filter): V8\ArrayObject + public function getPropertyNames(V8\Context $context, int $mode, int $property_filter, int $index_filter, bool $convert_to_strings): V8\ArrayObject + public function getOwnPropertyNames(V8\Context $context, int $filter, bool $convert_to_strings): V8\ArrayObject public function getPrototype(): V8\Value public function setPrototype(V8\Context $context, V8\Value $prototype): bool public function findInstanceInPrototypeChain(V8\FunctionTemplate $tmpl): V8\ObjectValue From bbeb82e3db3e41c1ae56ef8e6bcb421dbd0bccf1 Mon Sep 17 00:00:00 2001 From: Bogdan Padalko Date: Sun, 25 Feb 2018 00:04:43 +0200 Subject: [PATCH 3/5] Add isBigInt64Array and isBigUint64Array methods, closes #98 --- src/php_v8_value.cc | 6 ++++++ tests/001-verify_extension_entities.phpt | 2 ++ tests/ArrayObject.phpt | 16 +++++++++------- tests/Boolean.phpt | 2 ++ tests/BooleanObject.phpt | 4 ++++ tests/DateObject.phpt | 5 ++++- tests/ExceptionManager_createCreateMessage.phpt | 2 ++ tests/ExceptionManager_createError.phpt | 2 ++ tests/ExceptionManager_createRangeError.phpt | 2 ++ tests/ExceptionManager_createReferenceError.phpt | 2 ++ tests/ExceptionManager_createSyntaxError.phpt | 2 ++ tests/ExceptionManager_createTypeError.phpt | 2 ++ tests/FunctionObject.phpt | 6 ++++-- tests/Int32Value.phpt | 6 +++++- tests/IntegerValue.phpt | 6 +++++- tests/Isolate_throwException.phpt | 6 ++++++ tests/MapObject.phpt | 16 +++++++++------- tests/NullValue.phpt | 4 +++- tests/NumberObject.phpt | 4 ++++ tests/NumberValue.phpt | 4 +++- tests/ObjectValue.phpt | 16 +++++++++------- tests/PromiseObject.phpt | 4 ++++ tests/ProxyObject.phpt | 4 ++++ tests/RegExpObject.phpt | 2 ++ tests/Script.phpt | 2 ++ tests/Script_run.phpt | 2 ++ tests/SetObject.phpt | 16 +++++++++------- tests/StringObject.phpt | 6 +++++- tests/StringValue.phpt | 2 ++ tests/SymbolObject.phpt | 4 +++- tests/SymbolValue.phpt | 14 +++++++++++++- tests/Uint32Value.phpt | 4 +++- tests/Undefined.phpt | 6 +++++- 33 files changed, 141 insertions(+), 40 deletions(-) diff --git a/src/php_v8_value.cc b/src/php_v8_value.cc index 02a39b3..f224da0 100644 --- a/src/php_v8_value.cc +++ b/src/php_v8_value.cc @@ -433,6 +433,8 @@ static PHP_V8_VALUE_IS_METHOD(Value, Uint32Array) static PHP_V8_VALUE_IS_METHOD(Value, Int32Array) static PHP_V8_VALUE_IS_METHOD(Value, Float32Array) static PHP_V8_VALUE_IS_METHOD(Value, Float64Array) +static PHP_V8_VALUE_IS_METHOD(Value, BigInt64Array) +static PHP_V8_VALUE_IS_METHOD(Value, BigUint64Array) static PHP_V8_VALUE_IS_METHOD(Value, DataView) static PHP_V8_VALUE_IS_METHOD(Value, SharedArrayBuffer) static PHP_V8_VALUE_IS_METHOD(Value, Proxy) @@ -987,6 +989,8 @@ PHP_V8_VALUE_IS_METHOD_ARG_INFO(Uint32Array) PHP_V8_VALUE_IS_METHOD_ARG_INFO(Int32Array) PHP_V8_VALUE_IS_METHOD_ARG_INFO(Float32Array) PHP_V8_VALUE_IS_METHOD_ARG_INFO(Float64Array) +PHP_V8_VALUE_IS_METHOD_ARG_INFO(BigInt64Array) +PHP_V8_VALUE_IS_METHOD_ARG_INFO(BigUint64Array) PHP_V8_VALUE_IS_METHOD_ARG_INFO(DataView) PHP_V8_VALUE_IS_METHOD_ARG_INFO(SharedArrayBuffer) PHP_V8_VALUE_IS_METHOD_ARG_INFO(Proxy) @@ -1119,6 +1123,8 @@ static const zend_function_entry php_v8_value_methods[] = { PHP_V8_ME(Value, isInt32Array, ZEND_ACC_PUBLIC) PHP_V8_ME(Value, isFloat32Array, ZEND_ACC_PUBLIC) PHP_V8_ME(Value, isFloat64Array, ZEND_ACC_PUBLIC) + PHP_V8_ME(Value, isBigInt64Array, ZEND_ACC_PUBLIC) + PHP_V8_ME(Value, isBigUint64Array, ZEND_ACC_PUBLIC) PHP_V8_ME(Value, isDataView, ZEND_ACC_PUBLIC) PHP_V8_ME(Value, isSharedArrayBuffer, ZEND_ACC_PUBLIC) PHP_V8_ME(Value, isProxy, ZEND_ACC_PUBLIC) diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt index 0de4d4d..fa15517 100644 --- a/tests/001-verify_extension_entities.phpt +++ b/tests/001-verify_extension_entities.phpt @@ -587,6 +587,8 @@ abstract class V8\Value public function isInt32Array(): bool public function isFloat32Array(): bool public function isFloat64Array(): bool + public function isBigInt64Array(): bool + public function isBigUint64Array(): bool public function isDataView(): bool public function isSharedArrayBuffer(): bool public function isProxy(): bool diff --git a/tests/ArrayObject.phpt b/tests/ArrayObject.phpt index 73ed9a9..35bc2b4 100644 --- a/tests/ArrayObject.phpt +++ b/tests/ArrayObject.phpt @@ -134,6 +134,8 @@ V8\ArrayObject(V8\Value)->isUint32Array(): bool(false) V8\ArrayObject(V8\Value)->isInt32Array(): bool(false) V8\ArrayObject(V8\Value)->isFloat32Array(): bool(false) V8\ArrayObject(V8\Value)->isFloat64Array(): bool(false) +V8\ArrayObject(V8\Value)->isBigInt64Array(): bool(false) +V8\ArrayObject(V8\Value)->isBigUint64Array(): bool(false) V8\ArrayObject(V8\Value)->isDataView(): bool(false) V8\ArrayObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ArrayObject(V8\Value)->isProxy(): bool(false) @@ -142,25 +144,25 @@ V8\ArrayObject(V8\Value)->isProxy(): bool(false) Converters: ----------- V8\ArrayObject(V8\Value)->toBoolean(): - object(V8\BooleanValue)#118 (1) { + object(V8\BooleanValue)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ArrayObject(V8\Value)->toNumber(): - object(V8\Int32Value)#118 (1) { + object(V8\Int32Value)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ArrayObject(V8\Value)->toString(): - object(V8\StringValue)#118 (1) { + object(V8\StringValue)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ArrayObject(V8\Value)->toDetailString(): - object(V8\StringValue)#118 (1) { + object(V8\StringValue)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -178,19 +180,19 @@ V8\ArrayObject(V8\Value)->toObject(): } } V8\ArrayObject(V8\Value)->toInteger(): - object(V8\Int32Value)#118 (1) { + object(V8\Int32Value)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ArrayObject(V8\Value)->toUint32(): - object(V8\Int32Value)#118 (1) { + object(V8\Int32Value)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ArrayObject(V8\Value)->toInt32(): - object(V8\Int32Value)#118 (1) { + object(V8\Int32Value)#120 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/Boolean.phpt b/tests/Boolean.phpt index 6a5e8ff..e1789d7 100644 --- a/tests/Boolean.phpt +++ b/tests/Boolean.phpt @@ -117,6 +117,8 @@ V8\BooleanValue(V8\Value)->isUint32Array(): bool(false) V8\BooleanValue(V8\Value)->isInt32Array(): bool(false) V8\BooleanValue(V8\Value)->isFloat32Array(): bool(false) V8\BooleanValue(V8\Value)->isFloat64Array(): bool(false) +V8\BooleanValue(V8\Value)->isBigInt64Array(): bool(false) +V8\BooleanValue(V8\Value)->isBigUint64Array(): bool(false) V8\BooleanValue(V8\Value)->isDataView(): bool(false) V8\BooleanValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\BooleanValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/BooleanObject.phpt b/tests/BooleanObject.phpt index f29556f..d166cfc 100644 --- a/tests/BooleanObject.phpt +++ b/tests/BooleanObject.phpt @@ -120,6 +120,8 @@ V8\BooleanObject(V8\Value)->isUint32Array(): bool(false) V8\BooleanObject(V8\Value)->isInt32Array(): bool(false) V8\BooleanObject(V8\Value)->isFloat32Array(): bool(false) V8\BooleanObject(V8\Value)->isFloat64Array(): bool(false) +V8\BooleanObject(V8\Value)->isBigInt64Array(): bool(false) +V8\BooleanObject(V8\Value)->isBigUint64Array(): bool(false) V8\BooleanObject(V8\Value)->isDataView(): bool(false) V8\BooleanObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\BooleanObject(V8\Value)->isProxy(): bool(false) @@ -180,6 +182,8 @@ V8\BooleanObject(V8\Value)->isUint32Array(): bool(false) V8\BooleanObject(V8\Value)->isInt32Array(): bool(false) V8\BooleanObject(V8\Value)->isFloat32Array(): bool(false) V8\BooleanObject(V8\Value)->isFloat64Array(): bool(false) +V8\BooleanObject(V8\Value)->isBigInt64Array(): bool(false) +V8\BooleanObject(V8\Value)->isBigUint64Array(): bool(false) V8\BooleanObject(V8\Value)->isDataView(): bool(false) V8\BooleanObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\BooleanObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/DateObject.phpt b/tests/DateObject.phpt index 8a0df90..2a43cc7 100644 --- a/tests/DateObject.phpt +++ b/tests/DateObject.phpt @@ -103,7 +103,8 @@ $helper->space(); putenv("TZ={$old_tz}"); // Go back - +// EXPECTF: ---/^val: Wed Oct 21 2015 .+$/ +// EXPECTF: +++val: Wed Oct 21 2015 %s ?> --EXPECTF-- Object representation: @@ -180,6 +181,8 @@ V8\DateObject(V8\Value)->isUint32Array(): bool(false) V8\DateObject(V8\Value)->isInt32Array(): bool(false) V8\DateObject(V8\Value)->isFloat32Array(): bool(false) V8\DateObject(V8\Value)->isFloat64Array(): bool(false) +V8\DateObject(V8\Value)->isBigInt64Array(): bool(false) +V8\DateObject(V8\Value)->isBigUint64Array(): bool(false) V8\DateObject(V8\Value)->isDataView(): bool(false) V8\DateObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\DateObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createCreateMessage.phpt b/tests/ExceptionManager_createCreateMessage.phpt index 9f27732..563d100 100644 --- a/tests/ExceptionManager_createCreateMessage.phpt +++ b/tests/ExceptionManager_createCreateMessage.phpt @@ -197,6 +197,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createError.phpt b/tests/ExceptionManager_createError.phpt index 9d32bd7..d961aab 100644 --- a/tests/ExceptionManager_createError.phpt +++ b/tests/ExceptionManager_createError.phpt @@ -150,6 +150,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createRangeError.phpt b/tests/ExceptionManager_createRangeError.phpt index cbd66c0..9b44069 100644 --- a/tests/ExceptionManager_createRangeError.phpt +++ b/tests/ExceptionManager_createRangeError.phpt @@ -150,6 +150,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createReferenceError.phpt b/tests/ExceptionManager_createReferenceError.phpt index 09d87e9..11bfa4d 100644 --- a/tests/ExceptionManager_createReferenceError.phpt +++ b/tests/ExceptionManager_createReferenceError.phpt @@ -150,6 +150,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createSyntaxError.phpt b/tests/ExceptionManager_createSyntaxError.phpt index 041eeff..96b1eb4 100644 --- a/tests/ExceptionManager_createSyntaxError.phpt +++ b/tests/ExceptionManager_createSyntaxError.phpt @@ -150,6 +150,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/ExceptionManager_createTypeError.phpt b/tests/ExceptionManager_createTypeError.phpt index 608deac..5040688 100644 --- a/tests/ExceptionManager_createTypeError.phpt +++ b/tests/ExceptionManager_createTypeError.phpt @@ -150,6 +150,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/FunctionObject.phpt b/tests/FunctionObject.phpt index 8215418..e401e19 100644 --- a/tests/FunctionObject.phpt +++ b/tests/FunctionObject.phpt @@ -132,6 +132,8 @@ v8Tests\TrackingDtors\FunctionObject(V8\Value)->isUint32Array(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isInt32Array(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isFloat32Array(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isFloat64Array(): bool(false) +v8Tests\TrackingDtors\FunctionObject(V8\Value)->isBigInt64Array(): bool(false) +v8Tests\TrackingDtors\FunctionObject(V8\Value)->isBigUint64Array(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isDataView(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isSharedArrayBuffer(): bool(false) v8Tests\TrackingDtors\FunctionObject(V8\Value)->isProxy(): bool(false) @@ -142,7 +144,7 @@ string(11) "Script done" Function created from php still holds no script id after been passed to script: ok v8Tests\TrackingDtors\FunctionObject(V8\FunctionObject)->getScriptOrigin(): - object(V8\ScriptOrigin)#129 (6) { + object(V8\ScriptOrigin)#131 (6) { ["resource_name":"V8\ScriptOrigin":private]=> string(0) "" ["resource_line_offset":"V8\ScriptOrigin":private]=> @@ -154,7 +156,7 @@ v8Tests\TrackingDtors\FunctionObject(V8\FunctionObject)->getScriptOrigin(): ["source_map_url":"V8\ScriptOrigin":private]=> string(0) "" ["options":"V8\ScriptOrigin":private]=> - object(V8\ScriptOriginOptions)#133 (1) { + object(V8\ScriptOriginOptions)#135 (1) { ["flags":"V8\ScriptOriginOptions":private]=> int(0) } diff --git a/tests/Int32Value.phpt b/tests/Int32Value.phpt index e84cc6b..b9f0cf0 100644 --- a/tests/Int32Value.phpt +++ b/tests/Int32Value.phpt @@ -144,6 +144,8 @@ V8\Int32Value(V8\Value)->isUint32Array(): bool(false) V8\Int32Value(V8\Value)->isInt32Array(): bool(false) V8\Int32Value(V8\Value)->isFloat32Array(): bool(false) V8\Int32Value(V8\Value)->isFloat64Array(): bool(false) +V8\Int32Value(V8\Value)->isBigInt64Array(): bool(false) +V8\Int32Value(V8\Value)->isBigUint64Array(): bool(false) V8\Int32Value(V8\Value)->isDataView(): bool(false) V8\Int32Value(V8\Value)->isSharedArrayBuffer(): bool(false) V8\Int32Value(V8\Value)->isProxy(): bool(false) @@ -151,7 +153,7 @@ V8\Int32Value(V8\Value)->isProxy(): bool(false) V8\Int32Value::toString() converting: ------------------------------------- -object(V8\StringValue)#79 (1) { +object(V8\StringValue)#81 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#1 (0) { } @@ -221,6 +223,8 @@ V8\Int32Value(V8\Value)->isUint32Array(): bool(false) V8\Int32Value(V8\Value)->isInt32Array(): bool(false) V8\Int32Value(V8\Value)->isFloat32Array(): bool(false) V8\Int32Value(V8\Value)->isFloat64Array(): bool(false) +V8\Int32Value(V8\Value)->isBigInt64Array(): bool(false) +V8\Int32Value(V8\Value)->isBigUint64Array(): bool(false) V8\Int32Value(V8\Value)->isDataView(): bool(false) V8\Int32Value(V8\Value)->isSharedArrayBuffer(): bool(false) V8\Int32Value(V8\Value)->isProxy(): bool(false) diff --git a/tests/IntegerValue.phpt b/tests/IntegerValue.phpt index 38b9708..f1283a5 100644 --- a/tests/IntegerValue.phpt +++ b/tests/IntegerValue.phpt @@ -144,6 +144,8 @@ V8\IntegerValue(V8\Value)->isUint32Array(): bool(false) V8\IntegerValue(V8\Value)->isInt32Array(): bool(false) V8\IntegerValue(V8\Value)->isFloat32Array(): bool(false) V8\IntegerValue(V8\Value)->isFloat64Array(): bool(false) +V8\IntegerValue(V8\Value)->isBigInt64Array(): bool(false) +V8\IntegerValue(V8\Value)->isBigUint64Array(): bool(false) V8\IntegerValue(V8\Value)->isDataView(): bool(false) V8\IntegerValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\IntegerValue(V8\Value)->isProxy(): bool(false) @@ -151,7 +153,7 @@ V8\IntegerValue(V8\Value)->isProxy(): bool(false) V8\IntegerValue::toString() converting: --------------------------------------- -object(V8\StringValue)#79 (1) { +object(V8\StringValue)#81 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#1 (0) { } @@ -221,6 +223,8 @@ V8\IntegerValue(V8\Value)->isUint32Array(): bool(false) V8\IntegerValue(V8\Value)->isInt32Array(): bool(false) V8\IntegerValue(V8\Value)->isFloat32Array(): bool(false) V8\IntegerValue(V8\Value)->isFloat64Array(): bool(false) +V8\IntegerValue(V8\Value)->isBigInt64Array(): bool(false) +V8\IntegerValue(V8\Value)->isBigUint64Array(): bool(false) V8\IntegerValue(V8\Value)->isDataView(): bool(false) V8\IntegerValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\IntegerValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/Isolate_throwException.phpt b/tests/Isolate_throwException.phpt index a43d862..51b3631 100644 --- a/tests/Isolate_throwException.phpt +++ b/tests/Isolate_throwException.phpt @@ -154,6 +154,8 @@ V8\StringValue(V8\Value)->isUint32Array(): bool(false) V8\StringValue(V8\Value)->isInt32Array(): bool(false) V8\StringValue(V8\Value)->isFloat32Array(): bool(false) V8\StringValue(V8\Value)->isFloat64Array(): bool(false) +V8\StringValue(V8\Value)->isBigInt64Array(): bool(false) +V8\StringValue(V8\Value)->isBigUint64Array(): bool(false) V8\StringValue(V8\Value)->isDataView(): bool(false) V8\StringValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringValue(V8\Value)->isProxy(): bool(false) @@ -213,6 +215,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) @@ -273,6 +277,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/MapObject.phpt b/tests/MapObject.phpt index 799c8b7..19d55bf 100644 --- a/tests/MapObject.phpt +++ b/tests/MapObject.phpt @@ -180,6 +180,8 @@ V8\MapObject(V8\Value)->isUint32Array(): bool(false) V8\MapObject(V8\Value)->isInt32Array(): bool(false) V8\MapObject(V8\Value)->isFloat32Array(): bool(false) V8\MapObject(V8\Value)->isFloat64Array(): bool(false) +V8\MapObject(V8\Value)->isBigInt64Array(): bool(false) +V8\MapObject(V8\Value)->isBigUint64Array(): bool(false) V8\MapObject(V8\Value)->isDataView(): bool(false) V8\MapObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\MapObject(V8\Value)->isProxy(): bool(false) @@ -188,25 +190,25 @@ V8\MapObject(V8\Value)->isProxy(): bool(false) Converters: ----------- V8\MapObject(V8\Value)->toBoolean(): - object(V8\BooleanValue)#120 (1) { + object(V8\BooleanValue)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\MapObject(V8\Value)->toNumber(): - object(V8\NumberValue)#120 (1) { + object(V8\NumberValue)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\MapObject(V8\Value)->toString(): - object(V8\StringValue)#120 (1) { + object(V8\StringValue)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\MapObject(V8\Value)->toDetailString(): - object(V8\StringValue)#120 (1) { + object(V8\StringValue)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -224,19 +226,19 @@ V8\MapObject(V8\Value)->toObject(): } } V8\MapObject(V8\Value)->toInteger(): - object(V8\Int32Value)#120 (1) { + object(V8\Int32Value)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\MapObject(V8\Value)->toUint32(): - object(V8\Int32Value)#120 (1) { + object(V8\Int32Value)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\MapObject(V8\Value)->toInt32(): - object(V8\Int32Value)#120 (1) { + object(V8\Int32Value)#122 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/NullValue.phpt b/tests/NullValue.phpt index 6782977..c956d31 100644 --- a/tests/NullValue.phpt +++ b/tests/NullValue.phpt @@ -116,6 +116,8 @@ V8\NullValue(V8\Value)->isUint32Array(): bool(false) V8\NullValue(V8\Value)->isInt32Array(): bool(false) V8\NullValue(V8\Value)->isFloat32Array(): bool(false) V8\NullValue(V8\Value)->isFloat64Array(): bool(false) +V8\NullValue(V8\Value)->isBigInt64Array(): bool(false) +V8\NullValue(V8\Value)->isBigUint64Array(): bool(false) V8\NullValue(V8\Value)->isDataView(): bool(false) V8\NullValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\NullValue(V8\Value)->isProxy(): bool(false) @@ -129,7 +131,7 @@ V8\NullValue(V8\Value)->numberValue(): float(0) V8\NullValue::toString() converting: ------------------------------------ -object(V8\StringValue)#79 (1) { +object(V8\StringValue)#81 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#1 (0) { } diff --git a/tests/NumberObject.phpt b/tests/NumberObject.phpt index c89b243..65531fb 100644 --- a/tests/NumberObject.phpt +++ b/tests/NumberObject.phpt @@ -135,6 +135,8 @@ V8\NumberObject(V8\Value)->isUint32Array(): bool(false) V8\NumberObject(V8\Value)->isInt32Array(): bool(false) V8\NumberObject(V8\Value)->isFloat32Array(): bool(false) V8\NumberObject(V8\Value)->isFloat64Array(): bool(false) +V8\NumberObject(V8\Value)->isBigInt64Array(): bool(false) +V8\NumberObject(V8\Value)->isBigUint64Array(): bool(false) V8\NumberObject(V8\Value)->isDataView(): bool(false) V8\NumberObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\NumberObject(V8\Value)->isProxy(): bool(false) @@ -200,6 +202,8 @@ V8\NumberObject(V8\Value)->isUint32Array(): bool(false) V8\NumberObject(V8\Value)->isInt32Array(): bool(false) V8\NumberObject(V8\Value)->isFloat32Array(): bool(false) V8\NumberObject(V8\Value)->isFloat64Array(): bool(false) +V8\NumberObject(V8\Value)->isBigInt64Array(): bool(false) +V8\NumberObject(V8\Value)->isBigUint64Array(): bool(false) V8\NumberObject(V8\Value)->isDataView(): bool(false) V8\NumberObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\NumberObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/NumberValue.phpt b/tests/NumberValue.phpt index aea307b..c8410f5 100644 --- a/tests/NumberValue.phpt +++ b/tests/NumberValue.phpt @@ -141,6 +141,8 @@ V8\NumberValue(V8\Value)->isUint32Array(): bool(false) V8\NumberValue(V8\Value)->isInt32Array(): bool(false) V8\NumberValue(V8\Value)->isFloat32Array(): bool(false) V8\NumberValue(V8\Value)->isFloat64Array(): bool(false) +V8\NumberValue(V8\Value)->isBigInt64Array(): bool(false) +V8\NumberValue(V8\Value)->isBigUint64Array(): bool(false) V8\NumberValue(V8\Value)->isDataView(): bool(false) V8\NumberValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\NumberValue(V8\Value)->isProxy(): bool(false) @@ -148,7 +150,7 @@ V8\NumberValue(V8\Value)->isProxy(): bool(false) V8\NumberValue::toString() converting: -------------------------------------- -object(V8\StringValue)#79 (1) { +object(V8\StringValue)#81 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/ObjectValue.phpt b/tests/ObjectValue.phpt index ba6bb92..2ba0661 100644 --- a/tests/ObjectValue.phpt +++ b/tests/ObjectValue.phpt @@ -127,6 +127,8 @@ V8\ObjectValue(V8\Value)->isUint32Array(): bool(false) V8\ObjectValue(V8\Value)->isInt32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat32Array(): bool(false) V8\ObjectValue(V8\Value)->isFloat64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigInt64Array(): bool(false) +V8\ObjectValue(V8\Value)->isBigUint64Array(): bool(false) V8\ObjectValue(V8\Value)->isDataView(): bool(false) V8\ObjectValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ObjectValue(V8\Value)->isProxy(): bool(false) @@ -135,25 +137,25 @@ V8\ObjectValue(V8\Value)->isProxy(): bool(false) Converters: ----------- V8\ObjectValue(V8\Value)->toBoolean(): - object(V8\BooleanValue)#117 (1) { + object(V8\BooleanValue)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ObjectValue(V8\Value)->toNumber(): - object(V8\NumberValue)#117 (1) { + object(V8\NumberValue)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ObjectValue(V8\Value)->toString(): - object(V8\StringValue)#117 (1) { + object(V8\StringValue)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ObjectValue(V8\Value)->toDetailString(): - object(V8\StringValue)#117 (1) { + object(V8\StringValue)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -171,19 +173,19 @@ V8\ObjectValue(V8\Value)->toObject(): } } V8\ObjectValue(V8\Value)->toInteger(): - object(V8\Int32Value)#117 (1) { + object(V8\Int32Value)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ObjectValue(V8\Value)->toUint32(): - object(V8\Int32Value)#117 (1) { + object(V8\Int32Value)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\ObjectValue(V8\Value)->toInt32(): - object(V8\Int32Value)#117 (1) { + object(V8\Int32Value)#119 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/PromiseObject.phpt b/tests/PromiseObject.phpt index 7cd8640..db66cef 100644 --- a/tests/PromiseObject.phpt +++ b/tests/PromiseObject.phpt @@ -134,6 +134,8 @@ V8\PromiseObject(V8\Value)->isUint32Array(): bool(false) V8\PromiseObject(V8\Value)->isInt32Array(): bool(false) V8\PromiseObject(V8\Value)->isFloat32Array(): bool(false) V8\PromiseObject(V8\Value)->isFloat64Array(): bool(false) +V8\PromiseObject(V8\Value)->isBigInt64Array(): bool(false) +V8\PromiseObject(V8\Value)->isBigUint64Array(): bool(false) V8\PromiseObject(V8\Value)->isDataView(): bool(false) V8\PromiseObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\PromiseObject(V8\Value)->isProxy(): bool(false) @@ -210,6 +212,8 @@ V8\PromiseObject(V8\Value)->isUint32Array(): bool(false) V8\PromiseObject(V8\Value)->isInt32Array(): bool(false) V8\PromiseObject(V8\Value)->isFloat32Array(): bool(false) V8\PromiseObject(V8\Value)->isFloat64Array(): bool(false) +V8\PromiseObject(V8\Value)->isBigInt64Array(): bool(false) +V8\PromiseObject(V8\Value)->isBigUint64Array(): bool(false) V8\PromiseObject(V8\Value)->isDataView(): bool(false) V8\PromiseObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\PromiseObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/ProxyObject.phpt b/tests/ProxyObject.phpt index d335ff2..3bcc8e1 100644 --- a/tests/ProxyObject.phpt +++ b/tests/ProxyObject.phpt @@ -136,6 +136,8 @@ V8\ProxyObject(V8\Value)->isUint32Array(): bool(false) V8\ProxyObject(V8\Value)->isInt32Array(): bool(false) V8\ProxyObject(V8\Value)->isFloat32Array(): bool(false) V8\ProxyObject(V8\Value)->isFloat64Array(): bool(false) +V8\ProxyObject(V8\Value)->isBigInt64Array(): bool(false) +V8\ProxyObject(V8\Value)->isBigUint64Array(): bool(false) V8\ProxyObject(V8\Value)->isDataView(): bool(false) V8\ProxyObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ProxyObject(V8\Value)->isProxy(): bool(true) @@ -213,6 +215,8 @@ V8\ProxyObject(V8\Value)->isUint32Array(): bool(false) V8\ProxyObject(V8\Value)->isInt32Array(): bool(false) V8\ProxyObject(V8\Value)->isFloat32Array(): bool(false) V8\ProxyObject(V8\Value)->isFloat64Array(): bool(false) +V8\ProxyObject(V8\Value)->isBigInt64Array(): bool(false) +V8\ProxyObject(V8\Value)->isBigUint64Array(): bool(false) V8\ProxyObject(V8\Value)->isDataView(): bool(false) V8\ProxyObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\ProxyObject(V8\Value)->isProxy(): bool(true) diff --git a/tests/RegExpObject.phpt b/tests/RegExpObject.phpt index 70b5e83..645a48e 100644 --- a/tests/RegExpObject.phpt +++ b/tests/RegExpObject.phpt @@ -145,6 +145,8 @@ V8\RegExpObject(V8\Value)->isUint32Array(): bool(false) V8\RegExpObject(V8\Value)->isInt32Array(): bool(false) V8\RegExpObject(V8\Value)->isFloat32Array(): bool(false) V8\RegExpObject(V8\Value)->isFloat64Array(): bool(false) +V8\RegExpObject(V8\Value)->isBigInt64Array(): bool(false) +V8\RegExpObject(V8\Value)->isBigUint64Array(): bool(false) V8\RegExpObject(V8\Value)->isDataView(): bool(false) V8\RegExpObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\RegExpObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/Script.phpt b/tests/Script.phpt index a7ed113..2745e52 100644 --- a/tests/Script.phpt +++ b/tests/Script.phpt @@ -132,6 +132,8 @@ V8\StringValue(V8\Value)->isUint32Array(): bool(false) V8\StringValue(V8\Value)->isInt32Array(): bool(false) V8\StringValue(V8\Value)->isFloat32Array(): bool(false) V8\StringValue(V8\Value)->isFloat64Array(): bool(false) +V8\StringValue(V8\Value)->isBigInt64Array(): bool(false) +V8\StringValue(V8\Value)->isBigUint64Array(): bool(false) V8\StringValue(V8\Value)->isDataView(): bool(false) V8\StringValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/Script_run.phpt b/tests/Script_run.phpt index 181c102..b32c8fe 100644 --- a/tests/Script_run.phpt +++ b/tests/Script_run.phpt @@ -103,6 +103,8 @@ V8\StringValue(V8\Value)->isUint32Array(): bool(false) V8\StringValue(V8\Value)->isInt32Array(): bool(false) V8\StringValue(V8\Value)->isFloat32Array(): bool(false) V8\StringValue(V8\Value)->isFloat64Array(): bool(false) +V8\StringValue(V8\Value)->isBigInt64Array(): bool(false) +V8\StringValue(V8\Value)->isBigUint64Array(): bool(false) V8\StringValue(V8\Value)->isDataView(): bool(false) V8\StringValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/SetObject.phpt b/tests/SetObject.phpt index e41ea05..b6b6a1c 100644 --- a/tests/SetObject.phpt +++ b/tests/SetObject.phpt @@ -187,6 +187,8 @@ V8\SetObject(V8\Value)->isUint32Array(): bool(false) V8\SetObject(V8\Value)->isInt32Array(): bool(false) V8\SetObject(V8\Value)->isFloat32Array(): bool(false) V8\SetObject(V8\Value)->isFloat64Array(): bool(false) +V8\SetObject(V8\Value)->isBigInt64Array(): bool(false) +V8\SetObject(V8\Value)->isBigUint64Array(): bool(false) V8\SetObject(V8\Value)->isDataView(): bool(false) V8\SetObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SetObject(V8\Value)->isProxy(): bool(false) @@ -195,25 +197,25 @@ V8\SetObject(V8\Value)->isProxy(): bool(false) Converters: ----------- V8\SetObject(V8\Value)->toBoolean(): - object(V8\BooleanValue)#121 (1) { + object(V8\BooleanValue)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\SetObject(V8\Value)->toNumber(): - object(V8\NumberValue)#121 (1) { + object(V8\NumberValue)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\SetObject(V8\Value)->toString(): - object(V8\StringValue)#121 (1) { + object(V8\StringValue)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\SetObject(V8\Value)->toDetailString(): - object(V8\StringValue)#121 (1) { + object(V8\StringValue)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -231,19 +233,19 @@ V8\SetObject(V8\Value)->toObject(): } } V8\SetObject(V8\Value)->toInteger(): - object(V8\Int32Value)#121 (1) { + object(V8\Int32Value)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\SetObject(V8\Value)->toUint32(): - object(V8\Int32Value)#121 (1) { + object(V8\Int32Value)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } } V8\SetObject(V8\Value)->toInt32(): - object(V8\Int32Value)#121 (1) { + object(V8\Int32Value)#123 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/StringObject.phpt b/tests/StringObject.phpt index cf1f749..9c122af 100644 --- a/tests/StringObject.phpt +++ b/tests/StringObject.phpt @@ -78,7 +78,7 @@ StringObject is instanceof String: ok Getters: -------- V8\StringObject->valueOf(): - object(V8\StringValue)#119 (1) { + object(V8\StringValue)#121 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -137,6 +137,8 @@ V8\StringObject(V8\Value)->isUint32Array(): bool(false) V8\StringObject(V8\Value)->isInt32Array(): bool(false) V8\StringObject(V8\Value)->isFloat32Array(): bool(false) V8\StringObject(V8\Value)->isFloat64Array(): bool(false) +V8\StringObject(V8\Value)->isBigInt64Array(): bool(false) +V8\StringObject(V8\Value)->isBigUint64Array(): bool(false) V8\StringObject(V8\Value)->isDataView(): bool(false) V8\StringObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringObject(V8\Value)->isProxy(): bool(false) @@ -202,6 +204,8 @@ V8\StringObject(V8\Value)->isUint32Array(): bool(false) V8\StringObject(V8\Value)->isInt32Array(): bool(false) V8\StringObject(V8\Value)->isFloat32Array(): bool(false) V8\StringObject(V8\Value)->isFloat64Array(): bool(false) +V8\StringObject(V8\Value)->isBigInt64Array(): bool(false) +V8\StringObject(V8\Value)->isBigUint64Array(): bool(false) V8\StringObject(V8\Value)->isDataView(): bool(false) V8\StringObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/StringValue.phpt b/tests/StringValue.phpt index b5579a5..c441b66 100644 --- a/tests/StringValue.phpt +++ b/tests/StringValue.phpt @@ -179,6 +179,8 @@ V8\StringValue(V8\Value)->isUint32Array(): bool(false) V8\StringValue(V8\Value)->isInt32Array(): bool(false) V8\StringValue(V8\Value)->isFloat32Array(): bool(false) V8\StringValue(V8\Value)->isFloat64Array(): bool(false) +V8\StringValue(V8\Value)->isBigInt64Array(): bool(false) +V8\StringValue(V8\Value)->isBigUint64Array(): bool(false) V8\StringValue(V8\Value)->isDataView(): bool(false) V8\StringValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/SymbolObject.phpt b/tests/SymbolObject.phpt index 44c9376..8e819d5 100644 --- a/tests/SymbolObject.phpt +++ b/tests/SymbolObject.phpt @@ -83,7 +83,7 @@ SymbolObject is instanceof Symbol: ok Getters: -------- V8\SymbolObject->valueOf(): - object(V8\SymbolValue)#119 (1) { + object(V8\SymbolValue)#121 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -142,6 +142,8 @@ V8\SymbolObject(V8\Value)->isUint32Array(): bool(false) V8\SymbolObject(V8\Value)->isInt32Array(): bool(false) V8\SymbolObject(V8\Value)->isFloat32Array(): bool(false) V8\SymbolObject(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolObject(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolObject(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolObject(V8\Value)->isDataView(): bool(false) V8\SymbolObject(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolObject(V8\Value)->isProxy(): bool(false) diff --git a/tests/SymbolValue.phpt b/tests/SymbolValue.phpt index 1d59c7c..7592efe 100644 --- a/tests/SymbolValue.phpt +++ b/tests/SymbolValue.phpt @@ -244,6 +244,8 @@ V8\SymbolValue(V8\Value)->isUint32Array(): bool(false) V8\SymbolValue(V8\Value)->isInt32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolValue(V8\Value)->isDataView(): bool(false) V8\SymbolValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolValue(V8\Value)->isProxy(): bool(false) @@ -254,7 +256,7 @@ Null constructor: Object representation: ---------------------- -object(V8\SymbolValue)#92 (1) { +object(V8\SymbolValue)#94 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -320,6 +322,8 @@ V8\SymbolValue(V8\Value)->isUint32Array(): bool(false) V8\SymbolValue(V8\Value)->isInt32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolValue(V8\Value)->isDataView(): bool(false) V8\SymbolValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolValue(V8\Value)->isProxy(): bool(false) @@ -396,6 +400,8 @@ V8\SymbolValue(V8\Value)->isUint32Array(): bool(false) V8\SymbolValue(V8\Value)->isInt32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolValue(V8\Value)->isDataView(): bool(false) V8\SymbolValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolValue(V8\Value)->isProxy(): bool(false) @@ -476,6 +482,8 @@ V8\SymbolValue(V8\Value)->isUint32Array(): bool(false) V8\SymbolValue(V8\Value)->isInt32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolValue(V8\Value)->isDataView(): bool(false) V8\SymbolValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolValue(V8\Value)->isProxy(): bool(false) @@ -535,6 +543,8 @@ V8\StringValue(V8\Value)->isUint32Array(): bool(false) V8\StringValue(V8\Value)->isInt32Array(): bool(false) V8\StringValue(V8\Value)->isFloat32Array(): bool(false) V8\StringValue(V8\Value)->isFloat64Array(): bool(false) +V8\StringValue(V8\Value)->isBigInt64Array(): bool(false) +V8\StringValue(V8\Value)->isBigUint64Array(): bool(false) V8\StringValue(V8\Value)->isDataView(): bool(false) V8\StringValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\StringValue(V8\Value)->isProxy(): bool(false) @@ -589,6 +599,8 @@ V8\SymbolValue(V8\Value)->isUint32Array(): bool(false) V8\SymbolValue(V8\Value)->isInt32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat32Array(): bool(false) V8\SymbolValue(V8\Value)->isFloat64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigInt64Array(): bool(false) +V8\SymbolValue(V8\Value)->isBigUint64Array(): bool(false) V8\SymbolValue(V8\Value)->isDataView(): bool(false) V8\SymbolValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\SymbolValue(V8\Value)->isProxy(): bool(false) diff --git a/tests/Uint32Value.phpt b/tests/Uint32Value.phpt index de2482b..c467f5d 100644 --- a/tests/Uint32Value.phpt +++ b/tests/Uint32Value.phpt @@ -134,6 +134,8 @@ V8\Uint32Value(V8\Value)->isUint32Array(): bool(false) V8\Uint32Value(V8\Value)->isInt32Array(): bool(false) V8\Uint32Value(V8\Value)->isFloat32Array(): bool(false) V8\Uint32Value(V8\Value)->isFloat64Array(): bool(false) +V8\Uint32Value(V8\Value)->isBigInt64Array(): bool(false) +V8\Uint32Value(V8\Value)->isBigUint64Array(): bool(false) V8\Uint32Value(V8\Value)->isDataView(): bool(false) V8\Uint32Value(V8\Value)->isSharedArrayBuffer(): bool(false) V8\Uint32Value(V8\Value)->isProxy(): bool(false) @@ -141,7 +143,7 @@ V8\Uint32Value(V8\Value)->isProxy(): bool(false) V8\Uint32Value::toString() converting: -------------------------------------- -object(V8\StringValue)#79 (1) { +object(V8\StringValue)#81 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } diff --git a/tests/Undefined.phpt b/tests/Undefined.phpt index 38959e5..9d09057 100644 --- a/tests/Undefined.phpt +++ b/tests/Undefined.phpt @@ -147,6 +147,8 @@ V8\UndefinedValue(V8\Value)->isUint32Array(): bool(false) V8\UndefinedValue(V8\Value)->isInt32Array(): bool(false) V8\UndefinedValue(V8\Value)->isFloat32Array(): bool(false) V8\UndefinedValue(V8\Value)->isFloat64Array(): bool(false) +V8\UndefinedValue(V8\Value)->isBigInt64Array(): bool(false) +V8\UndefinedValue(V8\Value)->isBigUint64Array(): bool(false) V8\UndefinedValue(V8\Value)->isDataView(): bool(false) V8\UndefinedValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\UndefinedValue(V8\Value)->isProxy(): bool(false) @@ -160,7 +162,7 @@ V8\UndefinedValue(V8\Value)->numberValue(): float(NAN) V8\UndefinedValue::toString() converting: ----------------------------------------- -object(V8\StringValue)#89 (1) { +object(V8\StringValue)#91 (1) { ["isolate":"V8\Value":private]=> object(V8\Isolate)#3 (0) { } @@ -217,6 +219,8 @@ V8\UndefinedValue(V8\Value)->isUint32Array(): bool(false) V8\UndefinedValue(V8\Value)->isInt32Array(): bool(false) V8\UndefinedValue(V8\Value)->isFloat32Array(): bool(false) V8\UndefinedValue(V8\Value)->isFloat64Array(): bool(false) +V8\UndefinedValue(V8\Value)->isBigInt64Array(): bool(false) +V8\UndefinedValue(V8\Value)->isBigUint64Array(): bool(false) V8\UndefinedValue(V8\Value)->isDataView(): bool(false) V8\UndefinedValue(V8\Value)->isSharedArrayBuffer(): bool(false) V8\UndefinedValue(V8\Value)->isProxy(): bool(false) From 17bbe95faa370e54c7a41f04521731aba927e319 Mon Sep 17 00:00:00 2001 From: Bogdan Padalko Date: Sun, 25 Feb 2018 02:11:15 +0200 Subject: [PATCH 4/5] Rework PromiseObject, closes #95 --- README.md | 2 +- config.m4 | 3 +- scripts/test_v8/hello_world.cpp | 6 + src/php_v8_promise.cc | 64 ------ src/php_v8_promise.h | 1 - src/php_v8_promise_resolver.cc | 137 +++++++++++ src/php_v8_promise_resolver.h | 32 +++ stubs/src/PromiseObject.php | 20 -- stubs/src/PromiseObject/ResolverObject.php | 51 +++++ tests/001-verify_extension_entities.phpt | 12 +- ...miseObject.phpt => 006-PromiseObject.phpt} | 1 - tests/006-PromiseObject_methods.phpt | 151 +++++++++++++ tests/006-ResolverObject.phpt | 142 ++++++++++++ tests/PromiseObject_methods.phpt | 212 ------------------ v8.cc | 2 + 15 files changed, 534 insertions(+), 302 deletions(-) create mode 100644 src/php_v8_promise_resolver.cc create mode 100644 src/php_v8_promise_resolver.h create mode 100644 stubs/src/PromiseObject/ResolverObject.php rename tests/{PromiseObject.phpt => 006-PromiseObject.phpt} (99%) create mode 100644 tests/006-PromiseObject_methods.phpt create mode 100644 tests/006-ResolverObject.phpt delete mode 100644 tests/PromiseObject_methods.phpt diff --git a/README.md b/README.md index 100ee8f..697bb46 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ on top of php-v8 extension and makes embedding JavaScript in PHP easier. ### Requirements #### V8 -You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.6.275 required. +You will need a recent v8 Google JavaScript engine version installed. At this time v8 >= 6.6.313 required. #### PHP This extension is PHP7-only. It works and tested with both PHP 7.0 and PHP 7.1. diff --git a/config.m4 b/config.m4 index 8b0cecc..0117c88 100644 --- a/config.m4 +++ b/config.m4 @@ -19,7 +19,7 @@ if test "$PHP_V8" != "no"; then SEARCH_PATH="/usr/local /usr" SEARCH_FOR="include/v8.h" - V8_MIN_API_VERSION_STR=6.6.275 + V8_MIN_API_VERSION_STR=6.6.313 DESIRED_V8_VERSION=`echo "${V8_MIN_API_VERSION_STR}" | $AWK 'BEGIN { FS = "."; } { printf "%s.%s", [$]1, [$]2;}'` @@ -204,6 +204,7 @@ if test "$PHP_V8" != "no"; then src/php_v8_date.cc \ src/php_v8_regexp.cc \ src/php_v8_promise.cc \ + src/php_v8_promise_resolver.cc \ src/php_v8_proxy.cc \ src/php_v8_number_object.cc \ src/php_v8_boolean_object.cc \ diff --git a/scripts/test_v8/hello_world.cpp b/scripts/test_v8/hello_world.cpp index 4adb4be..8abf4fb 100644 --- a/scripts/test_v8/hello_world.cpp +++ b/scripts/test_v8/hello_world.cpp @@ -6,6 +6,12 @@ using namespace v8; +void weak_callback(const v8::WeakCallbackInfo>& data) { + printf("Weak callback called\n"); + data.GetParameter()->Reset(); +// data.GetIsolate()->AdjustAmountOfExternalAllocatedMemory(-(1024*1024*1024)); +} + int main(int argc, char* argv[]) { // Initialize V8. //v8::V8::InitializeICU(); diff --git a/src/php_v8_promise.cc b/src/php_v8_promise.cc index f831747..29c2cf3 100644 --- a/src/php_v8_promise.cc +++ b/src/php_v8_promise.cc @@ -47,58 +47,6 @@ static PHP_METHOD(Promise, __construct) { php_v8_value->persistent->Reset(isolate, local_resolver); } -static PHP_METHOD(Promise, resolve) { - zval *php_v8_context_zv; - zval *php_v8_rvalue_zv; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &php_v8_context_zv, &php_v8_rvalue_zv) == FAILURE) { - return; - } - - PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); - PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context); - PHP_V8_VALUE_FETCH_WITH_CHECK(php_v8_rvalue_zv, php_v8_rvalue); - - PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_context); - PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_rvalue); - - PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); - PHP_V8_ENTER_CONTEXT(php_v8_context); - - v8::Local local_resolver = php_v8_value_get_local_as(php_v8_value); - v8::Local local_rvalue = php_v8_value_get_local_as(php_v8_rvalue); - - v8::Maybe maybe_resolved = local_resolver->Resolve(context, local_rvalue); - - PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(maybe_resolved, "Failed to resolve a promise"); -} - -static PHP_METHOD(Promise, reject) { - zval *php_v8_context_zv; - zval *php_v8_rvalue_zv; - - if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &php_v8_context_zv, &php_v8_rvalue_zv) == FAILURE) { - return; - } - - PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); - PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context); - PHP_V8_VALUE_FETCH_WITH_CHECK(php_v8_rvalue_zv, php_v8_rvalue); - - PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_context); - PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_rvalue); - - PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); - PHP_V8_ENTER_CONTEXT(php_v8_context); - - v8::Local local_resolver = php_v8_value_get_local_as(php_v8_value); - v8::Local local_rvalue = php_v8_value_get_local_as(php_v8_rvalue); - - v8::Maybe maybe_rejected = local_resolver->Reject(context, local_rvalue); - - PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(maybe_rejected, "Failed to reject a promise"); -} - static PHP_METHOD(Promise, catch) { zval *php_v8_context_zv; zval *php_v8_function_zv; @@ -209,16 +157,6 @@ PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_END_ARG_INFO() -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_resolve, 2) - ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) - ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) -ZEND_END_ARG_INFO() - -PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_reject, 2) - ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) - ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) -ZEND_END_ARG_INFO() - PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_catch, ZEND_RETURN_VALUE, 2, V8\\PromiseObject, 0) ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) ZEND_ARG_OBJ_INFO(0, handler, V8\\FunctionObject, 0) @@ -241,8 +179,6 @@ ZEND_END_ARG_INFO() static const zend_function_entry php_v8_promise_methods[] = { PHP_V8_ME(Promise, __construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) - PHP_V8_ME(Promise, resolve, ZEND_ACC_PUBLIC) - PHP_V8_ME(Promise, reject, ZEND_ACC_PUBLIC) PHP_V8_ME(Promise, catch, ZEND_ACC_PUBLIC) PHP_V8_ME(Promise, then, ZEND_ACC_PUBLIC) PHP_V8_ME(Promise, hasHandler, ZEND_ACC_PUBLIC) diff --git a/src/php_v8_promise.h b/src/php_v8_promise.h index 42674c2..2486a11 100644 --- a/src/php_v8_promise.h +++ b/src/php_v8_promise.h @@ -25,7 +25,6 @@ extern "C" { } extern zend_class_entry* php_v8_promise_class_entry; -extern zend_class_entry* php_v8_promise_flags_class_entry; PHP_MINIT_FUNCTION(php_v8_promise); diff --git a/src/php_v8_promise_resolver.cc b/src/php_v8_promise_resolver.cc new file mode 100644 index 0000000..0aba3ef --- /dev/null +++ b/src/php_v8_promise_resolver.cc @@ -0,0 +1,137 @@ +/* + * This file is part of the pinepain/php-v8 PHP extension. + * + * Copyright (c) 2015-2018 Bogdan Padalko + * + * Licensed under the MIT license: http://opensource.org/licenses/MIT + * + * For the full copyright and license information, please view the + * LICENSE file that was distributed with this source or visit + * http://opensource.org/licenses/MIT + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "php_v8_promise_resolver.h" +#include "php_v8_promise.h" +#include "php_v8_object.h" +#include "php_v8_string.h" +#include "php_v8_value.h" +#include "php_v8_context.h" +#include "php_v8.h" + +zend_class_entry *php_v8_promise_resolver_class_entry; + +#define this_ce php_v8_promise_resolver_class_entry + + +static PHP_METHOD(Resolver, __construct) { + zval rv; + zval *php_v8_context_zv; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "o", &php_v8_context_zv) == FAILURE) { + return; + } + + PHP_V8_OBJECT_CONSTRUCT(getThis(), php_v8_context_zv, php_v8_context, php_v8_value); + + v8::MaybeLocal maybe_local_resolver = v8::Promise::Resolver::New(context); + + PHP_V8_THROW_VALUE_EXCEPTION_WHEN_EMPTY(maybe_local_resolver, "Failed to create Resolver object"); + + v8::Local local_resolver = maybe_local_resolver.ToLocalChecked(); + php_v8_object_store_self_ptr(php_v8_value, local_resolver); + + php_v8_value->persistent->Reset(isolate, local_resolver); +} + +static PHP_METHOD(Resolver, resolve) { + zval *php_v8_context_zv; + zval *php_v8_rvalue_zv; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &php_v8_context_zv, &php_v8_rvalue_zv) == FAILURE) { + return; + } + + PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); + PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context); + PHP_V8_VALUE_FETCH_WITH_CHECK(php_v8_rvalue_zv, php_v8_rvalue); + + PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_context); + PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_rvalue); + + PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); + PHP_V8_ENTER_CONTEXT(php_v8_context); + + v8::Local local_resolver = php_v8_value_get_local_as(php_v8_value); + v8::Local local_rvalue = php_v8_value_get_local_as(php_v8_rvalue); + + v8::Maybe maybe_resolved = local_resolver->Resolve(context, local_rvalue); + + PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(maybe_resolved, "Failed to resolve a promise"); +} + +static PHP_METHOD(Resolver, reject) { + zval *php_v8_context_zv; + zval *php_v8_rvalue_zv; + + if (zend_parse_parameters(ZEND_NUM_ARGS(), "oo", &php_v8_context_zv, &php_v8_rvalue_zv) == FAILURE) { + return; + } + + PHP_V8_VALUE_FETCH_WITH_CHECK(getThis(), php_v8_value); + PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context); + PHP_V8_VALUE_FETCH_WITH_CHECK(php_v8_rvalue_zv, php_v8_rvalue); + + PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_context); + PHP_V8_DATA_ISOLATES_CHECK(php_v8_value, php_v8_rvalue); + + PHP_V8_ENTER_STORED_ISOLATE(php_v8_value); + PHP_V8_ENTER_CONTEXT(php_v8_context); + + v8::Local local_resolver = php_v8_value_get_local_as(php_v8_value); + v8::Local local_rvalue = php_v8_value_get_local_as(php_v8_rvalue); + + v8::Maybe maybe_rejected = local_resolver->Reject(context, local_rvalue); + + PHP_V8_THROW_VALUE_EXCEPTION_WHEN_NOTHING(maybe_rejected, "Failed to reject a promise"); +} + + +PHP_V8_ZEND_BEGIN_ARG_WITH_CONSTRUCTOR_INFO_EX(arginfo___construct, 1) + ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) +ZEND_END_ARG_INFO() + +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_resolve, 2) + ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) + ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) +ZEND_END_ARG_INFO() + +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_VOID_INFO_EX(arginfo_reject, 2) + ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) + ZEND_ARG_OBJ_INFO(0, value, V8\\Value, 0) +ZEND_END_ARG_INFO() + +PHP_V8_ZEND_BEGIN_ARG_WITH_RETURN_OBJ_INFO_EX(arginfo_getPromise, ZEND_RETURN_VALUE, 1, V8\\PromiseObject, 0) + ZEND_ARG_OBJ_INFO(0, context, V8\\Context, 0) +ZEND_END_ARG_INFO() + + +static const zend_function_entry php_v8_promise_resolver_methods[] = { + PHP_V8_ME(Resolver, __construct, ZEND_ACC_PUBLIC | ZEND_ACC_CTOR) + PHP_V8_ME(Resolver, resolve, ZEND_ACC_PUBLIC) + PHP_V8_ME(Resolver, reject, ZEND_ACC_PUBLIC) + + PHP_FE_END +}; + + +PHP_MINIT_FUNCTION(php_v8_promise_resolver) { + zend_class_entry ce; + INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS "\\PromiseObject", "ResolverObject", php_v8_promise_resolver_methods); + this_ce = zend_register_internal_class_ex(&ce, php_v8_promise_class_entry); + + return SUCCESS; +} diff --git a/src/php_v8_promise_resolver.h b/src/php_v8_promise_resolver.h new file mode 100644 index 0000000..a1ce5d5 --- /dev/null +++ b/src/php_v8_promise_resolver.h @@ -0,0 +1,32 @@ +/* + * This file is part of the pinepain/php-v8 PHP extension. + * + * Copyright (c) 2015-2018 Bogdan Padalko + * + * Licensed under the MIT license: http://opensource.org/licenses/MIT + * + * For the full copyright and license information, please view the + * LICENSE file that was distributed with this source or visit + * http://opensource.org/licenses/MIT + */ + +#ifndef PHP_V8_PROMISE_RESOLVER_H +#define PHP_V8_PROMISE_RESOLVER_H + +#include "php_v8_value.h" +#include + +extern "C" { +#include "php.h" + +#ifdef ZTS +#include "TSRM.h" +#endif +} + +extern zend_class_entry* php_v8_promise_resolver_class_entry; + + +PHP_MINIT_FUNCTION(php_v8_promise_resolver); + +#endif //PHP_V8_PROMISE_RESOLVER_H diff --git a/stubs/src/PromiseObject.php b/stubs/src/PromiseObject.php index e5df59a..3dc838e 100644 --- a/stubs/src/PromiseObject.php +++ b/stubs/src/PromiseObject.php @@ -29,26 +29,6 @@ public function __construct(Context $context) { } - /** - * Resolve the promise with a given value. Ignored if the promise is no longer pending. - * - * @param Context $context - * @param Value $value - */ - public function resolve(Context $context, Value $value) - { - } - - /** - * Reject the promise with a given value. Ignored if the promise is no longer pending. - * - * @param Context $context - * @param Value $value - */ - public function reject(Context $context, Value $value) - { - } - /** * Register a resolution/rejection handler with the promise. * diff --git a/stubs/src/PromiseObject/ResolverObject.php b/stubs/src/PromiseObject/ResolverObject.php new file mode 100644 index 0000000..1383d15 --- /dev/null +++ b/stubs/src/PromiseObject/ResolverObject.php @@ -0,0 +1,51 @@ + + * + * Licensed under the MIT license: http://opensource.org/licenses/MIT + * + * For the full copyright and license information, please view the + * LICENSE file that was distributed with this source or visit + * http://opensource.org/licenses/MIT + */ + + +namespace V8\PromiseObject; + +use V8\Context; +use V8\PromiseObject; +use V8\Value; + + +class ResolverObject extends PromiseObject +{ + /** + * @param Context $context + */ + public function __construct(Context $context) + { + } + + /** + * Resolve the promise with a given value. Ignored if the promise is no longer pending. + * + * @param Context $context + * @param Value $value + */ + public function resolve(Context $context, Value $value) + { + } + + /** + * Reject the promise with a given value. Ignored if the promise is no longer pending. + * + * @param Context $context + * @param Value $value + */ + public function reject(Context $context, Value $value) + { + } +} diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt index fa15517..4c883cb 100644 --- a/tests/001-verify_extension_entities.phpt +++ b/tests/001-verify_extension_entities.phpt @@ -800,14 +800,22 @@ class V8\PromiseObject const STATE_FULFILLED = 1 const STATE_REJECTED = 2 public function __construct(V8\Context $context) - public function resolve(V8\Context $context, V8\Value $value) - public function reject(V8\Context $context, V8\Value $value) public function catch(V8\Context $context, V8\FunctionObject $handler): V8\PromiseObject public function then(V8\Context $context, V8\FunctionObject $handler): V8\PromiseObject public function hasHandler(): bool public function result(): V8\Value public function state(): int +class V8\PromiseObject\ResolverObject + extends V8\PromiseObject + implements V8\AdjustableExternalMemoryInterface + const STATE_PENDING = 0 + const STATE_FULFILLED = 1 + const STATE_REJECTED = 2 + public function __construct(V8\Context $context) + public function resolve(V8\Context $context, V8\Value $value) + public function reject(V8\Context $context, V8\Value $value) + class V8\ProxyObject extends V8\ObjectValue implements V8\AdjustableExternalMemoryInterface diff --git a/tests/PromiseObject.phpt b/tests/006-PromiseObject.phpt similarity index 99% rename from tests/PromiseObject.phpt rename to tests/006-PromiseObject.phpt index db66cef..a87f801 100644 --- a/tests/PromiseObject.phpt +++ b/tests/006-PromiseObject.phpt @@ -16,7 +16,6 @@ $context = new V8\Context($isolate); $value = new V8\PromiseObject($context); - $helper->header('Object representation'); $helper->dump($value); $helper->space(); diff --git a/tests/006-PromiseObject_methods.phpt b/tests/006-PromiseObject_methods.phpt new file mode 100644 index 0000000..caa0d9a --- /dev/null +++ b/tests/006-PromiseObject_methods.phpt @@ -0,0 +1,151 @@ +--TEST-- +V8\PromiseObject - object-specific methods +--SKIPIF-- + +--FILE-- +arguments()[0]->value(), PHP_EOL; + // echo 'Returning: ', $args->arguments()[0]->value() . ' +', PHP_EOL; + // var_dump($args->arguments()); + $args->getReturnValue()->set(new V8\StringValue($args->getIsolate(), $args->arguments()[0]->value() . ' +')); +}); + +$catch = new \V8\FunctionObject($context, function (\V8\FunctionCallbackInfo $args) { + echo 'Caught: ', $args->arguments()[0]->value(), PHP_EOL; + // echo 'Returning: ', $args->arguments()[0]->value() . ' +', PHP_EOL; + // var_dump($args->arguments()); + $args->getIsolate()->throwException($args->getContext(), new V8\StringValue($args->getIsolate(), $args->arguments()[0]->value() . ' +')); +}); + + +$helper->header('Promise::then()'); + +$resolver = new V8\PromiseObject\ResolverObject($context); + +$helper->assert('Promise has no handlers', $resolver->hasHandler(), false); +$res = $resolver->then($context, $then); +$helper->assert('Promise has handlers', $resolver->hasHandler(), true); + +$helper->assert('Result of setting then is promise', $res instanceof \V8\PromiseObject); +$helper->assert('Result of setting then is not the same promise', $res !== $resolver); +$helper->line(); + +$helper->assert('Promise is pending', $resolver->state(), \V8\PromiseObject::STATE_PENDING); +$resolver->resolve($context, new \V8\StringValue($isolate, "resolved 1 ")); +$helper->assert('Promise is fulfilled', $resolver->state(), \V8\PromiseObject::STATE_FULFILLED); +$helper->inline('Promise result:', $resolver->result()->value()); +$res = $resolver->resolve($context, new \V8\StringValue($isolate, "resolved2 ")); +$helper->message('Promise handler should not be invoked on multiple resolve'); +$helper->inline('Promise result:', $resolver->result()->value()); +$res = $resolver->reject($context, new \V8\StringValue($isolate, "rejected")); +$helper->message('Promise handler should not be invoked on reject when resolved'); +$helper->inline('Promise result:', $resolver->result()->value()); +$helper->line(); + +$helper->header('Resolving a chain'); + +$resolver = new V8\PromiseObject\ResolverObject($context); + +$v2 = $resolver->then($context, $then); +$v3 = $v2->then($context, $then); +$v3->then($context, $then); + +$resolver->resolve($context, new \V8\StringValue($isolate, "resolved 1")); + +$helper->line(); + + +$helper->header('Promise::catch()'); + +$resolver = new V8\PromiseObject\ResolverObject($context); + +$helper->assert('Promise has no handlers', $resolver->hasHandler(), false); +$res = $resolver->catch($context, $catch); +$helper->assert('Promise has handlers', $resolver->hasHandler(), true); + +$helper->assert('Result of setting catch is promise', $res instanceof \V8\PromiseObject); +$helper->assert('Result of setting catch is not the same promise', $res !== $resolver); +$helper->line(); + +$helper->assert('Promise is pending', $resolver->state(), \V8\PromiseObject::STATE_PENDING); +$resolver->reject($context, new \V8\StringValue($isolate, "rejected 1")); +$helper->assert('Promise is rejected', $resolver->state(), \V8\PromiseObject::STATE_REJECTED); +$helper->inline('Promise result:', $resolver->result()->value()); +$res = $resolver->resolve($context, new \V8\StringValue($isolate, "rejected 2")); +$helper->message('Promise handler should not be invoked on multiple reject'); +$helper->inline('Promise result:', $resolver->result()->value()); +$res = $resolver->resolve($context, new \V8\StringValue($isolate, "resolved")); +$helper->message('Promise handler should not be invoked on resolve when rejected'); +$helper->inline('Promise result:', $resolver->result()->value()); + +$helper->line(); + +$helper->header('Rejecting a chain'); + +$resolver = new V8\PromiseObject\ResolverObject($context); + +$v2 = $resolver->catch($context, $catch); +$v3 = $v2->catch($context, $catch); +$v3->catch($context, $catch); + +$resolver->reject($context, new \V8\StringValue($isolate, "rejected 1")); + +$helper->line(); + +?> +--EXPECT-- +Promise::then(): +---------------- +Promise has no handlers: ok +Promise has handlers: ok +Result of setting then is promise: ok +Result of setting then is not the same promise: ok + +Promise is pending: ok +Resolved: resolved 1 +Promise is fulfilled: ok +Promise result:: resolved 1 +Promise handler should not be invoked on multiple resolve +Promise result:: resolved 1 +Promise handler should not be invoked on reject when resolved +Promise result:: resolved 1 + +Resolving a chain: +------------------ +Resolved: resolved 1 +Resolved: resolved 1 + +Resolved: resolved 1 + + + +Promise::catch(): +----------------- +Promise has no handlers: ok +Promise has handlers: ok +Result of setting catch is promise: ok +Result of setting catch is not the same promise: ok + +Promise is pending: ok +Caught: rejected 1 +Promise is rejected: ok +Promise result:: rejected 1 +Promise handler should not be invoked on multiple reject +Promise result:: rejected 1 +Promise handler should not be invoked on resolve when rejected +Promise result:: rejected 1 + +Rejecting a chain: +------------------ +Caught: rejected 1 +Caught: rejected 1 + +Caught: rejected 1 + + diff --git a/tests/006-ResolverObject.phpt b/tests/006-ResolverObject.phpt new file mode 100644 index 0000000..5158209 --- /dev/null +++ b/tests/006-ResolverObject.phpt @@ -0,0 +1,142 @@ +--TEST-- +V8\PromiseObject\ResolverObject +--SKIPIF-- + +--FILE-- +header('Object representation'); +$helper->dump($value); +$helper->space(); + +$helper->assert('ResolverObject extends Value', $value instanceof \V8\Value); +$helper->assert('ResolverObject does not extend PrimitiveValue', !($value instanceof \V8\PrimitiveValue)); +$helper->assert('ResolverObject implements AdjustableExternalMemoryInterface', $value instanceof \V8\AdjustableExternalMemoryInterface); +$helper->assert('ResolverObject extends PromiseObject', $value instanceof \V8\PromiseObject); +$helper->assert('ResolverObject is instanceof Promise', $value->instanceOf($context, $context->globalObject()->get($context, new \V8\StringValue($isolate, 'Promise')))); +$helper->line(); + +$helper->header('Accessors'); +$helper->method_matches($value, 'getIsolate', $isolate); +$helper->method_matches($value, 'getContext', $context); +$helper->space(); + +$helper->header('Getters'); +$helper->assert('GetIdentityHash is integer', gettype($value->getIdentityHash()), 'integer'); +$helper->space(); + +$v8_helper->run_checks($value, 'Checkers'); + +$helper->header('Passing resolver and proxy via runtime'); + +$context->globalObject()->set($context, new \V8\StringValue($isolate, 'resolver'), $value); +$new_value = $v8_helper->CompileRun($context, "resolver"); +$helper->assert('Root object is preserved if pass through runtime', $new_value, $value); + +?> +--EXPECT-- +Object representation: +---------------------- +object(V8\PromiseObject\ResolverObject)#5 (2) { + ["isolate":"V8\Value":private]=> + object(V8\Isolate)#3 (0) { + } + ["context":"V8\ObjectValue":private]=> + object(V8\Context)#4 (1) { + ["isolate":"V8\Context":private]=> + object(V8\Isolate)#3 (0) { + } + } +} + + +ResolverObject extends Value: ok +ResolverObject does not extend PrimitiveValue: ok +ResolverObject implements AdjustableExternalMemoryInterface: ok +ResolverObject extends PromiseObject: ok +ResolverObject is instanceof Promise: ok + +Accessors: +---------- +V8\PromiseObject\ResolverObject::getIsolate() matches expected value +V8\PromiseObject\ResolverObject::getContext() matches expected value + + +Getters: +-------- +GetIdentityHash is integer: ok + + +Checkers: +--------- +V8\PromiseObject\ResolverObject(V8\Value)->typeOf(): V8\StringValue->value(): string(6) "object" + +V8\PromiseObject\ResolverObject(V8\ObjectValue)->isCallable(): bool(false) +V8\PromiseObject\ResolverObject(V8\ObjectValue)->isConstructor(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUndefined(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isNull(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isNullOrUndefined(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isTrue(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isFalse(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isName(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isString(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isSymbol(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isFunction(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isArray(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isObject(): bool(true) +V8\PromiseObject\ResolverObject(V8\Value)->isBoolean(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isNumber(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isInt32(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUint32(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isDate(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isArgumentsObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isBooleanObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isNumberObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isStringObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isSymbolObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isNativeError(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isRegExp(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isAsyncFunction(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isGeneratorFunction(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isGeneratorObject(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isPromise(): bool(true) +V8\PromiseObject\ResolverObject(V8\Value)->isMap(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isSet(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isMapIterator(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isSetIterator(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isWeakMap(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isWeakSet(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isArrayBuffer(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isArrayBufferView(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isTypedArray(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUint8Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUint8ClampedArray(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isInt8Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUint16Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isInt16Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isUint32Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isInt32Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isFloat32Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isFloat64Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isBigInt64Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isBigUint64Array(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isDataView(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isSharedArrayBuffer(): bool(false) +V8\PromiseObject\ResolverObject(V8\Value)->isProxy(): bool(false) + + +Passing resolver and proxy via runtime: +--------------------------------------- +Root object is preserved if pass through runtime: ok diff --git a/tests/PromiseObject_methods.phpt b/tests/PromiseObject_methods.phpt deleted file mode 100644 index febcf5b..0000000 --- a/tests/PromiseObject_methods.phpt +++ /dev/null @@ -1,212 +0,0 @@ ---TEST-- -V8\PromiseObject - object-specific methods ---XFAIL-- -Resolving/rejecting Promise in non-pending state leads to segfault - https://github.com/pinepain/php-v8/issues/95 ---SKIPIF-- - ---FILE-- -arguments()[0]->value(), PHP_EOL; - // var_dump($args->arguments()); - $args->getReturnValue()->set(new V8\StringValue($args->getIsolate(), $args->arguments()[0]->value() . ' +')); -}); - -$catch = new \V8\FunctionObject($context, function (\V8\FunctionCallbackInfo $args) { - echo 'Caught: ', $args->arguments()[0]->value(), PHP_EOL; - // var_dump($args->arguments()); - $args->getIsolate()->throwException($args->getContext(), new V8\StringValue($args->getIsolate(), $args->arguments()[0]->value() . ' +')); -}); - - -$helper->header('Promise::then()'); -$value = new V8\PromiseObject($context); - -$helper->assert('Promise has no handlers', $value->hasHandler(), false); -$res = $value->then($context, $then); -$helper->assert('Promise has handlers', $value->hasHandler(), true); - -$helper->assert('Result of setting then is promise', $res instanceof \V8\PromiseObject); -$helper->assert('Result of setting then is not the same promise', $res !== $value); -$helper->line(); - -$helper->assert('Promise is pending', $value->state(), \V8\PromiseObject::STATE_PENDING); -$value->resolve($context, new \V8\StringValue($isolate, "resolved 1 ")); -$helper->assert('Promise is fulfilled', $value->state(), \V8\PromiseObject::STATE_FULFILLED); -$helper->inline('Promise result:', $value->result()->value()); -$res = $value->resolve($context, new \V8\StringValue($isolate, "resolved2 ")); -$helper->message('Promise handler should not be invoked on multiple resolve'); -$helper->inline('Promise result:', $value->result()->value()); -$res = $value->reject($context, new \V8\StringValue($isolate, "rejected")); -$helper->message('Promise handler should not be invoked on reject when resolved'); -$helper->inline('Promise result:', $value->result()->value()); -$helper->line(); - -$helper->header('Resolving a chain'); - -$value = new V8\PromiseObject($context); - -$v2 = $value->then($context, $then); -$v3 = $v2->then($context, $then); -$v3->then($context, $then); - -$value->resolve($context, new \V8\StringValue($isolate, "resolved 1")); -$v2->resolve($context, new \V8\StringValue($isolate, "resolved 2")); -$v3->resolve($context, new \V8\StringValue($isolate, "resolved 3")); - -$helper->line(); - -$value = new V8\PromiseObject($context); -$v2 = $value->then($context, $then); -$v3 = $v2->then($context, $then); -$v3->then($context, $then); - -$v2->resolve($context, new \V8\StringValue($isolate, "resolved 2")); -$v3->resolve($context, new \V8\StringValue($isolate, "resolved 3")); -$value->resolve($context, new \V8\StringValue($isolate, "resolved 1")); - -$helper->line(); - -$value = new V8\PromiseObject($context); -$v2 = $value->then($context, $then); -$v3 = $v2->then($context, $then); -$v3->then($context, $then); - -$v3->resolve($context, new \V8\StringValue($isolate, "resolved 3")); -$v2->resolve($context, new \V8\StringValue($isolate, "resolved 2")); -$value->resolve($context, new \V8\StringValue($isolate, "resolved 1")); -$helper->space(); - - - -$helper->header('Promise::catch()'); -$value = new V8\PromiseObject($context); - -$helper->assert('Promise has no handlers', $value->hasHandler(), false); -$res = $value->catch($context, $catch); -$helper->assert('Promise has handlers', $value->hasHandler(), true); - -$helper->assert('Result of setting catch is promise', $res instanceof \V8\PromiseObject); -$helper->assert('Result of setting catch is not the same promise', $res !== $value); -$helper->line(); - -$helper->assert('Promise is pending', $value->state(), \V8\PromiseObject::STATE_PENDING); -$value->reject($context, new \V8\StringValue($isolate, "rejected 1")); -$helper->assert('Promise is rejected', $value->state(), \V8\PromiseObject::STATE_REJECTED); -$helper->inline('Promise result:', $value->result()->value()); -$res = $value->resolve($context, new \V8\StringValue($isolate, "rejected 2")); -$helper->message('Promise handler should not be invoked on multiple reject'); -$helper->inline('Promise result:', $value->result()->value()); -$res = $value->resolve($context, new \V8\StringValue($isolate, "resolved")); -$helper->message('Promise handler should not be invoked on resolve when rejected'); -$helper->inline('Promise result:', $value->result()->value()); - -$helper->line(); - -$helper->header('Rejecting a chain'); - -$value = new V8\PromiseObject($context); -$v2 = $value->catch($context, $catch); -$v3 = $v2->catch($context, $catch); -$v3->catch($context, $catch); - -$value->reject($context, new \V8\StringValue($isolate, "rejected 1")); -$v2->reject($context, new \V8\StringValue($isolate, "rejected 2")); -$v3->reject($context, new \V8\StringValue($isolate, "rejected 3")); - -$helper->line(); - -$value = new V8\PromiseObject($context); -$v2 = $value->catch($context, $catch); -$v3 = $v2->catch($context, $catch); -$v3->catch($context, $catch); - -$v2->reject($context, new \V8\StringValue($isolate, "rejected 2")); -$v3->reject($context, new \V8\StringValue($isolate, "rejected 3")); -$value->reject($context, new \V8\StringValue($isolate, "rejected 1")); - -$helper->line(); - -$value = new V8\PromiseObject($context); -$v2 = $value->catch($context, $catch); -$v3 = $v2->catch($context, $catch); -$v3->catch($context, $catch); - -$v3->reject($context, new \V8\StringValue($isolate, "rejected 3")); -$v2->reject($context, new \V8\StringValue($isolate, "rejected 2")); -$value->reject($context, new \V8\StringValue($isolate, "rejected 1")); - - -?> ---EXPECT-- -Promise::then(): ----------------- -Promise has no handlers: ok -Promise has handlers: ok -Result of setting then is promise: ok -Result of setting then is not the same promise: ok - -Promise is pending: ok -Resolved: resolved 1 -Promise is fulfilled: ok -Promise result:: resolved 1 -Promise handler should not be invoked on multiple resolve -Promise result:: resolved2 -Promise handler should not be invoked on reject when resolved -Promise result:: rejected - -Resolving a chain: ------------------- -Resolved: resolved 1 -Resolved: resolved 1 + -Resolved: resolved 1 + + - -Resolved: resolved 2 -Resolved: resolved 2 + -Resolved: resolved 1 - -Resolved: resolved 3 -Resolved: resolved 2 -Resolved: resolved 1 - - -Promise::catch(): ------------------ -Promise has no handlers: ok -Promise has handlers: ok -Result of setting catch is promise: ok -Result of setting catch is not the same promise: ok - -Promise is pending: ok -Caught: rejected 1 -Promise is rejected: ok -Promise result:: rejected 1 -Promise handler should not be invoked on multiple reject -Promise result:: rejected 2 -Promise handler should not be invoked on resolve when rejected -Promise result:: resolved - -Rejecting a chain: ------------------- -Caught: rejected 1 -Caught: rejected 1 + -Caught: rejected 1 + + - -Caught: rejected 2 -Caught: rejected 2 + -Caught: rejected 1 - -Caught: rejected 3 -Caught: rejected 2 -Caught: rejected 1 diff --git a/v8.cc b/v8.cc index c603921..ea9923f 100644 --- a/v8.cc +++ b/v8.cc @@ -54,6 +54,7 @@ #include "php_v8_date.h" #include "php_v8_regexp.h" #include "php_v8_proxy.h" +#include "php_v8_promise_resolver.h" #include "php_v8_promise.h" #include "php_v8_number_object.h" #include "php_v8_boolean_object.h" @@ -149,6 +150,7 @@ PHP_MINIT_FUNCTION(v8) PHP_MINIT(php_v8_date)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_regexp)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_promise)(INIT_FUNC_ARGS_PASSTHRU); + PHP_MINIT(php_v8_promise_resolver)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_proxy)(INIT_FUNC_ARGS_PASSTHRU); PHP_MINIT(php_v8_number_object)(INIT_FUNC_ARGS_PASSTHRU); From 45e0cf7d894fd6113766f60bd75bdb6859c631a9 Mon Sep 17 00:00:00 2001 From: Bogdan Padalko Date: Sun, 25 Feb 2018 03:31:23 +0200 Subject: [PATCH 5/5] Remove deprecated and non-working script cache options, closes #99 --- src/php_v8_script_compiler.cc | 4 - stubs/src/ScriptCompiler.php | 10 +- tests/001-verify_extension_entities.phpt | 4 - tests/ScriptCompiler_compile.phpt | 297 +---------------------- tests/ScriptCompiler_compileUnbound.phpt | 204 ---------------- 5 files changed, 4 insertions(+), 515 deletions(-) diff --git a/src/php_v8_script_compiler.cc b/src/php_v8_script_compiler.cc index 6a07fc1..9df5752 100644 --- a/src/php_v8_script_compiler.cc +++ b/src/php_v8_script_compiler.cc @@ -349,10 +349,6 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler) this_ce = zend_register_internal_class(&ce); zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_NO_COMPILE_OPTIONS"), static_cast(v8::ScriptCompiler::CompileOptions::kNoCompileOptions)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_PARSER_CACHE"), static_cast(v8::ScriptCompiler::CompileOptions::kProduceParserCache)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_PARSER_CACHE"), static_cast(v8::ScriptCompiler::CompileOptions::kConsumeParserCache)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_CODE_CACHE"), static_cast(v8::ScriptCompiler::CompileOptions::kProduceCodeCache)); - zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_FULL_CODE_CACHE"), static_cast(v8::ScriptCompiler::CompileOptions::kProduceFullCodeCache)); zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_CODE_CACHE"), static_cast(v8::ScriptCompiler::CompileOptions::kConsumeCodeCache)); zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_EAGER_COMPILE"), static_cast(v8::ScriptCompiler::CompileOptions::kEagerCompile)); diff --git a/stubs/src/ScriptCompiler.php b/stubs/src/ScriptCompiler.php index d2c2596..be93db6 100644 --- a/stubs/src/ScriptCompiler.php +++ b/stubs/src/ScriptCompiler.php @@ -25,13 +25,9 @@ */ class ScriptCompiler { - const OPTION_NO_COMPILE_OPTIONS = 0; - const OPTION_PRODUCE_PARSER_CACHE = 1; - const OPTION_CONSUME_PARSER_CACHE = 2; - const OPTION_PRODUCE_CODE_CACHE = 3; - const OPTION_PRODUCE_FULL_CODE_CACHE = 4; - const OPTION_CONSUME_CODE_CACHE = 5; - const OPTION_EAGER_COMPILE = 6; + const OPTION_NO_COMPILE_OPTIONS = 0; + const OPTION_CONSUME_CODE_CACHE = 5; + const OPTION_EAGER_COMPILE = 6; private function __construct() { diff --git a/tests/001-verify_extension_entities.phpt b/tests/001-verify_extension_entities.phpt index 4c883cb..edf27e2 100644 --- a/tests/001-verify_extension_entities.phpt +++ b/tests/001-verify_extension_entities.phpt @@ -406,10 +406,6 @@ class V8\ScriptCompiler\Source class V8\ScriptCompiler const OPTION_NO_COMPILE_OPTIONS = 0 - const OPTION_PRODUCE_PARSER_CACHE = 1 - const OPTION_CONSUME_PARSER_CACHE = 2 - const OPTION_PRODUCE_CODE_CACHE = 3 - const OPTION_PRODUCE_FULL_CODE_CACHE = 4 const OPTION_CONSUME_CODE_CACHE = 5 const OPTION_EAGER_COMPILE = 6 public static function getCachedDataVersionTag(): float diff --git a/tests/ScriptCompiler_compile.phpt b/tests/ScriptCompiler_compile.phpt index 5de6373..4f33e3b 100644 --- a/tests/ScriptCompiler_compile.phpt +++ b/tests/ScriptCompiler_compile.phpt @@ -71,219 +71,12 @@ $cache_data = null; $source = new \V8\ScriptCompiler\Source($source_string); $helper->assert('Source cache data is not set', $source->getCachedData() === null); try { - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); + $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); } catch (\V8\Exceptions\Exception $e) { $helper->exception_export($e); } } -{ - $helper->header('Test generating code cache'); - $source_string = new V8\StringValue($isolate, '"test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE); - $helper->assert('Source cache data is update', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $cache_data = $source->getCachedData(); - $helper->line(); -} - -{ - $helper->header('Test consuming code cache'); - - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - -{ - $helper->header('Test generating full code cache'); - $source_string = new V8\StringValue($isolate, '"test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_FULL_CODE_CACHE); - $helper->assert('Source cache data is update', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $cache_data = $source->getCachedData(); - $helper->line(); -} - -{ - $helper->header('Test consuming full code cache'); - - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache for wrong source'); - $source_string = new V8\StringValue($isolate, '"other " + status'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache for source with different formatting'); - $source_string = new V8\StringValue($isolate, ' "test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false); - - $helper->line(); -} - -{ - $helper->header('Test generating code cache when it already set'); - $source_string = new V8\StringValue($isolate, '"test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache when requesting parser cache'); - - $source_string = new V8\StringValue($isolate, '"test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true); - - $helper->line(); -} - -{ - $helper->header('Test parser cache generated not for for all code'); - - $source_string = new V8\StringValue($isolate, '"test " + status'); - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE); - $helper->assert('Source cache data is NOT updated', $source->getCachedData() === null); - - $helper->line(); -} - -$parser_cache_src= 'function test(arg1, args) { - if (arg1 > arg2) { - return 1+1; - } else { - return arg1 + arg2; - } -}'; - -{ - $helper->header('Test generating parser cache'); - - $source_string = new V8\StringValue($isolate, $parser_cache_src); - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE); - $helper->assert('Source cache data is update', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $cache_data = $source->getCachedData(); - - //$helper->dump($cache_data->getData()); - $helper->line(); -} - -{ - $helper->header('Test consuming parser cache'); - - $source_string = new V8\StringValue($isolate, $parser_cache_src); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - -{ - $helper->header('Test consuming parser cache on different source (function with the same name)'); - - $bin = $cache_data->getData(); - $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - try { - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - } catch (\V8\Exceptions\TryCatchException $e) { - $helper->exception_export($e); - } - - $helper->line(); -} - -{ - $helper->header('Test consuming parser cache on different source'); - - $bin = $cache_data->getData(); - $source_string = new V8\StringValue($isolate, 'function test2() { return 1+1;}'); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - $helper->assert('Source cache data is not changed', $source->getCachedData()->getData() === $bin); - - $helper->line(); -} - -{ - $helper->header('Test consuming parser cache on the same source with different formatting'); - - $source_string = new V8\StringValue($isolate, ' ' . $parser_cache_src); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache when parser cache given'); - - $source_string = new V8\StringValue($isolate, $parser_cache_src); - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - - - ?> --EXPECT-- Compiling: @@ -303,91 +96,3 @@ Test cache when no cache set: ----------------------------- Source cache data is not set: ok V8\Exceptions\Exception: Unable to consume cache when it's not set -Test generating code cache: ---------------------------- -Source cache data is NULL: ok -Source cache data is update: ok -Source cache data is not rejected: ok - -Test consuming code cache: --------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test generating full code cache: --------------------------------- -Source cache data is NULL: ok -Source cache data is update: ok -Source cache data is not rejected: ok - -Test consuming full code cache: -------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test consuming code cache for wrong source: -------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok - -Test consuming code cache for source with different formatting: ---------------------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test generating code cache when it already set: ------------------------------------------------ -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok - -Test consuming code cache when requesting parser cache: -------------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test parser cache generated not for for all code: -------------------------------------------------- -Source cache data is NULL: ok -Source cache data is NOT updated: ok - -Test generating parser cache: ------------------------------ -Source cache data is NULL: ok -Source cache data is update: ok -Source cache data is not rejected: ok - -Test consuming parser cache: ----------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test consuming parser cache on different source (function with the same name): ------------------------------------------------------------------------------- -Source cache data is set: ok -V8\Exceptions\TryCatchException: SyntaxError: Unexpected end of input - -Test consuming parser cache on different source: ------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok -Source cache data is not changed: ok - -Test consuming parser cache on the same source with different formatting: -------------------------------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok - -Test consuming code cache when parser cache given: --------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok diff --git a/tests/ScriptCompiler_compileUnbound.phpt b/tests/ScriptCompiler_compileUnbound.phpt index e80b692..15efd74 100644 --- a/tests/ScriptCompiler_compileUnbound.phpt +++ b/tests/ScriptCompiler_compileUnbound.phpt @@ -72,146 +72,6 @@ $cache_data = null; $helper->space(); } -{ - $helper->header('Test cache when no cache set'); - - $source_string = new V8\StringValue($isolate, '"test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is not set', $source->getCachedData() === null); - try { - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - } catch (\V8\Exceptions\Exception $e) { - $helper->exception_export($e); - } -} - -{ - $helper->header('Test generating code cache'); - $source_string = new V8\StringValue($isolate, '"test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE); - $helper->assert('Source cache data is update', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $cache_data = $source->getCachedData(); - $helper->line(); -} - -{ - $helper->header('Test consuming code cache'); - - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache for wrong source'); - $source_string = new V8\StringValue($isolate, '"other " + status');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache for source with different formatting'); - $source_string = new V8\StringValue($isolate, ' "test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false); - - $helper->line(); -} - -{ - $helper->header('Test generating code cache when it already set'); - $source_string = new V8\StringValue($isolate, '"test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache when requesting parser cache'); - - $source_string = new V8\StringValue($isolate, '"test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true); - - $helper->line(); -} - -{ - $helper->header('Test parser cache genereted not for for all code'); - - $source_string = new V8\StringValue($isolate, '"test " + status');; - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE); - $helper->assert('Source cache data is NOT updated', $source->getCachedData() === null); - - $helper->line(); -} - -{ - $helper->header('Test generating parser cache'); - - $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; - $source = new \V8\ScriptCompiler\Source($source_string); - $helper->assert('Source cache data is NULL', $source->getCachedData() === null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE); - $helper->assert('Source cache data is update', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $cache_data = $source->getCachedData(); - $helper->line(); -} - - -{ - $helper->header('Test consuming parser cache'); - - $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - -{ - $helper->header('Test consuming code cache when parser cache given'); - - $source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');; - $source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data); - $helper->assert('Source cache data is set', $source->getCachedData() != null); - $unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE); - $helper->assert('Source cache data is still set', $source->getCachedData() != null); - $helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false); - - $helper->line(); -} - ?> @@ -230,67 +90,3 @@ string(11) "test passed" string(30) "test passed for second context" string(30) "test passed for second context" string(11) "test passed" - - -Test cache when no cache set: ------------------------------ -Source cache data is not set: ok -V8\Exceptions\Exception: Unable to consume cache when it's not set -Test generating code cache: ---------------------------- -Source cache data is NULL: ok -Source cache data is update: ok -Source cache data is not rejected: ok - -Test consuming code cache: --------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test consuming code cache for wrong source: -------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok - -Test consuming code cache for source with different formatting: ---------------------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test generating code cache when it already set: ------------------------------------------------ -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is rejected: ok - -Test consuming code cache when requesting parser cache: -------------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test parser cache genereted not for for all code: -------------------------------------------------- -Source cache data is NULL: ok -Source cache data is NOT updated: ok - -Test generating parser cache: ------------------------------ -Source cache data is NULL: ok -Source cache data is update: ok -Source cache data is not rejected: ok - -Test consuming parser cache: ----------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok - -Test consuming code cache when parser cache given: --------------------------------------------------- -Source cache data is set: ok -Source cache data is still set: ok -Source cache data is not rejected: ok