Commit 01898366 authored by Camillo Bruni's avatar Camillo Bruni Committed by V8 LUCI CQ

[codegen] Move ScriptOriginOptions into ScriptDetails

Follow-up CLs will use the ScriptDetails object for code cache lookups
instead of only the ScriptOriginOptions.

Bug: v8:10284
Change-Id: Idc83e6e79cfca283369a9b5ceab8bc53dae5f2dd
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3069149
Commit-Queue: Camillo Bruni <cbruni@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#76073}
parent e7ad66ac
...@@ -2367,11 +2367,10 @@ namespace { ...@@ -2367,11 +2367,10 @@ namespace {
i::Compiler::ScriptDetails GetScriptDetails( i::Compiler::ScriptDetails GetScriptDetails(
i::Isolate* isolate, Local<Value> resource_name, int resource_line_offset, i::Isolate* isolate, Local<Value> resource_name, int resource_line_offset,
int resource_column_offset, Local<Value> source_map_url, int resource_column_offset, Local<Value> source_map_url,
Local<PrimitiveArray> host_defined_options) { Local<PrimitiveArray> host_defined_options,
i::Compiler::ScriptDetails script_details; ScriptOriginOptions origin_options) {
if (!resource_name.IsEmpty()) { i::Compiler::ScriptDetails script_details(
script_details.name_obj = Utils::OpenHandle(*(resource_name)); Utils::OpenHandle(*(resource_name), true), origin_options);
}
script_details.line_offset = resource_line_offset; script_details.line_offset = resource_line_offset;
script_details.column_offset = resource_column_offset; script_details.column_offset = resource_column_offset;
script_details.host_defined_options = script_details.host_defined_options =
...@@ -2409,11 +2408,11 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal( ...@@ -2409,11 +2408,11 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
i::Compiler::ScriptDetails script_details = GetScriptDetails( i::Compiler::ScriptDetails script_details = GetScriptDetails(
isolate, source->resource_name, source->resource_line_offset, isolate, source->resource_name, source->resource_line_offset,
source->resource_column_offset, source->source_map_url, source->resource_column_offset, source->source_map_url,
source->host_defined_options); source->host_defined_options, source->resource_options);
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info = i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
i::Compiler::GetSharedFunctionInfoForScript( i::Compiler::GetSharedFunctionInfoForScript(
isolate, str, script_details, source->resource_options, nullptr, isolate, str, script_details, nullptr, script_data, options,
script_data, options, no_cache_reason, i::NOT_NATIVES_CODE); no_cache_reason, i::NOT_NATIVES_CODE);
if (options == kConsumeCodeCache) { if (options == kConsumeCodeCache) {
source->cached_data->rejected = script_data->rejected(); source->cached_data->rejected = script_data->rejected();
} }
...@@ -2537,7 +2536,7 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext( ...@@ -2537,7 +2536,7 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
i::Compiler::ScriptDetails script_details = GetScriptDetails( i::Compiler::ScriptDetails script_details = GetScriptDetails(
isolate, source->resource_name, source->resource_line_offset, isolate, source->resource_name, source->resource_line_offset,
source->resource_column_offset, source->source_map_url, source->resource_column_offset, source->source_map_url,
source->host_defined_options); source->host_defined_options, source->resource_options);
i::ScriptData* script_data = nullptr; i::ScriptData* script_data = nullptr;
if (options == kConsumeCodeCache) { if (options == kConsumeCodeCache) {
...@@ -2551,8 +2550,7 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext( ...@@ -2551,8 +2550,7 @@ MaybeLocal<Function> ScriptCompiler::CompileFunctionInContext(
has_pending_exception = has_pending_exception =
!i::Compiler::GetWrappedFunction( !i::Compiler::GetWrappedFunction(
Utils::OpenHandle(*source->source_string), arguments_list, context, Utils::OpenHandle(*source->source_string), arguments_list, context,
script_details, source->resource_options, script_data, options, script_details, script_data, options, no_cache_reason)
no_cache_reason)
.ToHandle(&scoped_result); .ToHandle(&scoped_result);
if (options == kConsumeCodeCache) { if (options == kConsumeCodeCache) {
source->cached_data->rejected = script_data->rejected(); source->cached_data->rejected = script_data->rejected();
...@@ -2604,10 +2602,10 @@ i::MaybeHandle<i::SharedFunctionInfo> CompileStreamedSource( ...@@ -2604,10 +2602,10 @@ i::MaybeHandle<i::SharedFunctionInfo> CompileStreamedSource(
i::Compiler::ScriptDetails script_details = i::Compiler::ScriptDetails script_details =
GetScriptDetails(isolate, origin.ResourceName(), origin.LineOffset(), GetScriptDetails(isolate, origin.ResourceName(), origin.LineOffset(),
origin.ColumnOffset(), origin.SourceMapUrl(), origin.ColumnOffset(), origin.SourceMapUrl(),
origin.HostDefinedOptions()); origin.HostDefinedOptions(), origin.Options());
i::ScriptStreamingData* data = v8_source->impl(); i::ScriptStreamingData* data = v8_source->impl();
return i::Compiler::GetSharedFunctionInfoForStreamedScript( return i::Compiler::GetSharedFunctionInfoForStreamedScript(
isolate, str, script_details, origin.Options(), data); isolate, str, script_details, data);
} }
} // namespace } // namespace
......
...@@ -2625,12 +2625,12 @@ void SetScriptFieldsFromDetails(Isolate* isolate, Script script, ...@@ -2625,12 +2625,12 @@ void SetScriptFieldsFromDetails(Isolate* isolate, Script script,
Handle<Script> NewScript( Handle<Script> NewScript(
Isolate* isolate, ParseInfo* parse_info, Handle<String> source, Isolate* isolate, ParseInfo* parse_info, Handle<String> source,
Compiler::ScriptDetails script_details, ScriptOriginOptions origin_options, Compiler::ScriptDetails script_details, NativesFlag natives,
NativesFlag natives,
MaybeHandle<FixedArray> maybe_wrapped_arguments = kNullMaybeHandle) { MaybeHandle<FixedArray> maybe_wrapped_arguments = kNullMaybeHandle) {
// Create a script object describing the script to be compiled. // Create a script object describing the script to be compiled.
Handle<Script> script = parse_info->CreateScript( Handle<Script> script =
isolate, source, maybe_wrapped_arguments, origin_options, natives); parse_info->CreateScript(isolate, source, maybe_wrapped_arguments,
script_details.origin_options, natives);
DisallowGarbageCollection no_gc; DisallowGarbageCollection no_gc;
SetScriptFieldsFromDetails(isolate, *script, script_details, &no_gc); SetScriptFieldsFromDetails(isolate, *script, script_details, &no_gc);
LOG(isolate, ScriptDetails(*script)); LOG(isolate, ScriptDetails(*script));
...@@ -2639,16 +2639,15 @@ Handle<Script> NewScript( ...@@ -2639,16 +2639,15 @@ Handle<Script> NewScript(
MaybeHandle<SharedFunctionInfo> CompileScriptOnMainThread( MaybeHandle<SharedFunctionInfo> CompileScriptOnMainThread(
const UnoptimizedCompileFlags flags, Handle<String> source, const UnoptimizedCompileFlags flags, Handle<String> source,
const Compiler::ScriptDetails& script_details, const Compiler::ScriptDetails& script_details, NativesFlag natives,
ScriptOriginOptions origin_options, NativesFlag natives,
v8::Extension* extension, Isolate* isolate, v8::Extension* extension, Isolate* isolate,
IsCompiledScope* is_compiled_scope) { IsCompiledScope* is_compiled_scope) {
UnoptimizedCompileState compile_state(isolate); UnoptimizedCompileState compile_state(isolate);
ParseInfo parse_info(isolate, flags, &compile_state); ParseInfo parse_info(isolate, flags, &compile_state);
parse_info.set_extension(extension); parse_info.set_extension(extension);
Handle<Script> script = NewScript(isolate, &parse_info, source, Handle<Script> script =
script_details, origin_options, natives); NewScript(isolate, &parse_info, source, script_details, natives);
DCHECK_IMPLIES(parse_info.flags().collect_type_profile(), DCHECK_IMPLIES(parse_info.flags().collect_type_profile(),
script->IsUserJavaScript()); script->IsUserJavaScript());
DCHECK_EQ(parse_info.flags().is_repl_mode(), script->is_repl_mode()); DCHECK_EQ(parse_info.flags().is_repl_mode(), script->is_repl_mode());
...@@ -2705,13 +2704,12 @@ class StressBackgroundCompileThread : public base::Thread { ...@@ -2705,13 +2704,12 @@ class StressBackgroundCompileThread : public base::Thread {
}; };
bool CanBackgroundCompile(const Compiler::ScriptDetails& script_details, bool CanBackgroundCompile(const Compiler::ScriptDetails& script_details,
ScriptOriginOptions origin_options,
v8::Extension* extension, v8::Extension* extension,
ScriptCompiler::CompileOptions compile_options, ScriptCompiler::CompileOptions compile_options,
NativesFlag natives) { NativesFlag natives) {
// TODO(leszeks): Remove the module check once background compilation of // TODO(leszeks): Remove the module check once background compilation of
// modules is supported. // modules is supported.
return !origin_options.IsModule() && !extension && return !script_details.origin_options.IsModule() && !extension &&
script_details.repl_mode == REPLMode::kNo && script_details.repl_mode == REPLMode::kNo &&
compile_options == ScriptCompiler::kNoCompileOptions && compile_options == ScriptCompiler::kNoCompileOptions &&
natives == NOT_NATIVES_CODE; natives == NOT_NATIVES_CODE;
...@@ -2729,12 +2727,12 @@ bool CompilationExceptionIsRangeError(Isolate* isolate, Handle<Object> obj) { ...@@ -2729,12 +2727,12 @@ bool CompilationExceptionIsRangeError(Isolate* isolate, Handle<Object> obj) {
MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread( MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread(
Handle<String> source, const Compiler::ScriptDetails& script_details, Handle<String> source, const Compiler::ScriptDetails& script_details,
ScriptOriginOptions origin_options, Isolate* isolate, Isolate* isolate, IsCompiledScope* is_compiled_scope) {
IsCompiledScope* is_compiled_scope) {
// Start a background thread compiling the script. // Start a background thread compiling the script.
StressBackgroundCompileThread background_compile_thread( StressBackgroundCompileThread background_compile_thread(
isolate, source, isolate, source,
origin_options.IsModule() ? ScriptType::kModule : ScriptType::kClassic); script_details.origin_options.IsModule() ? ScriptType::kModule
: ScriptType::kClassic);
UnoptimizedCompileFlags flags_copy = UnoptimizedCompileFlags flags_copy =
background_compile_thread.data()->task->flags(); background_compile_thread.data()->task->flags();
...@@ -2752,8 +2750,8 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread( ...@@ -2752,8 +2750,8 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread(
TryCatch ignore_try_catch(reinterpret_cast<v8::Isolate*>(isolate)); TryCatch ignore_try_catch(reinterpret_cast<v8::Isolate*>(isolate));
flags_copy.set_script_id(Script::kTemporaryScriptId); flags_copy.set_script_id(Script::kTemporaryScriptId);
main_thread_maybe_result = CompileScriptOnMainThread( main_thread_maybe_result = CompileScriptOnMainThread(
flags_copy, source, script_details, origin_options, NOT_NATIVES_CODE, flags_copy, source, script_details, NOT_NATIVES_CODE, nullptr, isolate,
nullptr, isolate, &inner_is_compiled_scope); &inner_is_compiled_scope);
if (main_thread_maybe_result.is_null()) { if (main_thread_maybe_result.is_null()) {
// Assume all range errors are stack overflows. // Assume all range errors are stack overflows.
main_thread_had_stack_overflow = CompilationExceptionIsRangeError( main_thread_had_stack_overflow = CompilationExceptionIsRangeError(
...@@ -2770,8 +2768,7 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread( ...@@ -2770,8 +2768,7 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread(
MaybeHandle<SharedFunctionInfo> maybe_result = MaybeHandle<SharedFunctionInfo> maybe_result =
Compiler::GetSharedFunctionInfoForStreamedScript( Compiler::GetSharedFunctionInfoForStreamedScript(
isolate, source, script_details, origin_options, isolate, source, script_details, background_compile_thread.data());
background_compile_thread.data());
// Either both compiles should succeed, or both should fail. The one exception // Either both compiles should succeed, or both should fail. The one exception
// to this is that the main-thread compilation might stack overflow while the // to this is that the main-thread compilation might stack overflow while the
...@@ -2799,8 +2796,7 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread( ...@@ -2799,8 +2796,7 @@ MaybeHandle<SharedFunctionInfo> CompileScriptOnBothBackgroundAndMainThread(
// static // static
MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
Isolate* isolate, Handle<String> source, Isolate* isolate, Handle<String> source,
const Compiler::ScriptDetails& script_details, const Compiler::ScriptDetails& script_details, v8::Extension* extension,
ScriptOriginOptions origin_options, v8::Extension* extension,
ScriptData* cached_data, ScriptCompiler::CompileOptions compile_options, ScriptData* cached_data, ScriptCompiler::CompileOptions compile_options,
ScriptCompiler::NoCacheReason no_cache_reason, NativesFlag natives) { ScriptCompiler::NoCacheReason no_cache_reason, NativesFlag natives) {
ScriptCompileTimerScope compile_timer(isolate, no_cache_reason); ScriptCompileTimerScope compile_timer(isolate, no_cache_reason);
...@@ -2836,7 +2832,8 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( ...@@ -2836,7 +2832,8 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
// First check per-isolate compilation cache. // First check per-isolate compilation cache.
maybe_result = compilation_cache->LookupScript( maybe_result = compilation_cache->LookupScript(
source, script_details.name_obj, script_details.line_offset, source, script_details.name_obj, script_details.line_offset,
script_details.column_offset, origin_options, language_mode); script_details.column_offset, script_details.origin_options,
language_mode);
if (!maybe_result.is_null()) { if (!maybe_result.is_null()) {
compile_timer.set_hit_isolate_cache(); compile_timer.set_hit_isolate_cache();
} else if (can_consume_code_cache) { } else if (can_consume_code_cache) {
...@@ -2848,7 +2845,7 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( ...@@ -2848,7 +2845,7 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
"V8.CompileDeserialize"); "V8.CompileDeserialize");
Handle<SharedFunctionInfo> inner_result; Handle<SharedFunctionInfo> inner_result;
if (CodeSerializer::Deserialize(isolate, cached_data, source, if (CodeSerializer::Deserialize(isolate, cached_data, source,
origin_options) script_details.origin_options)
.ToHandle(&inner_result) && .ToHandle(&inner_result) &&
inner_result->is_compiled()) { inner_result->is_compiled()) {
// Promote to per-isolate compilation cache. // Promote to per-isolate compilation cache.
...@@ -2866,26 +2863,26 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( ...@@ -2866,26 +2863,26 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
if (maybe_result.is_null()) { if (maybe_result.is_null()) {
// No cache entry found compile the script. // No cache entry found compile the script.
if (FLAG_stress_background_compile && if (FLAG_stress_background_compile &&
CanBackgroundCompile(script_details, origin_options, extension, CanBackgroundCompile(script_details, extension, compile_options,
compile_options, natives)) { natives)) {
// If the --stress-background-compile flag is set, do the actual // If the --stress-background-compile flag is set, do the actual
// compilation on a background thread, and wait for its result. // compilation on a background thread, and wait for its result.
maybe_result = CompileScriptOnBothBackgroundAndMainThread( maybe_result = CompileScriptOnBothBackgroundAndMainThread(
source, script_details, origin_options, isolate, &is_compiled_scope); source, script_details, isolate, &is_compiled_scope);
} else { } else {
UnoptimizedCompileFlags flags = UnoptimizedCompileFlags flags =
UnoptimizedCompileFlags::ForToplevelCompile( UnoptimizedCompileFlags::ForToplevelCompile(
isolate, natives == NOT_NATIVES_CODE, language_mode, isolate, natives == NOT_NATIVES_CODE, language_mode,
script_details.repl_mode, script_details.repl_mode,
origin_options.IsModule() ? ScriptType::kModule script_details.origin_options.IsModule() ? ScriptType::kModule
: ScriptType::kClassic, : ScriptType::kClassic,
FLAG_lazy); FLAG_lazy);
flags.set_is_eager(compile_options == ScriptCompiler::kEagerCompile); flags.set_is_eager(compile_options == ScriptCompiler::kEagerCompile);
maybe_result = CompileScriptOnMainThread( maybe_result =
flags, source, script_details, origin_options, natives, extension, CompileScriptOnMainThread(flags, source, script_details, natives,
isolate, &is_compiled_scope); extension, isolate, &is_compiled_scope);
} }
// Add the result to the isolate cache. // Add the result to the isolate cache.
...@@ -2905,8 +2902,7 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript( ...@@ -2905,8 +2902,7 @@ MaybeHandle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
MaybeHandle<JSFunction> Compiler::GetWrappedFunction( MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
Handle<String> source, Handle<FixedArray> arguments, Handle<String> source, Handle<FixedArray> arguments,
Handle<Context> context, const Compiler::ScriptDetails& script_details, Handle<Context> context, const Compiler::ScriptDetails& script_details,
ScriptOriginOptions origin_options, ScriptData* cached_data, ScriptData* cached_data, v8::ScriptCompiler::CompileOptions compile_options,
v8::ScriptCompiler::CompileOptions compile_options,
v8::ScriptCompiler::NoCacheReason no_cache_reason) { v8::ScriptCompiler::NoCacheReason no_cache_reason) {
Isolate* isolate = context->GetIsolate(); Isolate* isolate = context->GetIsolate();
ScriptCompileTimerScope compile_timer(isolate, no_cache_reason); ScriptCompileTimerScope compile_timer(isolate, no_cache_reason);
...@@ -2935,7 +2931,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction( ...@@ -2935,7 +2931,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"), TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("v8.compile"),
"V8.CompileDeserialize"); "V8.CompileDeserialize");
maybe_result = CodeSerializer::Deserialize(isolate, cached_data, source, maybe_result = CodeSerializer::Deserialize(isolate, cached_data, source,
origin_options); script_details.origin_options);
if (maybe_result.is_null()) { if (maybe_result.is_null()) {
// Deserializer failed. Fall through to compile. // Deserializer failed. Fall through to compile.
compile_timer.set_consuming_code_cache_failed(); compile_timer.set_consuming_code_cache_failed();
...@@ -2966,7 +2962,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction( ...@@ -2966,7 +2962,7 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
} }
script = NewScript(isolate, &parse_info, source, script_details, script = NewScript(isolate, &parse_info, source, script_details,
origin_options, NOT_NATIVES_CODE, arguments); NOT_NATIVES_CODE, arguments);
Handle<SharedFunctionInfo> top_level; Handle<SharedFunctionInfo> top_level;
maybe_result = v8::internal::CompileToplevel(&parse_info, script, maybe_result = v8::internal::CompileToplevel(&parse_info, script,
...@@ -2999,8 +2995,8 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction( ...@@ -2999,8 +2995,8 @@ MaybeHandle<JSFunction> Compiler::GetWrappedFunction(
MaybeHandle<SharedFunctionInfo> MaybeHandle<SharedFunctionInfo>
Compiler::GetSharedFunctionInfoForStreamedScript( Compiler::GetSharedFunctionInfoForStreamedScript(
Isolate* isolate, Handle<String> source, Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options, const ScriptDetails& script_details, ScriptStreamingData* streaming_data) {
ScriptStreamingData* streaming_data) { ScriptOriginOptions origin_options = script_details.origin_options;
DCHECK(!origin_options.IsWasm()); DCHECK(!origin_options.IsWasm());
ScriptCompileTimerScope compile_timer( ScriptCompileTimerScope compile_timer(
......
...@@ -133,11 +133,14 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -133,11 +133,14 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
struct ScriptDetails { struct ScriptDetails {
ScriptDetails() ScriptDetails()
: line_offset(0), column_offset(0), repl_mode(REPLMode::kNo) {} : line_offset(0), column_offset(0), repl_mode(REPLMode::kNo) {}
explicit ScriptDetails(Handle<Object> script_name) explicit ScriptDetails(
Handle<Object> script_name,
ScriptOriginOptions origin_options = v8::ScriptOriginOptions())
: line_offset(0), : line_offset(0),
column_offset(0), column_offset(0),
name_obj(script_name), name_obj(script_name),
repl_mode(REPLMode::kNo) {} repl_mode(REPLMode::kNo),
origin_options(origin_options) {}
int line_offset; int line_offset;
int column_offset; int column_offset;
...@@ -145,6 +148,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -145,6 +148,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
i::MaybeHandle<i::Object> source_map_url; i::MaybeHandle<i::Object> source_map_url;
i::MaybeHandle<i::FixedArray> host_defined_options; i::MaybeHandle<i::FixedArray> host_defined_options;
REPLMode repl_mode; REPLMode repl_mode;
const ScriptOriginOptions origin_options;
}; };
// Create a function that results from wrapping |source| in a function, // Create a function that results from wrapping |source| in a function,
...@@ -152,7 +156,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -152,7 +156,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
V8_WARN_UNUSED_RESULT static MaybeHandle<JSFunction> GetWrappedFunction( V8_WARN_UNUSED_RESULT static MaybeHandle<JSFunction> GetWrappedFunction(
Handle<String> source, Handle<FixedArray> arguments, Handle<String> source, Handle<FixedArray> arguments,
Handle<Context> context, const ScriptDetails& script_details, Handle<Context> context, const ScriptDetails& script_details,
ScriptOriginOptions origin_options, ScriptData* cached_data, ScriptData* cached_data,
v8::ScriptCompiler::CompileOptions compile_options, v8::ScriptCompiler::CompileOptions compile_options,
v8::ScriptCompiler::NoCacheReason no_cache_reason); v8::ScriptCompiler::NoCacheReason no_cache_reason);
...@@ -176,9 +180,8 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -176,9 +180,8 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// Create a shared function info object for a String source. // Create a shared function info object for a String source.
static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScript( static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForScript(
Isolate* isolate, Handle<String> source, Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options, const ScriptDetails& script_details, v8::Extension* extension,
v8::Extension* extension, ScriptData* cached_data, ScriptData* cached_data, ScriptCompiler::CompileOptions compile_options,
ScriptCompiler::CompileOptions compile_options,
ScriptCompiler::NoCacheReason no_cache_reason, ScriptCompiler::NoCacheReason no_cache_reason,
NativesFlag is_natives_code); NativesFlag is_natives_code);
...@@ -189,8 +192,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic { ...@@ -189,8 +192,7 @@ class V8_EXPORT_PRIVATE Compiler : public AllStatic {
// owned by the caller. // owned by the caller.
static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForStreamedScript( static MaybeHandle<SharedFunctionInfo> GetSharedFunctionInfoForStreamedScript(
Isolate* isolate, Handle<String> source, Isolate* isolate, Handle<String> source,
const ScriptDetails& script_details, ScriptOriginOptions origin_options, const ScriptDetails& script_details, ScriptStreamingData* streaming_data);
ScriptStreamingData* streaming_data);
// Create a shared function info object for the given function literal // Create a shared function info object for the given function literal
// node (the code may be lazily compiled). // node (the code may be lazily compiled).
......
...@@ -29,11 +29,11 @@ namespace { ...@@ -29,11 +29,11 @@ namespace {
static MaybeHandle<SharedFunctionInfo> GetFunctionInfo(Isolate* isolate, static MaybeHandle<SharedFunctionInfo> GetFunctionInfo(Isolate* isolate,
Handle<String> source, Handle<String> source,
REPLMode repl_mode) { REPLMode repl_mode) {
Compiler::ScriptDetails script_details(isolate->factory()->empty_string()); Compiler::ScriptDetails script_details(isolate->factory()->empty_string(),
ScriptOriginOptions(false, true));
script_details.repl_mode = repl_mode; script_details.repl_mode = repl_mode;
ScriptOriginOptions origin_options(false, true);
return Compiler::GetSharedFunctionInfoForScript( return Compiler::GetSharedFunctionInfoForScript(
isolate, source, script_details, origin_options, nullptr, nullptr, isolate, source, script_details, nullptr, nullptr,
ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCacheNoReason, ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCacheNoReason,
NOT_NATIVES_CODE); NOT_NATIVES_CODE);
} }
......
...@@ -757,12 +757,11 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate, ...@@ -757,12 +757,11 @@ MaybeLocal<UnboundScript> CompileInspectorScript(Isolate* v8_isolate,
i::Handle<i::String> str = Utils::OpenHandle(*source); i::Handle<i::String> str = Utils::OpenHandle(*source);
i::Handle<i::SharedFunctionInfo> result; i::Handle<i::SharedFunctionInfo> result;
{ {
ScriptOriginOptions origin_options;
i::ScriptData* script_data = nullptr; i::ScriptData* script_data = nullptr;
i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info = i::MaybeHandle<i::SharedFunctionInfo> maybe_function_info =
i::Compiler::GetSharedFunctionInfoForScript( i::Compiler::GetSharedFunctionInfoForScript(
isolate, str, i::Compiler::ScriptDetails(), origin_options, nullptr, isolate, str, i::Compiler::ScriptDetails(), nullptr, script_data,
script_data, ScriptCompiler::kNoCompileOptions, ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseInspector, ScriptCompiler::kNoCacheBecauseInspector,
i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE i::FLAG_expose_inspector_scripts ? i::NOT_NATIVES_CODE
: i::INSPECTOR_CODE); : i::INSPECTOR_CODE);
......
...@@ -4129,9 +4129,8 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) { ...@@ -4129,9 +4129,8 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
factory->NewStringFromUtf8(name).ToHandleChecked(); factory->NewStringFromUtf8(name).ToHandleChecked();
MaybeHandle<SharedFunctionInfo> maybe_function_info = MaybeHandle<SharedFunctionInfo> maybe_function_info =
Compiler::GetSharedFunctionInfoForScript( Compiler::GetSharedFunctionInfoForScript(
isolate, source, Compiler::ScriptDetails(script_name), isolate, source, Compiler::ScriptDetails(script_name), extension,
ScriptOriginOptions(), extension, nullptr, nullptr, ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheBecauseV8Extension, EXTENSION_CODE); ScriptCompiler::kNoCacheBecauseV8Extension, EXTENSION_CODE);
if (!maybe_function_info.ToHandle(&function_info)) return false; if (!maybe_function_info.ToHandle(&function_info)) return false;
cache->Add(isolate, name, function_info); cache->Add(isolate, name, function_info);
......
...@@ -34,8 +34,7 @@ static Handle<JSFunction> Compile(const char* source) { ...@@ -34,8 +34,7 @@ static Handle<JSFunction> Compile(const char* source) {
.ToHandleChecked(); .ToHandleChecked();
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript( Compiler::GetSharedFunctionInfoForScript(
isolate, source_code, Compiler::ScriptDetails(), isolate, source_code, Compiler::ScriptDetails(), nullptr, nullptr,
v8::ScriptOriginOptions(), nullptr, nullptr,
v8::ScriptCompiler::kNoCompileOptions, v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE) ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked(); .ToHandleChecked();
......
...@@ -72,8 +72,7 @@ static Handle<JSFunction> Compile(const char* source) { ...@@ -72,8 +72,7 @@ static Handle<JSFunction> Compile(const char* source) {
.ToHandleChecked(); .ToHandleChecked();
Handle<SharedFunctionInfo> shared = Handle<SharedFunctionInfo> shared =
Compiler::GetSharedFunctionInfoForScript( Compiler::GetSharedFunctionInfoForScript(
isolate, source_code, Compiler::ScriptDetails(), isolate, source_code, Compiler::ScriptDetails(), nullptr, nullptr,
v8::ScriptOriginOptions(), nullptr, nullptr,
v8::ScriptCompiler::kNoCompileOptions, v8::ScriptCompiler::kNoCompileOptions,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE) ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked(); .ToHandleChecked();
......
...@@ -1573,9 +1573,9 @@ static Handle<SharedFunctionInfo> CompileScript( ...@@ -1573,9 +1573,9 @@ static Handle<SharedFunctionInfo> CompileScript(
Isolate* isolate, Handle<String> source, Handle<String> name, Isolate* isolate, Handle<String> source, Handle<String> name,
ScriptData* cached_data, v8::ScriptCompiler::CompileOptions options) { ScriptData* cached_data, v8::ScriptCompiler::CompileOptions options) {
return Compiler::GetSharedFunctionInfoForScript( return Compiler::GetSharedFunctionInfoForScript(
isolate, source, Compiler::ScriptDetails(name), isolate, source, Compiler::ScriptDetails(name), nullptr,
v8::ScriptOriginOptions(), nullptr, cached_data, options, cached_data, options, ScriptCompiler::kNoCacheNoReason,
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE) NOT_NATIVES_CODE)
.ToHandleChecked(); .ToHandleChecked();
} }
...@@ -1584,9 +1584,8 @@ static Handle<SharedFunctionInfo> CompileScriptAndProduceCache( ...@@ -1584,9 +1584,8 @@ static Handle<SharedFunctionInfo> CompileScriptAndProduceCache(
ScriptData** script_data, v8::ScriptCompiler::CompileOptions options) { ScriptData** script_data, v8::ScriptCompiler::CompileOptions options) {
Handle<SharedFunctionInfo> sfi = Handle<SharedFunctionInfo> sfi =
Compiler::GetSharedFunctionInfoForScript( Compiler::GetSharedFunctionInfoForScript(
isolate, source, Compiler::ScriptDetails(name), isolate, source, Compiler::ScriptDetails(name), nullptr, nullptr,
v8::ScriptOriginOptions(), nullptr, nullptr, options, options, ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
ScriptCompiler::kNoCacheNoReason, NOT_NATIVES_CODE)
.ToHandleChecked(); .ToHandleChecked();
std::unique_ptr<ScriptCompiler::CachedData> cached_data( std::unique_ptr<ScriptCompiler::CachedData> cached_data(
ScriptCompiler::CreateCodeCache(ToApiHandle<UnboundScript>(sfi))); ScriptCompiler::CreateCodeCache(ToApiHandle<UnboundScript>(sfi)));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment