Commit 034db9ef authored by Patrick Thier's avatar Patrick Thier Committed by V8 LUCI CQ

[sparkplug] Fix IC tracing

AbstractCode doesn't fully support Sparkplug code yet (SourcePosition
and SourcePositionStatement are not supported).
Fall back to using BytecodeArray as AbstractCode at call-sites where
we use these functions.

Bug: chromium:1246259
Change-Id: I839cbff65c96eaaa0057c1e5a8bdd12e2bd721ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3147594Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76744}
parent 6a73d3f6
......@@ -1296,15 +1296,21 @@ void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
if (frame->IsConstructor()) PrintF(file, "new ");
JSFunction function = frame->function();
int code_offset = 0;
AbstractCode abstract_code = function.abstract_code(isolate);
if (frame->is_interpreted()) {
InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame);
code_offset = iframe->GetBytecodeOffset();
} else if (frame->is_baseline()) {
// TODO(pthier): AbstractCode should fully support Baseline code.
BaselineFrame* baseline_frame = BaselineFrame::cast(frame);
code_offset = baseline_frame->GetBytecodeOffset();
abstract_code = AbstractCode::cast(baseline_frame->GetBytecodeArray());
} else {
Code code = frame->unchecked_code();
code_offset = code.GetOffsetFromInstructionStart(isolate, frame->pc());
}
PrintFunctionAndOffset(function, function.abstract_code(isolate),
code_offset, file, print_line_number);
PrintFunctionAndOffset(function, abstract_code, code_offset, file,
print_line_number);
if (print_args) {
// function arguments
// (we are intentionally only printing the actually
......
......@@ -142,13 +142,19 @@ void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
ic_info.type += type;
int code_offset = 0;
AbstractCode code = function.abstract_code(isolate_);
if (function.ActiveTierIsIgnition()) {
code_offset = InterpretedFrame::GetBytecodeOffset(frame->fp());
} else if (function.ActiveTierIsBaseline()) {
// TODO(pthier): AbstractCode should fully support Baseline code.
BaselineFrame* baseline_frame = BaselineFrame::cast(frame);
code_offset = baseline_frame->GetBytecodeOffset();
code = AbstractCode::cast(baseline_frame->GetBytecodeArray());
} else {
code_offset = static_cast<int>(frame->pc() - function.code_entry_point());
}
JavaScriptFrame::CollectFunctionAndOffsetForICStats(
function, function.abstract_code(isolate_), code_offset);
JavaScriptFrame::CollectFunctionAndOffsetForICStats(function, code,
code_offset);
// Reserve enough space for IC transition state, the longest length is 17.
ic_info.state.reserve(17);
......
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