Skip to content
This repository was archived by the owner on Mar 29, 2024. It is now read-only.

Commit 8c67a74

Browse files
committedSep 16, 2017
Move CompileOptions constants under ScriptCompiler, closes #65.
1 parent 88dc507 commit 8c67a74

7 files changed

+39
-71
lines changed
 

‎src/php_v8_script_compiler.cc

+7-19
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#include "php_v8.h"
2828

2929
zend_class_entry* php_v8_script_compiler_class_entry;
30-
zend_class_entry* php_v8_compile_options_class_entry;
3130
#define this_ce php_v8_script_compiler_class_entry
3231

3332

@@ -81,7 +80,7 @@ static PHP_METHOD(ScriptCompiler, compileUnboundScript)
8180
return;
8281
}
8382

84-
PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, "Invalid Script compiler options given. See V8\\ScriptCompiler\\CompileOptions class constants for available options.")
83+
PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, "Invalid Script compiler options given. See V8\\ScriptCompiler OPTION_* class constants for available options.")
8584

8685
PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context);
8786

@@ -137,7 +136,7 @@ static PHP_METHOD(ScriptCompiler, compile)
137136
return;
138137
}
139138

140-
PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, "Invalid Script compiler options given. See V8\\ScriptCompiler\\CompileOptions class constants for available options.")
139+
PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, "Invalid Script compiler options given. See V8\\ScriptCompiler OPTION_* class constants for available options.")
141140

142141
PHP_V8_CONTEXT_FETCH_WITH_CHECK(php_v8_context_zv, php_v8_context);
143142

@@ -285,10 +284,6 @@ static const zend_function_entry php_v8_script_compiler_methods[] = {
285284
PHP_FE_END
286285
};
287286

288-
static const zend_function_entry php_v8_compile_options_methods[] = {
289-
PHP_FE_END
290-
};
291-
292287

293288
PHP_MINIT_FUNCTION(php_v8_script_compiler)
294289
{
@@ -297,18 +292,11 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler)
297292
INIT_NS_CLASS_ENTRY(ce, PHP_V8_NS, "ScriptCompiler", php_v8_script_compiler_methods);
298293
this_ce = zend_register_internal_class(&ce);
299294

300-
#undef this_ce
301-
#define this_ce php_v8_compile_options_class_entry
302-
303-
INIT_NS_CLASS_ENTRY(ce, "V8\\ScriptCompiler", "CompileOptions", php_v8_compile_options_methods);
304-
this_ce = zend_register_internal_class(&ce);
305-
this_ce->ce_flags |= ZEND_ACC_FINAL;
306-
307-
zend_declare_class_constant_long(this_ce, ZEND_STRL("NO_COMPILE_OPTIONS"), v8::ScriptCompiler::CompileOptions::kNoCompileOptions);
308-
zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceParserCache);
309-
zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_PARSER_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeParserCache);
310-
zend_declare_class_constant_long(this_ce, ZEND_STRL("PRODUCE_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kProduceCodeCache);
311-
zend_declare_class_constant_long(this_ce, ZEND_STRL("CONSUME_CODE_CACHE"), v8::ScriptCompiler::CompileOptions::kConsumeCodeCache);
295+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_NO_COMPILE_OPTIONS"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kNoCompileOptions));
296+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_PARSER_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceParserCache));
297+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_PARSER_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeParserCache));
298+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceCodeCache));
299+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeCodeCache));
312300

313301
return SUCCESS;
314302
}

‎src/php_v8_script_compiler.h

-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ extern "C" {
2222
}
2323

2424
extern zend_class_entry *php_v8_script_compiler_class_entry;
25-
extern zend_class_entry* php_v8_compile_options_class_entry;
2625

2726
#define PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, message) \
2827
if (options < static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kNoCompileOptions) \

‎stubs/src/ScriptCompiler.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public static function cachedDataVersionTag(): int
5959
*
6060
* @return UnboundScript
6161
*/
62-
public static function compileUnboundScript(Context $context, Source $source, int $options = CompileOptions::NO_COMPILE_OPTIONS): UnboundScript
62+
public static function compileUnboundScript(Context $context, Source $source, int $options = ScriptCompiler::OPTION_NO_COMPILE_OPTIONS): UnboundScript
6363
{
6464
}
6565

@@ -80,7 +80,7 @@ public static function compileUnboundScript(Context $context, Source $source, in
8080
*
8181
* @return Script
8282
*/
83-
public static function compile(Context $context, Source $source, int $options = CompileOptions::NO_COMPILE_OPTIONS): Script
83+
public static function compile(Context $context, Source $source, int $options = ScriptCompiler::OPTION_NO_COMPILE_OPTIONS): Script
8484
{
8585
}
8686

‎tests/001-verify_extension_entities.phpt

+5-7
Original file line numberDiff line numberDiff line change
@@ -396,18 +396,16 @@ class V8\ScriptCompiler\Source
396396
public function getCachedData(): ?V8\ScriptCompiler\CachedData
397397

398398
class V8\ScriptCompiler
399+
const OPTION_NO_COMPILE_OPTIONS = 0
400+
const OPTION_PRODUCE_PARSER_CACHE = 1
401+
const OPTION_CONSUME_PARSER_CACHE = 2
402+
const OPTION_PRODUCE_CODE_CACHE = 3
403+
const OPTION_CONSUME_CODE_CACHE = 4
399404
public static function cachedDataVersionTag(): int
400405
public static function compileUnboundScript(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\UnboundScript
401406
public static function compile(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\Script
402407
public static function compileFunctionInContext(V8\Context $context, V8\ScriptCompiler\Source $source, array $arguments, array $context_extensions): V8\FunctionObject
403408

404-
final class V8\ScriptCompiler\CompileOptions
405-
const NO_COMPILE_OPTIONS = 0
406-
const PRODUCE_PARSER_CACHE = 1
407-
const CONSUME_PARSER_CACHE = 2
408-
const PRODUCE_CODE_CACHE = 3
409-
const CONSUME_CODE_CACHE = 4
410-
411409
class V8\ExceptionManager
412410
public static function createRangeError(V8\Context $context, V8\StringValue $message): V8\ObjectValue
413411
public static function createReferenceError(V8\Context $context, V8\StringValue $message): V8\ObjectValue

‎tests/002-enums.phpt

-17
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ $enums = [
1919
new V8\PropertyFilter(),
2020
new V8\KeyCollectionMode(),
2121
new V8\IndexFilter(),
22-
new V8\ScriptCompiler\CompileOptions(),
2322
];
2423

2524
foreach ($enums as $enum) {
@@ -149,19 +148,3 @@ Class constants:
149148
----------------
150149
V8\IndexFilter::INCLUDE_INDICES = 0
151150
V8\IndexFilter::SKIP_INDICES = 1
152-
153-
154-
Object representation:
155-
----------------------
156-
Class is final: ok
157-
object(V8\ScriptCompiler\CompileOptions)#10 (0) {
158-
}
159-
160-
161-
Class constants:
162-
----------------
163-
V8\ScriptCompiler\CompileOptions::NO_COMPILE_OPTIONS = 0
164-
V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE = 1
165-
V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE = 2
166-
V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE = 3
167-
V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE = 4

‎tests/ScriptCompiler_compile.phpt

+14-14
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ $cache_data = null;
7373
$source = new \V8\ScriptCompiler\Source($source_string);
7474
$helper->assert('Source cache data is not set', $source->getCachedData() === null);
7575
try {
76-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
76+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
7777
} catch (\V8\Exceptions\Exception $e) {
7878
$helper->exception_export($e);
7979
}
@@ -84,7 +84,7 @@ $cache_data = null;
8484
$source_string = new V8\StringValue($isolate, '"test " + status');
8585
$source = new \V8\ScriptCompiler\Source($source_string);
8686
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
87-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE);
87+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
8888
$helper->assert('Source cache data is update', $source->getCachedData() != null);
8989
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
9090

@@ -97,7 +97,7 @@ $cache_data = null;
9797

9898
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
9999
$helper->assert('Source cache data is set', $source->getCachedData() != null);
100-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
100+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
101101
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
102102
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
103103

@@ -109,7 +109,7 @@ $cache_data = null;
109109
$source_string = new V8\StringValue($isolate, '"other " + status');
110110
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
111111
$helper->assert('Source cache data is set', $source->getCachedData() != null);
112-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
112+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
113113
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
114114
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
115115

@@ -121,7 +121,7 @@ $cache_data = null;
121121
$source_string = new V8\StringValue($isolate, ' "test " + status');
122122
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
123123
$helper->assert('Source cache data is set', $source->getCachedData() != null);
124-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
124+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
125125
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
126126
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false);
127127

@@ -133,7 +133,7 @@ $cache_data = null;
133133
$source_string = new V8\StringValue($isolate, '"test " + status');
134134
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
135135
$helper->assert('Source cache data is set', $source->getCachedData() != null);
136-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE);
136+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
137137
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
138138
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
139139

@@ -146,7 +146,7 @@ $cache_data = null;
146146
$source_string = new V8\StringValue($isolate, '"test " + status');
147147
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
148148
$helper->assert('Source cache data is set', $source->getCachedData() != null);
149-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
149+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
150150
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
151151
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true);
152152

@@ -159,7 +159,7 @@ $cache_data = null;
159159
$source_string = new V8\StringValue($isolate, '"test " + status');
160160
$source = new \V8\ScriptCompiler\Source($source_string);
161161
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
162-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE);
162+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
163163
$helper->assert('Source cache data is NOT updated', $source->getCachedData() === null);
164164

165165
$helper->line();
@@ -179,7 +179,7 @@ $parser_cache_src= 'function test(arg1, args) {
179179
$source_string = new V8\StringValue($isolate, $parser_cache_src);
180180
$source = new \V8\ScriptCompiler\Source($source_string);
181181
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
182-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE);
182+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
183183
$helper->assert('Source cache data is update', $source->getCachedData() != null);
184184
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
185185

@@ -195,7 +195,7 @@ $parser_cache_src= 'function test(arg1, args) {
195195
$source_string = new V8\StringValue($isolate, $parser_cache_src);
196196
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
197197
$helper->assert('Source cache data is set', $source->getCachedData() != null);
198-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
198+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
199199
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
200200
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
201201

@@ -210,7 +210,7 @@ $parser_cache_src= 'function test(arg1, args) {
210210
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
211211
$helper->assert('Source cache data is set', $source->getCachedData() != null);
212212
try {
213-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
213+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
214214
} catch (\V8\Exceptions\TryCatchException $e) {
215215
$helper->exception_export($e);
216216
}
@@ -225,7 +225,7 @@ $parser_cache_src= 'function test(arg1, args) {
225225
$source_string = new V8\StringValue($isolate, 'function test2() { return 1+1;}');
226226
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
227227
$helper->assert('Source cache data is set', $source->getCachedData() != null);
228-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
228+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
229229
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
230230
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
231231
$helper->assert('Source cache data is not changed', $source->getCachedData()->getData() === $bin);
@@ -239,7 +239,7 @@ $parser_cache_src= 'function test(arg1, args) {
239239
$source_string = new V8\StringValue($isolate, ' ' . $parser_cache_src);
240240
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
241241
$helper->assert('Source cache data is set', $source->getCachedData() != null);
242-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
242+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
243243
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
244244
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
245245

@@ -252,7 +252,7 @@ $parser_cache_src= 'function test(arg1, args) {
252252
$source_string = new V8\StringValue($isolate, $parser_cache_src);
253253
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
254254
$helper->assert('Source cache data is set', $source->getCachedData() != null);
255-
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
255+
$script = V8\ScriptCompiler::compile($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
256256
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
257257
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
258258

‎tests/ScriptCompiler_compileUnbound.phpt

+11-11
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ $cache_data = null;
8181
$source = new \V8\ScriptCompiler\Source($source_string);
8282
$helper->assert('Source cache data is not set', $source->getCachedData() === null);
8383
try {
84-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
84+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
8585
} catch (\V8\Exceptions\Exception $e) {
8686
$helper->exception_export($e);
8787
}
@@ -92,7 +92,7 @@ $cache_data = null;
9292
$source_string = new V8\StringValue($isolate, '"test " + status');;
9393
$source = new \V8\ScriptCompiler\Source($source_string);
9494
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
95-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE);
95+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
9696
$helper->assert('Source cache data is update', $source->getCachedData() != null);
9797
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
9898

@@ -105,7 +105,7 @@ $cache_data = null;
105105

106106
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
107107
$helper->assert('Source cache data is set', $source->getCachedData() != null);
108-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
108+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
109109
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
110110
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
111111

@@ -117,7 +117,7 @@ $cache_data = null;
117117
$source_string = new V8\StringValue($isolate, '"other " + status');;
118118
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
119119
$helper->assert('Source cache data is set', $source->getCachedData() != null);
120-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
120+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
121121
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
122122
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
123123

@@ -129,7 +129,7 @@ $cache_data = null;
129129
$source_string = new V8\StringValue($isolate, ' "test " + status');;
130130
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
131131
$helper->assert('Source cache data is set', $source->getCachedData() != null);
132-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
132+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
133133
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
134134
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== false);
135135

@@ -141,7 +141,7 @@ $cache_data = null;
141141
$source_string = new V8\StringValue($isolate, '"test " + status');;
142142
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
143143
$helper->assert('Source cache data is set', $source->getCachedData() != null);
144-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_CODE_CACHE);
144+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_CODE_CACHE);
145145
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
146146
$helper->assert('Source cache data is rejected', $source->getCachedData()->isRejected() === true);
147147

@@ -154,7 +154,7 @@ $cache_data = null;
154154
$source_string = new V8\StringValue($isolate, '"test " + status');;
155155
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
156156
$helper->assert('Source cache data is set', $source->getCachedData() != null);
157-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
157+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
158158
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
159159
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() !== true);
160160

@@ -167,7 +167,7 @@ $cache_data = null;
167167
$source_string = new V8\StringValue($isolate, '"test " + status');;
168168
$source = new \V8\ScriptCompiler\Source($source_string);
169169
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
170-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE);
170+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
171171
$helper->assert('Source cache data is NOT updated', $source->getCachedData() === null);
172172

173173
$helper->line();
@@ -179,7 +179,7 @@ $cache_data = null;
179179
$source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');;
180180
$source = new \V8\ScriptCompiler\Source($source_string);
181181
$helper->assert('Source cache data is NULL', $source->getCachedData() === null);
182-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::PRODUCE_PARSER_CACHE);
182+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_PRODUCE_PARSER_CACHE);
183183
$helper->assert('Source cache data is update', $source->getCachedData() != null);
184184
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
185185

@@ -194,7 +194,7 @@ $cache_data = null;
194194
$source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');;
195195
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
196196
$helper->assert('Source cache data is set', $source->getCachedData() != null);
197-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_PARSER_CACHE);
197+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_PARSER_CACHE);
198198
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
199199
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
200200

@@ -207,7 +207,7 @@ $cache_data = null;
207207
$source_string = new V8\StringValue($isolate, 'function test() { return 1+1;}');;
208208
$source = new \V8\ScriptCompiler\Source($source_string, null, $cache_data);
209209
$helper->assert('Source cache data is set', $source->getCachedData() != null);
210-
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler\CompileOptions::CONSUME_CODE_CACHE);
210+
$unbound = V8\ScriptCompiler::compileUnboundScript($context, $source, V8\ScriptCompiler::OPTION_CONSUME_CODE_CACHE);
211211
$helper->assert('Source cache data is still set', $source->getCachedData() != null);
212212
$helper->assert('Source cache data is not rejected', $source->getCachedData()->isRejected() === false);
213213

0 commit comments

Comments
 (0)
This repository has been archived.