Commit 2f550ff3 authored by Mircea Trofin's avatar Mircea Trofin Committed by Commit Bot

Generalize CodeLinePosInfoRecordEvent to handle non-GC code

This is in preparation for wasm on the native heap. All the
aforementioned API needs is the address where the JIT-ed code starts.
This refactoring reduces the dependency of the API to just that.

Bug: v8:6876
Change-Id: I00bbb171398f581db41b8a74ab719e8ea4db52c4
Reviewed-on: https://chromium-review.googlesource.com/755624Reviewed-by: 's avatarBen Titzer <titzer@chromium.org>
Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Mircea Trofin <mtrofin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49204}
parent e73ab2c7
......@@ -323,7 +323,7 @@ Handle<Code> CodeGenerator::FinalizeCode() {
result->instruction_size());
LOG_CODE_EVENT(isolate(),
CodeLinePosInfoRecordEvent(*Handle<AbstractCode>::cast(result),
CodeLinePosInfoRecordEvent(result->instruction_start(),
*source_positions));
return result;
......
......@@ -965,7 +965,7 @@ void TranslateSourcePositionTable(Handle<BytecodeArray> code,
builder.ToSourcePositionTable(isolate));
code->set_source_position_table(*new_source_position_table);
LOG_CODE_EVENT(isolate,
CodeLinePosInfoRecordEvent(*Handle<AbstractCode>::cast(code),
CodeLinePosInfoRecordEvent(code->GetFirstBytecodeAddress(),
*new_source_position_table));
}
} // namespace
......
......@@ -53,7 +53,7 @@ Handle<BytecodeArray> BytecodeArrayWriter::ToBytecodeArray(
bytecode_array->set_handler_table(*handler_table);
bytecode_array->set_source_position_table(*source_position_table);
LOG_CODE_EVENT(isolate, CodeLinePosInfoRecordEvent(
*Handle<AbstractCode>::cast(bytecode_array),
bytecode_array->GetFirstBytecodeAddress(),
*source_position_table));
return bytecode_array;
}
......
......@@ -420,7 +420,7 @@ class JitLogger : public CodeEventLogger {
JitCodeEvent::PositionType position_type);
void* StartCodePosInfoEvent();
void EndCodePosInfoEvent(AbstractCode* code, void* jit_handler_data);
void EndCodePosInfoEvent(Address start_address, void* jit_handler_data);
private:
void LogRecordedBuffer(AbstractCode* code, SharedFunctionInfo* shared,
......@@ -496,12 +496,12 @@ void* JitLogger::StartCodePosInfoEvent() {
return event.user_data;
}
void JitLogger::EndCodePosInfoEvent(AbstractCode* code,
void JitLogger::EndCodePosInfoEvent(Address start_address,
void* jit_handler_data) {
JitCodeEvent event;
memset(&event, 0, sizeof(event));
event.type = JitCodeEvent::CODE_END_LINE_INFO_RECORDING;
event.code_start = code->instruction_start();
event.code_start = start_address;
event.user_data = jit_handler_data;
code_event_handler_(&event);
......@@ -1181,7 +1181,7 @@ void Logger::CodeMoveEvent(AbstractCode* from, Address to) {
MoveEventInternal(CodeEventListener::CODE_MOVE_EVENT, from->address(), to);
}
void Logger::CodeLinePosInfoRecordEvent(AbstractCode* code,
void Logger::CodeLinePosInfoRecordEvent(Address code_start,
ByteArray* source_position_table) {
if (jit_logger_) {
void* jit_handler_data = jit_logger_->StartCodePosInfoEvent();
......@@ -1197,7 +1197,7 @@ void Logger::CodeLinePosInfoRecordEvent(AbstractCode* code,
jit_handler_data, iter.code_offset(),
iter.source_position().ScriptOffset(), JitCodeEvent::POSITION);
}
jit_logger_->EndCodePosInfoEvent(code, jit_handler_data);
jit_logger_->EndCodePosInfoEvent(code_start, jit_handler_data);
}
}
......
......@@ -188,7 +188,7 @@ class Logger : public CodeEventListener {
// Emits a code move event.
void CodeMoveEvent(AbstractCode* from, Address to);
// Emits a code line info record event.
void CodeLinePosInfoRecordEvent(AbstractCode* code,
void CodeLinePosInfoRecordEvent(Address code_start,
ByteArray* source_position_table);
void SharedFunctionInfoMoveEvent(Address from, Address to);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment