Reviewers: danno, Sven Panne, marja,

Message:
hello. Daniel & Marja.
please help to review this patch.
thanks.

Description:
fix the vtune support bug.

During https://code.google.com/p/v8/source/detail?r=19925 checkin context bound
scripts (Script)
and context unbound scripts (UnboundScript) are Distinguished.

And then Sven Panne helped to fix the vtune support compilation
error in https://code.google.com/p/v8/source/detail?r=20955.

The problem is that there is runtime error for vtune
support.
In our original implementation, we encapsulated and passed v8::internal::Script to V8 API. It will leads to type check error for current V8::Script definition.

So I changed the Handle<Script> definition in JitCodeEvent
to Handle<UnboundScript>
 and add the corresponding change in log.cc.

If you do NOT prefer to change in include/v8.h. I think I can change the
definition of
CodeEventLogger::LogRecordedBuffer(...) so that the we can pass the correct
type (JSFunction) as V8::Script to V8 API.


BUG=

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

SVN Base: https://github.com/v8/v8.git@master

Affected files (+8, -8 lines):
  M include/v8.h
  M src/log.cc
  M src/third_party/vtune/vtune-jit.cc


Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 7d27029d23c8ee403588f88f8b4a3abe87a4fa4d..4608885e4ebe2c41bf310fbb97432b84108c548c 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -4539,7 +4539,7 @@ struct JitCodeEvent {
   // Size of the instructions.
   size_t code_len;
   // Script info for CODE_ADDED event.
-  Handle<Script> script;
+  Handle<UnboundScript> script;
// User-defined data for *_LINE_INFO_* event. It's used to hold the source
   // code line information which is returned from the
   // CODE_START_LINE_INFO_RECORDING event. And it's passed to subsequent
Index: src/log.cc
diff --git a/src/log.cc b/src/log.cc
index 9603fc19bc709e6fa8466affd38f1146590830a3..c17e9cce6b658f0551c4f4c868136b27c7217b77 100644
--- a/src/log.cc
+++ b/src/log.cc
@@ -670,11 +670,11 @@ void JitLogger::LogRecordedBuffer(Code* code,
   event.type = JitCodeEvent::CODE_ADDED;
   event.code_start = code->instruction_start();
   event.code_len = code->instruction_size();
-  Handle<Script> script_handle;
+  Handle<SharedFunctionInfo> script_handle;
   if (shared && shared->script()->IsScript()) {
-    script_handle = Handle<Script>(Script::cast(shared->script()));
+    script_handle = Handle<SharedFunctionInfo>(shared);
   }
-  event.script = ToApiHandle<v8::Script>(script_handle);
+  event.script = ToApiHandle<v8::UnboundScript>(script_handle);
   event.name.str = name;
   event.name.len = length;
   code_event_handler_(&event);
Index: src/third_party/vtune/vtune-jit.cc
diff --git a/src/third_party/vtune/vtune-jit.cc b/src/third_party/vtune/vtune-jit.cc index 023dd1864be03bdef449e14d89e086da00dd76a2..c39c497b6b299bf569995c7a10c38dd271381c5b 100644
--- a/src/third_party/vtune/vtune-jit.cc
+++ b/src/third_party/vtune/vtune-jit.cc
@@ -192,13 +192,13 @@ void VTUNEJITInterface::event_handler(const v8::JitCodeEvent* event) {
         jmethod.method_size = static_cast<unsigned int>(event->code_len);
         jmethod.method_name = temp_method_name;

-        Handle<Script> script = event->script;
+        Handle<UnboundScript> script = event->script;

         if (*script != NULL) {
// Get the source file name and set it to jmethod.source_file_name
-         if ((*script->GetUnboundScript()->GetScriptName())->IsString()) {
+         if ((*script->GetScriptName())->IsString()) {
             Handle<String> script_name =
-                script->GetUnboundScript()->GetScriptName()->ToString();
+                script->GetScriptName()->ToString();
             temp_file_name = new char[script_name->Utf8Length() + 1];
             script_name->WriteUtf8(temp_file_name);
             jmethod.source_file_name = temp_file_name;
@@ -225,7 +225,7 @@ void VTUNEJITInterface::event_handler(const v8::JitCodeEvent* event) {
               jmethod.line_number_table[index].Offset =
                   static_cast<unsigned int>(Iter->pc_);
               jmethod.line_number_table[index++].LineNumber =
-                  script->GetUnboundScript()->GetLineNumber(Iter->pos_)+1;
+                  script->GetLineNumber(Iter->pos_)+1;
             }
             GetEntries()->erase(event->code_start);
           }


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