Log code event for deserialized code.
R=mvstanton@chromium.org Review URL: https://codereview.chromium.org/663453005 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24861 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
eb1aa6aee3
commit
e6ac285bd3
@ -2245,6 +2245,18 @@ MaybeHandle<SharedFunctionInfo> CodeSerializer::Deserialize(
|
||||
}
|
||||
Handle<SharedFunctionInfo> result(SharedFunctionInfo::cast(root), isolate);
|
||||
result->set_deserialized(true);
|
||||
|
||||
if (isolate->logger()->is_logging_code_events() ||
|
||||
isolate->cpu_profiler()->is_profiling()) {
|
||||
String* name = isolate->heap()->empty_string();
|
||||
if (result->script()->IsScript()) {
|
||||
Script* script = Script::cast(result->script());
|
||||
if (script->name()->IsString()) name = String::cast(script->name());
|
||||
}
|
||||
isolate->logger()->CodeCreateEvent(Logger::SCRIPT_TAG, result->code(),
|
||||
*result, NULL, name);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -700,9 +700,7 @@ class CodeSerializer : public Serializer {
|
||||
: Serializer(isolate, sink),
|
||||
source_(source),
|
||||
main_code_(main_code),
|
||||
num_internalized_strings_(0) {
|
||||
InitializeCodeAddressMap();
|
||||
}
|
||||
num_internalized_strings_(0) {}
|
||||
|
||||
virtual void SerializeObject(HeapObject* o, HowToCode how_to_code,
|
||||
WhereToPoint where_to_point, int skip);
|
||||
|
@ -1156,6 +1156,17 @@ TEST(SerializeToplevelExternalScriptName) {
|
||||
}
|
||||
|
||||
|
||||
static bool toplevel_test_code_event_found = false;
|
||||
|
||||
|
||||
static void SerializerCodeEventListener(const v8::JitCodeEvent* event) {
|
||||
if (event->type == v8::JitCodeEvent::CODE_ADDED &&
|
||||
memcmp(event->name.str, "Script:~test", 12) == 0) {
|
||||
toplevel_test_code_event_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
TEST(SerializeToplevelIsolates) {
|
||||
FLAG_serialize_toplevel = true;
|
||||
|
||||
@ -1188,6 +1199,9 @@ TEST(SerializeToplevelIsolates) {
|
||||
isolate1->Dispose();
|
||||
|
||||
v8::Isolate* isolate2 = v8::Isolate::New();
|
||||
isolate2->SetJitCodeEventHandler(v8::kJitCodeEventDefault,
|
||||
SerializerCodeEventListener);
|
||||
toplevel_test_code_event_found = false;
|
||||
{
|
||||
v8::Isolate::Scope iscope(isolate2);
|
||||
v8::HandleScope scope(isolate2);
|
||||
@ -1206,6 +1220,7 @@ TEST(SerializeToplevelIsolates) {
|
||||
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
|
||||
CHECK(result->ToString()->Equals(v8_str("abcdef")));
|
||||
}
|
||||
DCHECK(toplevel_test_code_event_found);
|
||||
isolate2->Dispose();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user