Revision: 22596
Author:   [email protected]
Date:     Thu Jul 24 12:11:30 2014 UTC
Log: Flag for serialization when compiling code stubs if --serialize-toplevel.

[email protected]
BUG=v8:3465
LOG=N

Review URL: https://codereview.chromium.org/419503002
http://code.google.com/p/v8/source/detail?r=22596

Modified:
 /branches/bleeding_edge/src/code-stubs-hydrogen.cc
 /branches/bleeding_edge/src/code-stubs.cc
 /branches/bleeding_edge/src/compiler.h
 /branches/bleeding_edge/test/cctest/cctest.status
 /branches/bleeding_edge/test/cctest/test-serialize.cc

=======================================
--- /branches/bleeding_edge/src/code-stubs-hydrogen.cc Thu Jul 17 11:50:04 2014 UTC +++ /branches/bleeding_edge/src/code-stubs-hydrogen.cc Thu Jul 24 12:11:30 2014 UTC
@@ -270,6 +270,8 @@
   }
   CodeStubGraphBuilder<Stub> builder(isolate, stub);
   LChunk* chunk = OptimizeGraph(builder.CreateGraph());
+  // TODO(yangguo) remove this once the code serializer handles code stubs.
+  if (FLAG_serialize_toplevel) chunk->info()->PrepareForSerializing();
   Handle<Code> code = chunk->Codegen();
   if (FLAG_profile_hydrogen_code_stub_compilation) {
     OFStream os(stdout);
=======================================
--- /branches/bleeding_edge/src/code-stubs.cc   Wed Jul 23 11:16:29 2014 UTC
+++ /branches/bleeding_edge/src/code-stubs.cc   Thu Jul 24 12:11:30 2014 UTC
@@ -149,6 +149,9 @@
   // Generate the new code.
   MacroAssembler masm(isolate(), NULL, 256);

+  // TODO(yangguo) remove this once the code serializer handles code stubs.
+  if (FLAG_serialize_toplevel) masm.enable_serializer();
+
   {
     // Update the static counter each time a new code stub is generated.
     isolate()->counters()->code_stubs()->Increment();
=======================================
--- /branches/bleeding_edge/src/compiler.h      Wed Jul 23 09:35:06 2014 UTC
+++ /branches/bleeding_edge/src/compiler.h      Thu Jul 24 12:11:30 2014 UTC
@@ -184,7 +184,6 @@
   }

   void PrepareForSerializing() {
-    ASSERT(!is_lazy());
     flags_ |= PrepareForSerializing::encode(true);
   }

=======================================
--- /branches/bleeding_edge/test/cctest/cctest.status Thu Jul 24 11:16:01 2014 UTC +++ /branches/bleeding_edge/test/cctest/cctest.status Thu Jul 24 12:11:30 2014 UTC
@@ -32,9 +32,6 @@

##############################################################################

-  # BUG(3465): SerializeToplevelIsolates crashes.
-  'test-serialize/SerializeToplevelIsolates': [SKIP],
-
   # BUG(382): Weird test. Can't guarantee that it never times out.
   'test-api/ApplyInterruption': [PASS, TIMEOUT],

=======================================
--- /branches/bleeding_edge/test/cctest/test-serialize.cc Wed Jul 23 07:16:32 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-serialize.cc Thu Jul 24 12:11:30 2014 UTC
@@ -799,18 +799,19 @@
   const char* source = "function f() { return 'abc'; }; f() + 'def'";
   v8::ScriptCompiler::CachedData* cache;

-  v8::Isolate* isolate = v8::Isolate::New();
+  v8::Isolate* isolate1 = v8::Isolate::New();
+  v8::Isolate* isolate2 = v8::Isolate::New();
   {
-    v8::Isolate::Scope iscope(isolate);
-    v8::HandleScope scope(isolate);
-    v8::Local<v8::Context> context = v8::Context::New(isolate);
+    v8::Isolate::Scope iscope(isolate1);
+    v8::HandleScope scope(isolate1);
+    v8::Local<v8::Context> context = v8::Context::New(isolate1);
     v8::Context::Scope context_scope(context);

     v8::Local<v8::String> source_str = v8_str(source);
     v8::ScriptOrigin origin(v8_str("test"));
     v8::ScriptCompiler::Source source(source_str, origin);
v8::Local<v8::UnboundScript> script = v8::ScriptCompiler::CompileUnbound(
-        isolate, &source, v8::ScriptCompiler::kProduceCodeCache);
+        isolate1, &source, v8::ScriptCompiler::kProduceCodeCache);
     const v8::ScriptCompiler::CachedData* data = source.GetCachedData();
     // Persist cached data.
     uint8_t* buffer = NewArray<uint8_t>(data->length);
@@ -821,13 +822,12 @@
     v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
     CHECK(result->ToString()->Equals(v8_str("abcdef")));
   }
-  isolate->Dispose();
+  isolate1->Dispose();

-  isolate = v8::Isolate::New();
   {
-    v8::Isolate::Scope iscope(isolate);
-    v8::HandleScope scope(isolate);
-    v8::Local<v8::Context> context = v8::Context::New(isolate);
+    v8::Isolate::Scope iscope(isolate2);
+    v8::HandleScope scope(isolate2);
+    v8::Local<v8::Context> context = v8::Context::New(isolate2);
     v8::Context::Scope context_scope(context);

     v8::Local<v8::String> source_str = v8_str(source);
@@ -835,12 +835,12 @@
     v8::ScriptCompiler::Source source(source_str, origin, cache);
     v8::Local<v8::UnboundScript> script;
     {
-      DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate));
+      DisallowCompilation no_compile(reinterpret_cast<Isolate*>(isolate2));
       script = v8::ScriptCompiler::CompileUnbound(
-          isolate, &source, v8::ScriptCompiler::kConsumeCodeCache);
+          isolate2, &source, v8::ScriptCompiler::kConsumeCodeCache);
     }
     v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
     CHECK(result->ToString()->Equals(v8_str("abcdef")));
   }
-  isolate->Dispose();
+  isolate2->Dispose();
 }

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to