}
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;
}
: 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);
}
+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;
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);
v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
CHECK(result->ToString()->Equals(v8_str("abcdef")));
}
+ DCHECK(toplevel_test_code_event_found);
isolate2->Dispose();
}