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

Commit eaf692f

Browse files
committed
Add ScriptCompiler::OPTION_EAGER_COMPILE option
v8/v8@c5eb79e
1 parent 950991f commit eaf692f

File tree

4 files changed

+5
-2
lines changed

4 files changed

+5
-2
lines changed

Diff for: src/php_v8_script_compiler.cc

+1
Original file line numberDiff line numberDiff line change
@@ -354,6 +354,7 @@ PHP_MINIT_FUNCTION(php_v8_script_compiler)
354354
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceCodeCache));
355355
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_PRODUCE_FULL_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kProduceFullCodeCache));
356356
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_CONSUME_CODE_CACHE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeCodeCache));
357+
zend_declare_class_constant_long(this_ce, ZEND_STRL("OPTION_EAGER_COMPILE"), static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kEagerCompile));
357358

358359
return SUCCESS;
359360
}

Diff for: src/php_v8_script_compiler.h

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ extern "C" {
2727
extern zend_class_entry *php_v8_script_compiler_class_entry;
2828

2929
#define PHP_V8_CHECK_COMPILER_OPTIONS_RANGE(options, message) \
30-
if (options < static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kNoCompileOptions) \
31-
|| options > static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kConsumeCodeCache)) { \
30+
if ((options) < static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kNoCompileOptions) \
31+
|| (options) > static_cast<zend_long>(v8::ScriptCompiler::CompileOptions::kEagerCompile)) { \
3232
PHP_V8_THROW_VALUE_EXCEPTION(message); \
3333
return; \
3434
}

Diff for: stubs/src/ScriptCompiler.php

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ class ScriptCompiler
3131
const OPTION_PRODUCE_CODE_CACHE = 3;
3232
const OPTION_PRODUCE_FULL_CODE_CACHE = 4;
3333
const OPTION_CONSUME_CODE_CACHE = 5;
34+
const OPTION_EAGER_COMPILE = 6;
3435

3536
private function __construct()
3637
{

Diff for: tests/001-verify_extension_entities.phpt

+1
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,7 @@ class V8\ScriptCompiler
411411
const OPTION_PRODUCE_CODE_CACHE = 3
412412
const OPTION_PRODUCE_FULL_CODE_CACHE = 4
413413
const OPTION_CONSUME_CODE_CACHE = 5
414+
const OPTION_EAGER_COMPILE = 6
414415
public static function getCachedDataVersionTag(): float
415416
public static function compileUnboundScript(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\UnboundScript
416417
public static function compile(V8\Context $context, V8\ScriptCompiler\Source $source, int $options): V8\Script

0 commit comments

Comments
 (0)