Reviewers: mvstanton,

Description:
Always include full reloc info to stubs for serialization.

[email protected]

Please review this at https://codereview.chromium.org/641643006/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+28, -1 lines):
  M src/code-stubs.cc
  M src/code-stubs-hydrogen.cc
  M src/execution.cc
  M src/objects.h
  M src/objects-inl.h
  M src/serialize.cc


Index: src/code-stubs-hydrogen.cc
diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc
index 80fff3f26237cd3941eee70bf70434b875299adc..63488dc2b2d9362b270588a28c340ad17ac166df 100644
--- a/src/code-stubs-hydrogen.cc
+++ b/src/code-stubs-hydrogen.cc
@@ -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: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index 357324b9037398e2294fa304f15d6903e079001b..9832650f42d40d96c399725cf5df15657caecc21 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -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: src/execution.cc
diff --git a/src/execution.cc b/src/execution.cc
index 7aa4f3341d68a4bfd3c569f4537df3db8593f3a4..461685a1bbfba436ad9950a98d0cf23e5b32c43f 100644
--- a/src/execution.cc
+++ b/src/execution.cc
@@ -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: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index cff5b61b527bec83db46b2efbc99d85898e0a1ae..0de32103907e1c06b51e89bdec22ef0699a9e49e 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -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: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index 277df06ccac555344997191744076506f6e2ee20..c5e036ae6e6137cd9ff23a4608b7ec7718d837c8 100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -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: src/serialize.cc
diff --git a/src/serialize.cc b/src/serialize.cc
index c28721900f7f7a96ff90ed5ea72e5cf939b62388..70b69c23c0dc01beeda05d4bcb2532584df4b5a6 100644
--- a/src/serialize.cc
+++ b/src/serialize.cc
@@ -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;
 }




--
--
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