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

Unified Diff: src/compiler.cc

Issue 373713006: Introduce code serializer/deserializer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 92f8c11a190921e96674e795e63032f3374d24b0..b8a189fd2a8f077da7bc63d0910f60b680abaf19 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -948,6 +948,10 @@ Handle<SharedFunctionInfo> Compiler::CompileScript(
MaybeHandle<SharedFunctionInfo> maybe_result;
Handle<SharedFunctionInfo> result;
if (extension == NULL) {
+ if (FLAG_serialize_toplevel && cached_data_mode == CONSUME_CACHED_DATA) {
+ Object* des = CodeSerializer::Deserialize(isolate, *cached_data);
+ return handle(SharedFunctionInfo::cast(des), isolate);
+ }
vogelheim 2014/07/07 15:20:00 [For my understanding; not criticism:] Why is thi
Yang 2014/07/08 09:01:05 You got a point. I reordered this. However, I thin
maybe_result = compilation_cache->LookupScript(
source, script_name, line_offset, column_offset,
is_shared_cross_origin, context);
@@ -971,17 +975,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') | src/flag-definitions.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698