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

Unified Diff: src/compiler.cc

Issue 373713006: Introduce code serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments and rebased Created 6 years, 5 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/assembler.h ('k') | src/flag-definitions.h » ('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 92f8c11a190921e96674e795e63032f3374d24b0..2b451501f02b3d01ef2462daf213ad518df75ed6 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -933,9 +933,11 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
cached_data = NULL;
} else if (cached_data_mode == PRODUCE_CACHED_DATA) {
ASSERT(cached_data && !*cached_data);
+ ASSERT(extension == NULL);
} else {
ASSERT(cached_data_mode == CONSUME_CACHED_DATA);
ASSERT(cached_data && *cached_data);
+ ASSERT(extension == NULL);
}
Isolate* isolate = source->GetIsolate();
int source_length = source->length();
@@ -951,6 +953,11 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
maybe_result = compilation_cache->LookupScript(
source, script_name, line_offset, column_offset,
is_shared_cross_origin, context);
+ if (maybe_result.is_null() && FLAG_serialize_toplevel &&
+ cached_data_mode == CONSUME_CACHED_DATA) {
+ Object* des = CodeSerializer::Deserialize(isolate, *cached_data);
+ return handle(SharedFunctionInfo::cast(des), isolate);
+ }
}
if (!maybe_result.ToHandle(&result)) {
@@ -971,17 +978,21 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
// Compile the function and add it to the cache.
CompilationInfoWithZone info(script);
info.MarkAsGlobal();
- info.SetExtension(extension);
info.SetCachedData(cached_data, cached_data_mode);
+ info.SetExtension(extension);
info.SetContext(context);
if (FLAG_use_strict) info.SetStrictMode(STRICT);
+
result = CompileToplevel(&info);
if (extension == NULL && !result.is_null() && !result->dont_cache()) {
compilation_cache->PutScript(source, context, result);
+ if (FLAG_serialize_toplevel && cached_data_mode == PRODUCE_CACHED_DATA) {
+ *cached_data = CodeSerializer::Serialize(result);
+ }
}
if (result.is_null()) isolate->ReportPendingMessages();
} else if (result->ic_age() != isolate->heap()->global_ic_age()) {
- result->ResetForNewContext(isolate->heap()->global_ic_age());
+ result->ResetForNewContext(isolate->heap()->global_ic_age());
}
return result;
}
« no previous file with comments | « src/assembler.h ('k') | src/flag-definitions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698