Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(41)

Unified Diff: src/api.cc

Issue 2611643002: [modules] Add an IsModule flag to ScriptOriginOptions. (Closed)
Patch Set: Remove convenience function from API. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index 0418c08ff6c24aa02d74e7326c2c26989dc829c0..32ba1269d0386aca969d256aacde0c6667e55730 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -283,7 +283,8 @@ static ScriptOrigin GetScriptOriginForScript(i::Isolate* isolate,
v8::Integer::New(v8_isolate, script->id()),
Utils::ToLocal(source_map_url),
v8::Boolean::New(v8_isolate, options.IsOpaque()),
- v8::Boolean::New(v8_isolate, script->type() == i::Script::TYPE_WASM));
+ v8::Boolean::New(v8_isolate, script->type() == i::Script::TYPE_WASM),
+ v8::Boolean::New(v8_isolate, options.IsModule()));
return origin;
}
@@ -2103,8 +2104,7 @@ MaybeLocal<Value> Module::Evaluate(Local<Context> context) {
}
MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
- Isolate* v8_isolate, Source* source, CompileOptions options,
- bool is_module) {
+ Isolate* v8_isolate, Source* source, CompileOptions options) {
i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
PREPARE_FOR_EXECUTION_WITH_ISOLATE(isolate, ScriptCompiler, CompileUnbound,
UnboundScript);
@@ -2149,7 +2149,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
result = i::Compiler::GetSharedFunctionInfoForScript(
str, name_obj, line_offset, column_offset, source->resource_options,
source_map_url, isolate->native_context(), NULL, &script_data, options,
- i::NOT_NATIVES_CODE, is_module);
+ i::NOT_NATIVES_CODE);
has_pending_exception = result.is_null();
if (has_pending_exception && script_data != NULL) {
// This case won't happen during normal operation; we have compiled
@@ -2178,24 +2178,26 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundScript(
Isolate* v8_isolate, Source* source, CompileOptions options) {
- return CompileUnboundInternal(v8_isolate, source, options, false);
+ DCHECK(!source->GetResourceOptions().IsModule());
+ return CompileUnboundInternal(v8_isolate, source, options);
}
Local<UnboundScript> ScriptCompiler::CompileUnbound(Isolate* v8_isolate,
Source* source,
CompileOptions options) {
- RETURN_TO_LOCAL_UNCHECKED(
- CompileUnboundInternal(v8_isolate, source, options, false),
- UnboundScript);
+ DCHECK(!source->GetResourceOptions().IsModule());
+ RETURN_TO_LOCAL_UNCHECKED(CompileUnboundInternal(v8_isolate, source, options),
+ UnboundScript);
}
MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
Source* source,
CompileOptions options) {
+ DCHECK(!source->GetResourceOptions().IsModule());
auto isolate = context->GetIsolate();
- auto maybe = CompileUnboundInternal(isolate, source, options, false);
+ auto maybe = CompileUnboundInternal(isolate, source, options);
Local<UnboundScript> result;
if (!maybe.ToLocal(&result)) return MaybeLocal<Script>();
v8::Context::Scope scope(context);
@@ -2215,7 +2217,8 @@ MaybeLocal<Module> ScriptCompiler::CompileModule(Isolate* isolate,
Source* source) {
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(isolate);
- auto maybe = CompileUnboundInternal(isolate, source, kNoCompileOptions, true);
+ DCHECK(source->GetResourceOptions().IsModule());
+ auto maybe = CompileUnboundInternal(isolate, source, kNoCompileOptions);
Local<UnboundScript> unbound;
if (!maybe.ToLocal(&unbound)) return MaybeLocal<Module>();
@@ -9344,7 +9347,7 @@ MaybeLocal<UnboundScript> debug::CompileInspectorScript(Isolate* v8_isolate,
result = i::Compiler::GetSharedFunctionInfoForScript(
str, i::Handle<i::Object>(), 0, 0, origin_options,
i::Handle<i::Object>(), isolate->native_context(), NULL, &script_data,
- ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE, false);
+ ScriptCompiler::kNoCompileOptions, i::INSPECTOR_CODE);
has_pending_exception = result.is_null();
RETURN_ON_FAILED_EXECUTION(UnboundScript);
}
« no previous file with comments | « include/v8.h ('k') | src/bootstrapper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698