Always include full reloc info to stubs for serialization.
authoryangguo@chromium.org <yangguo@chromium.org>
Mon, 13 Oct 2014 07:50:21 +0000 (07:50 +0000)
committeryangguo@chromium.org <yangguo@chromium.org>
Mon, 13 Oct 2014 07:50:21 +0000 (07:50 +0000)
R=mvstanton@chromium.org

Review URL: https://codereview.chromium.org/641643006

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24543 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/code-stubs-hydrogen.cc
src/code-stubs.cc
src/execution.cc
src/objects-inl.h
src/objects.h
src/serialize.cc

index 80fff3f..63488dc 100644 (file)
@@ -233,6 +233,8 @@ Handle<Code> HydrogenCodeStub::GenerateLightweightMissCode(
 
     // Generate the code for the stub.
     masm.set_generating_stub(true);
+    // TODO(yangguo): remove this once we can serialize IC stubs.
+    masm.enable_serializer();
     NoCurrentFrameScope scope(&masm);
     GenerateLightweightMiss(&masm, miss);
   }
index 357324b..9832650 100644 (file)
@@ -111,6 +111,8 @@ Handle<Code> PlatformCodeStub::GenerateCode() {
 
     // Generate the code for the stub.
     masm.set_generating_stub(true);
+    // TODO(yangguo): remove this once we can serialize IC stubs.
+    masm.enable_serializer();
     NoCurrentFrameScope scope(&masm);
     Generate(&masm);
   }
index 7aa4f33..461685a 100644 (file)
@@ -34,6 +34,21 @@ void StackGuard::reset_limits(const ExecutionAccess& lock) {
 }
 
 
+static PrintDeserializedCodeInfo(Handle<JSFunction> function) {
+  if (function->code() == function->shared()->code() &&
+      function->shared()->deserialized()) {
+    PrintF("Running deserialized script: ");
+    Object* script = function->shared()->script();
+    if (script->IsScript()) {
+      Script::cast(script)->name()->ShortPrint();
+    } else {
+      function->shared()->script()->ShortPrint();
+    }
+    PrintF("\n");
+  }
+}
+
+
 MUST_USE_RESULT static MaybeHandle<Object> Invoke(
     bool is_construct,
     Handle<JSFunction> function,
@@ -87,6 +102,7 @@ MUST_USE_RESULT static MaybeHandle<Object> Invoke(
     JSFunction* func = *function;
     Object* recv = *receiver;
     Object*** argv = reinterpret_cast<Object***>(args);
+    if (FLAG_profile_deserialization) PrintDeserializedCodeInfo(function);
     value =
         CALL_GENERATED_CODE(stub_entry, function_entry, func, recv, argc, argv);
   }
index cff5b61..0de3210 100644 (file)
@@ -5465,6 +5465,7 @@ BOOL_ACCESSORS(SharedFunctionInfo,
                has_duplicate_parameters,
                kHasDuplicateParameters)
 BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, asm_function, kIsAsmFunction)
+BOOL_ACCESSORS(SharedFunctionInfo, compiler_hints, deserialized, kDeserialized)
 
 
 #if V8_HOST_ARCH_32_BIT
index 277df06..c5e036a 100644 (file)
@@ -6821,6 +6821,9 @@ class SharedFunctionInfo: public HeapObject {
   // Indicates that this function is an asm function.
   DECL_BOOLEAN_ACCESSORS(asm_function)
 
+  // Indicates that the the shared function info is deserialized from cache.
+  DECL_BOOLEAN_ACCESSORS(deserialized)
+
   inline FunctionKind kind();
   inline void set_kind(FunctionKind kind);
 
@@ -7053,6 +7056,7 @@ class SharedFunctionInfo: public HeapObject {
     kIsGenerator,
     kIsConciseMethod,
     kIsAsmFunction,
+    kDeserialized,
     kCompilerHintsCount  // Pseudo entry
   };
 
index c287219..70b69c2 100644 (file)
@@ -2140,7 +2140,9 @@ Handle<SharedFunctionInfo> CodeSerializer::Deserialize(Isolate* isolate,
     int length = data->length();
     PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms);
   }
-  return Handle<SharedFunctionInfo>(SharedFunctionInfo::cast(root), isolate);
+  Handle<SharedFunctionInfo> result(SharedFunctionInfo::cast(root), isolate);
+  result->set_deserialized(true);
+  return result;
 }