Index: src/profiler/cpu-profiler.cc |
diff --git a/src/profiler/cpu-profiler.cc b/src/profiler/cpu-profiler.cc |
index b6c7945797bc702cb647c5de58195f90ff6ae967..75f6f8a0377f60f61e16d7eb5a81681d7a61ee88 100644 |
--- a/src/profiler/cpu-profiler.cc |
+++ b/src/profiler/cpu-profiler.cc |
@@ -211,10 +211,8 @@ void CpuProfiler::CallbackEvent(Name* name, Address entry_point) { |
processor_->Enqueue(evt_rec); |
} |
- |
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
- Code* code, |
- const char* name) { |
+ AbstractCode* code, const char* name) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
@@ -226,10 +224,8 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
processor_->Enqueue(evt_rec); |
} |
- |
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
- Code* code, |
- Name* name) { |
+ AbstractCode* code, Name* name) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
@@ -241,8 +237,8 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
processor_->Enqueue(evt_rec); |
} |
- |
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
+ AbstractCode* code, |
SharedFunctionInfo* shared, |
CompilationInfo* info, Name* script_name) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
@@ -261,46 +257,51 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
processor_->Enqueue(evt_rec); |
} |
- |
-void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, Code* code, |
+void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
+ AbstractCode* abstract_code, |
SharedFunctionInfo* shared, |
CompilationInfo* info, Name* script_name, |
int line, int column) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
- rec->start = code->address(); |
+ rec->start = abstract_code->address(); |
Script* script = Script::cast(shared->script()); |
JITLineInfoTable* line_table = NULL; |
if (script) { |
- line_table = new JITLineInfoTable(); |
- for (RelocIterator it(code); !it.done(); it.next()) { |
- RelocInfo::Mode mode = it.rinfo()->rmode(); |
- if (RelocInfo::IsPosition(mode)) { |
- int position = static_cast<int>(it.rinfo()->data()); |
- if (position >= 0) { |
- int pc_offset = static_cast<int>(it.rinfo()->pc() - code->address()); |
- int line_number = script->GetLineNumber(position) + 1; |
- line_table->SetPosition(pc_offset, line_number); |
+ if (abstract_code->IsCode()) { |
+ Code* code = abstract_code->GetCode(); |
+ line_table = new JITLineInfoTable(); |
+ for (RelocIterator it(code); !it.done(); it.next()) { |
+ RelocInfo::Mode mode = it.rinfo()->rmode(); |
+ if (RelocInfo::IsPosition(mode)) { |
+ int position = static_cast<int>(it.rinfo()->data()); |
+ if (position >= 0) { |
+ int pc_offset = |
+ static_cast<int>(it.rinfo()->pc() - code->address()); |
+ int line_number = script->GetLineNumber(position) + 1; |
+ line_table->SetPosition(pc_offset, line_number); |
+ } |
} |
} |
+ } else { |
+ DCHECK(abstract_code->IsBytecodeArray()); |
+ // TODO(rmcilroy): source position tracking for bytecode arrays. |
} |
} |
rec->entry = profiles_->NewCodeEntry( |
tag, profiles_->GetFunctionName(shared->DebugName()), |
CodeEntry::kEmptyNamePrefix, profiles_->GetName(script_name), line, |
- column, line_table, code->instruction_start()); |
+ column, line_table, abstract_code->instruction_start()); |
if (info) { |
rec->entry->set_inlined_function_infos(info->inlined_function_infos()); |
} |
rec->entry->FillFunctionInfo(shared); |
- rec->size = code->ExecutableSize(); |
+ rec->size = abstract_code->ExecutableSize(); |
processor_->Enqueue(evt_rec); |
} |
- |
void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
- Code* code, |
- int args_count) { |
+ AbstractCode* code, int args_count) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |
@@ -312,17 +313,16 @@ void CpuProfiler::CodeCreateEvent(Logger::LogEventsAndTags tag, |
processor_->Enqueue(evt_rec); |
} |
- |
-void CpuProfiler::CodeMoveEvent(Address from, Address to) { |
+void CpuProfiler::CodeMoveEvent(AbstractCode* from, Address to) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_MOVE); |
CodeMoveEventRecord* rec = &evt_rec.CodeMoveEventRecord_; |
- rec->from = from; |
+ rec->from = from->address(); |
rec->to = to; |
processor_->Enqueue(evt_rec); |
} |
- |
-void CpuProfiler::CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { |
+void CpuProfiler::CodeDisableOptEvent(AbstractCode* code, |
+ SharedFunctionInfo* shared) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_DISABLE_OPT); |
CodeDisableOptEventRecord* rec = &evt_rec.CodeDisableOptEventRecord_; |
rec->start = code->address(); |
@@ -330,7 +330,6 @@ void CpuProfiler::CodeDisableOptEvent(Code* code, SharedFunctionInfo* shared) { |
processor_->Enqueue(evt_rec); |
} |
- |
void CpuProfiler::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_DEOPT); |
CodeDeoptEventRecord* rec = &evt_rec.CodeDeoptEventRecord_; |
@@ -343,11 +342,6 @@ void CpuProfiler::CodeDeoptEvent(Code* code, Address pc, int fp_to_sp_delta) { |
processor_->AddDeoptStack(isolate_, pc, fp_to_sp_delta); |
} |
- |
-void CpuProfiler::CodeDeleteEvent(Address from) { |
-} |
- |
- |
void CpuProfiler::GetterCallbackEvent(Name* name, Address entry_point) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
@@ -360,8 +354,7 @@ void CpuProfiler::GetterCallbackEvent(Name* name, Address entry_point) { |
processor_->Enqueue(evt_rec); |
} |
- |
-void CpuProfiler::RegExpCodeCreateEvent(Code* code, String* source) { |
+void CpuProfiler::RegExpCodeCreateEvent(AbstractCode* code, String* source) { |
CodeEventsContainer evt_rec(CodeEventRecord::CODE_CREATION); |
CodeCreateEventRecord* rec = &evt_rec.CodeCreateEventRecord_; |
rec->start = code->address(); |