From 33dc53f9cc709862de641d32c9a412cf7cfce953 Mon Sep 17 00:00:00 2001 From: "yangguo@chromium.org" Date: Mon, 13 Oct 2014 07:50:21 +0000 Subject: [PATCH] Always include full reloc info to stubs for serialization. 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 | 2 ++ src/code-stubs.cc | 2 ++ src/execution.cc | 16 ++++++++++++++++ src/objects-inl.h | 1 + src/objects.h | 4 ++++ src/serialize.cc | 4 +++- 6 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/code-stubs-hydrogen.cc b/src/code-stubs-hydrogen.cc index 80fff3f..63488dc 100644 --- a/src/code-stubs-hydrogen.cc +++ b/src/code-stubs-hydrogen.cc @@ -233,6 +233,8 @@ Handle 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); } diff --git a/src/code-stubs.cc b/src/code-stubs.cc index 357324b..9832650 100644 --- a/src/code-stubs.cc +++ b/src/code-stubs.cc @@ -111,6 +111,8 @@ Handle 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); } diff --git a/src/execution.cc b/src/execution.cc index 7aa4f33..461685a 100644 --- a/src/execution.cc +++ b/src/execution.cc @@ -34,6 +34,21 @@ void StackGuard::reset_limits(const ExecutionAccess& lock) { } +static PrintDeserializedCodeInfo(Handle 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 Invoke( bool is_construct, Handle function, @@ -87,6 +102,7 @@ MUST_USE_RESULT static MaybeHandle Invoke( JSFunction* func = *function; Object* recv = *receiver; Object*** argv = reinterpret_cast(args); + if (FLAG_profile_deserialization) PrintDeserializedCodeInfo(function); value = CALL_GENERATED_CODE(stub_entry, function_entry, func, recv, argc, argv); } diff --git a/src/objects-inl.h b/src/objects-inl.h index cff5b61..0de3210 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 diff --git a/src/objects.h b/src/objects.h index 277df06..c5e036a 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 }; diff --git a/src/serialize.cc b/src/serialize.cc index c287219..70b69c2 100644 --- a/src/serialize.cc +++ b/src/serialize.cc @@ -2140,7 +2140,9 @@ Handle CodeSerializer::Deserialize(Isolate* isolate, int length = data->length(); PrintF("[Deserializing from %d bytes took %0.3f ms]\n", length, ms); } - return Handle(SharedFunctionInfo::cast(root), isolate); + Handle result(SharedFunctionInfo::cast(root), isolate); + result->set_deserialized(true); + return result; } -- 2.7.4