Revision: 24861
Author:   [email protected]
Date:     Fri Oct 24 08:37:03 2014 UTC
Log:      Log code event for deserialized code.

[email protected]

Review URL: https://codereview.chromium.org/663453005
https://code.google.com/p/v8/source/detail?r=24861

Modified:
 /branches/bleeding_edge/src/serialize.cc
 /branches/bleeding_edge/src/serialize.h
 /branches/bleeding_edge/test/cctest/test-serialize.cc

=======================================
--- /branches/bleeding_edge/src/serialize.cc    Fri Oct 24 07:29:39 2014 UTC
+++ /branches/bleeding_edge/src/serialize.cc    Fri Oct 24 08:37:03 2014 UTC
@@ -2245,6 +2245,18 @@
   }
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;
 }

=======================================
--- /branches/bleeding_edge/src/serialize.h     Thu Oct 23 11:23:57 2014 UTC
+++ /branches/bleeding_edge/src/serialize.h     Fri Oct 24 08:37:03 2014 UTC
@@ -700,9 +700,7 @@
       : 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);
=======================================
--- /branches/bleeding_edge/test/cctest/test-serialize.cc Fri Oct 24 07:29:39 2014 UTC +++ /branches/bleeding_edge/test/cctest/test-serialize.cc Fri Oct 24 08:37:03 2014 UTC
@@ -1154,6 +1154,17 @@

   delete cache;
 }
+
+
+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) {
@@ -1188,6 +1199,9 @@
   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 @@
     v8::Local<v8::Value> result = script->BindToCurrentContext()->Run();
     CHECK(result->ToString()->Equals(v8_str("abcdef")));
   }
+  DCHECK(toplevel_test_code_event_found);
   isolate2->Dispose();
 }

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