Commit 46bd989a authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[compiler] Unify naming of methods in compiler API.

This is a pure refactoring and renaming of methods in the compiler API
with the goal to increase readability. Also the compiler API is moved to
the top of the file, as it is the central piece in that file.

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/1766623004

Cr-Commit-Position: refs/heads/master@{#34579}
parent 33ffced5
...@@ -1784,7 +1784,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal( ...@@ -1784,7 +1784,7 @@ MaybeLocal<UnboundScript> ScriptCompiler::CompileUnboundInternal(
if (!source->source_map_url.IsEmpty()) { if (!source->source_map_url.IsEmpty()) {
source_map_url = Utils::OpenHandle(*(source->source_map_url)); source_map_url = Utils::OpenHandle(*(source->source_map_url));
} }
result = i::Compiler::CompileScript( result = i::Compiler::GetSharedFunctionInfoForScript(
str, name_obj, line_offset, column_offset, source->resource_options, str, name_obj, line_offset, column_offset, source->resource_options,
source_map_url, isolate->native_context(), NULL, &script_data, options, source_map_url, isolate->native_context(), NULL, &script_data, options,
i::NOT_NATIVES_CODE, is_module); i::NOT_NATIVES_CODE, is_module);
...@@ -2051,8 +2051,8 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context, ...@@ -2051,8 +2051,8 @@ MaybeLocal<Script> ScriptCompiler::Compile(Local<Context> context,
i::Handle<i::SharedFunctionInfo> result; i::Handle<i::SharedFunctionInfo> result;
if (source->info->literal() != nullptr) { if (source->info->literal() != nullptr) {
// Parsing has succeeded. // Parsing has succeeded.
result = i::Compiler::CompileStreamedScript(script, source->info.get(), result = i::Compiler::GetSharedFunctionInfoForStreamedScript(
str->length()); script, source->info.get(), str->length());
} }
has_pending_exception = result.is_null(); has_pending_exception = result.is_null();
if (has_pending_exception) isolate->ReportPendingMessages(); if (has_pending_exception) isolate->ReportPendingMessages();
......
...@@ -1885,10 +1885,11 @@ bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name, ...@@ -1885,10 +1885,11 @@ bool Bootstrapper::CompileNative(Isolate* isolate, Vector<const char> name,
Handle<String> script_name = Handle<String> script_name =
isolate->factory()->NewStringFromUtf8(name).ToHandleChecked(); isolate->factory()->NewStringFromUtf8(name).ToHandleChecked();
Handle<SharedFunctionInfo> function_info = Compiler::CompileScript( Handle<SharedFunctionInfo> function_info =
source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), Compiler::GetSharedFunctionInfoForScript(
context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag, source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
false); context, NULL, NULL, ScriptCompiler::kNoCompileOptions, natives_flag,
false);
if (function_info.is_null()) return false; if (function_info.is_null()) return false;
DCHECK(context->IsNativeContext()); DCHECK(context->IsNativeContext());
...@@ -1942,7 +1943,7 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) { ...@@ -1942,7 +1943,7 @@ bool Genesis::CompileExtension(Isolate* isolate, v8::Extension* extension) {
if (!cache->Lookup(name, &function_info)) { if (!cache->Lookup(name, &function_info)) {
Handle<String> script_name = Handle<String> script_name =
factory->NewStringFromUtf8(name).ToHandleChecked(); factory->NewStringFromUtf8(name).ToHandleChecked();
function_info = Compiler::CompileScript( function_info = Compiler::GetSharedFunctionInfoForScript(
source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(), source, script_name, 0, 0, ScriptOriginOptions(), Handle<Object>(),
context, extension, NULL, ScriptCompiler::kNoCompileOptions, context, extension, NULL, ScriptCompiler::kNoCompileOptions,
EXTENSION_CODE, false); EXTENSION_CODE, false);
......
...@@ -1547,8 +1547,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval( ...@@ -1547,8 +1547,7 @@ MaybeHandle<JSFunction> Compiler::GetFunctionFromEval(
return result; return result;
} }
Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForScript(
Handle<SharedFunctionInfo> Compiler::CompileScript(
Handle<String> source, Handle<Object> script_name, int line_offset, Handle<String> source, Handle<Object> script_name, int line_offset,
int column_offset, ScriptOriginOptions resource_options, int column_offset, ScriptOriginOptions resource_options,
Handle<Object> source_map_url, Handle<Context> context, Handle<Object> source_map_url, Handle<Context> context,
...@@ -1683,8 +1682,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript( ...@@ -1683,8 +1682,7 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
return result; return result;
} }
Handle<SharedFunctionInfo> Compiler::GetSharedFunctionInfoForStreamedScript(
Handle<SharedFunctionInfo> Compiler::CompileStreamedScript(
Handle<Script> script, ParseInfo* parse_info, int source_length) { Handle<Script> script, ParseInfo* parse_info, int source_length) {
Isolate* isolate = script->GetIsolate(); Isolate* isolate = script->GetIsolate();
// TODO(titzer): increment the counters in caller. // TODO(titzer): increment the counters in caller.
......
This diff is collapsed.
...@@ -30,12 +30,12 @@ static Handle<JSFunction> Compile(const char* source) { ...@@ -30,12 +30,12 @@ static Handle<JSFunction> Compile(const char* source) {
Handle<String> source_code = isolate->factory() Handle<String> source_code = isolate->factory()
->NewStringFromUtf8(CStrVector(source)) ->NewStringFromUtf8(CStrVector(source))
.ToHandleChecked(); .ToHandleChecked();
Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript( Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript(
source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(),
Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL,
v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false);
return isolate->factory()->NewFunctionFromSharedFunctionInfo( return isolate->factory()->NewFunctionFromSharedFunctionInfo(
shared_function, isolate->native_context()); shared, isolate->native_context());
} }
......
...@@ -59,12 +59,12 @@ static Handle<JSFunction> Compile(const char* source) { ...@@ -59,12 +59,12 @@ static Handle<JSFunction> Compile(const char* source) {
Isolate* isolate = CcTest::i_isolate(); Isolate* isolate = CcTest::i_isolate();
Handle<String> source_code = isolate->factory()->NewStringFromUtf8( Handle<String> source_code = isolate->factory()->NewStringFromUtf8(
CStrVector(source)).ToHandleChecked(); CStrVector(source)).ToHandleChecked();
Handle<SharedFunctionInfo> shared_function = Compiler::CompileScript( Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript(
source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), source_code, Handle<String>(), 0, 0, v8::ScriptOriginOptions(),
Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL, Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, NULL,
v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false); v8::ScriptCompiler::kNoCompileOptions, NOT_NATIVES_CODE, false);
return isolate->factory()->NewFunctionFromSharedFunctionInfo( return isolate->factory()->NewFunctionFromSharedFunctionInfo(
shared_function, isolate->native_context()); shared, isolate->native_context());
} }
......
...@@ -896,7 +896,7 @@ int CountBuiltins() { ...@@ -896,7 +896,7 @@ int CountBuiltins() {
static Handle<SharedFunctionInfo> CompileScript( 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::CompileScript( return Compiler::GetSharedFunctionInfoForScript(
source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(), source, name, 0, 0, v8::ScriptOriginOptions(), Handle<Object>(),
Handle<Context>(isolate->native_context()), NULL, cached_data, options, Handle<Context>(isolate->native_context()), NULL, cached_data, options,
NOT_NATIVES_CODE, false); NOT_NATIVES_CODE, false);
...@@ -1761,7 +1761,7 @@ TEST(Regress503552) { ...@@ -1761,7 +1761,7 @@ TEST(Regress503552) {
Handle<String> source = isolate->factory()->NewStringFromAsciiChecked( Handle<String> source = isolate->factory()->NewStringFromAsciiChecked(
"function f() {} function g() {}"); "function f() {} function g() {}");
ScriptData* script_data = NULL; ScriptData* script_data = NULL;
Handle<SharedFunctionInfo> shared = Compiler::CompileScript( Handle<SharedFunctionInfo> shared = Compiler::GetSharedFunctionInfoForScript(
source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(), source, Handle<String>(), 0, 0, v8::ScriptOriginOptions(),
Handle<Object>(), Handle<Context>(isolate->native_context()), NULL, Handle<Object>(), Handle<Context>(isolate->native_context()), NULL,
&script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE, &script_data, v8::ScriptCompiler::kProduceCodeCache, NOT_NATIVES_CODE,
......
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