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

Unified Diff: src/api.cc

Issue 1000063002: Hide RegExp and String initialization in a closure. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: address comments Created 5 years, 9 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 | « no previous file | src/i18n.js » ('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 f285980f6b654d289e82f62bd4963b3c1ccab1a9..baf3ffa1dfb4e049ecbdd202262e0088fd0e0f22 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -328,6 +328,8 @@ void V8::SetSnapshotDataBlob(StartupData* snapshot_blob) {
bool RunExtraCode(Isolate* isolate, const char* utf8_source) {
// Run custom script if provided.
+ base::ElapsedTimer timer;
+ timer.Start();
TryCatch try_catch;
Local<String> source_string = String::NewFromUtf8(isolate, utf8_source);
if (try_catch.HasCaught()) return false;
@@ -336,6 +338,11 @@ bool RunExtraCode(Isolate* isolate, const char* utf8_source) {
Local<Script> script = ScriptCompiler::Compile(isolate, &source);
if (try_catch.HasCaught()) return false;
script->Run();
+ if (i::FLAG_profile_deserialization) {
+ i::PrintF("Executing custom snapshot script took %0.3f ms\n",
+ timer.Elapsed().InMillisecondsF());
+ }
+ timer.Stop();
return !try_catch.HasCaught();
}
@@ -345,6 +352,8 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) {
Isolate* isolate = reinterpret_cast<Isolate*>(internal_isolate);
StartupData result = {NULL, 0};
{
+ base::ElapsedTimer timer;
+ timer.Start();
Isolate::Scope isolate_scope(isolate);
internal_isolate->Init(NULL);
Persistent<Context> context;
@@ -384,6 +393,11 @@ StartupData V8::CreateSnapshotDataBlob(const char* custom_source) {
result = i::Snapshot::CreateSnapshotBlob(ser, context_ser, metadata);
}
+ if (i::FLAG_profile_deserialization) {
+ i::PrintF("Creating snapshot took %0.3f ms\n",
+ timer.Elapsed().InMillisecondsF());
+ }
+ timer.Stop();
}
isolate->Dispose();
return result;
« no previous file with comments | « no previous file | src/i18n.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698