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

Unified Diff: src/compiler.cc

Issue 1372293005: [Interpreter] Support top-level code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add Todos. Created 5 years, 2 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 | « src/compiler.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index a368f29810bde90f624fe77ffcca11c18455b63a..d9e6849d5082ec491a00beac2de3642bd31ae024 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -746,6 +746,10 @@ MUST_USE_RESULT static MaybeHandle<Code> GetUnoptimizedCodeCommon(
// Update the code and feedback vector for the shared function info.
shared->ReplaceCode(*info->code());
shared->set_feedback_vector(*info->feedback_vector());
+ if (info->has_bytecode_array()) {
+ DCHECK(shared->function_data()->IsUndefined());
+ shared->set_function_data(*info->bytecode_array());
+ }
return info->code();
}
@@ -1204,9 +1208,20 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
: info->isolate()->counters()->compile();
HistogramTimerScope timer(rate);
+ Handle<String> script_name =
+ script->name()->IsString()
+ ? Handle<String>(String::cast(script->name()))
+ : isolate->factory()->empty_string();
+
// Compile the code.
- if (!CompileUnoptimizedCode(info)) {
- return Handle<SharedFunctionInfo>::null();
+ if (FLAG_ignition && script_name->PassesFilter(FLAG_ignition_filter)) {
+ if (!GenerateBytecode(info)) {
+ return Handle<SharedFunctionInfo>::null();
+ }
+ } else {
+ if (!CompileUnoptimizedCode(info)) {
+ return Handle<SharedFunctionInfo>::null();
+ }
}
// Allocate function.
@@ -1216,6 +1231,10 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
info->code(),
ScopeInfo::Create(info->isolate(), info->zone(), info->scope()),
info->feedback_vector());
+ if (info->has_bytecode_array()) {
+ DCHECK(result->function_data()->IsUndefined());
+ result->set_function_data(*info->bytecode_array());
+ }
DCHECK_EQ(RelocInfo::kNoPosition, lit->function_token_position());
SharedFunctionInfo::InitFromFunctionLiteral(result, lit);
@@ -1226,9 +1245,6 @@ static Handle<SharedFunctionInfo> CompileToplevel(CompilationInfo* info) {
result->set_allows_lazy_compilation_without_context(false);
}
- Handle<String> script_name = script->name()->IsString()
- ? Handle<String>(String::cast(script->name()))
- : isolate->factory()->empty_string();
Logger::LogEventsAndTags log_tag = info->is_eval()
? Logger::EVAL_TAG
: Logger::ToNativeByScript(Logger::SCRIPT_TAG, *script);
« no previous file with comments | « src/compiler.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698