Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(318)

Unified Diff: src/frames.cc

Issue 1618343002: [interpreter, debugger] abstraction for source position calculation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index dfaf3ca5e4d6e838caf31913e62d46ec88375f10..342c80e6b9af0886a22546260a841e23db06426a 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -797,7 +797,7 @@ void JavaScriptFrame::GetFunctions(List<JSFunction*>* functions) const {
void JavaScriptFrame::Summarize(List<FrameSummary>* functions) {
DCHECK(functions->length() == 0);
Code* code_pointer = LookupCode();
- int offset = static_cast<int>(pc() - code_pointer->address());
+ int offset = static_cast<int>(pc() - code_pointer->instruction_start());
FrameSummary summary(receiver(),
function(),
code_pointer,
@@ -897,12 +897,13 @@ void JavaScriptFrame::RestoreOperandStack(FixedArray* store) {
}
-FrameSummary::FrameSummary(Object* receiver, JSFunction* function, Code* code,
- int offset, bool is_constructor)
+FrameSummary::FrameSummary(Object* receiver, JSFunction* function,
+ HeapObject* abstract_code, int code_offset,
rmcilroy 2016/01/22 19:16:34 Is there a reason this can't be AbstractCode type.
Yang 2016/01/28 09:09:53 It can be. But then the caller would have to do th
+ bool is_constructor)
: receiver_(receiver, function->GetIsolate()),
function_(function),
- code_(code),
- offset_(offset),
+ abstract_code_(AbstractCode::cast(abstract_code)),
+ code_offset_(code_offset),
is_constructor_(is_constructor) {}
@@ -912,10 +913,15 @@ void FrameSummary::Print() {
PrintF("\nfunction: ");
function_->shared()->DebugName()->ShortPrint();
PrintF("\ncode: ");
- code_->ShortPrint();
- if (code_->kind() == Code::FUNCTION) PrintF(" NON-OPT");
- if (code_->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT");
- PrintF("\npc: %d\n", offset_);
+ abstract_code_->ShortPrint();
+ if (abstract_code_->IsCode()) {
+ Code* code = abstract_code_->GetCode();
+ if (code->kind() == Code::FUNCTION) PrintF(" UNOPT ");
+ if (code->kind() == Code::OPTIMIZED_FUNCTION) PrintF(" OPT ");
+ } else {
+ PrintF(" BYTECODE ");
+ }
+ PrintF("\npc: %d\n", code_offset_);
}
@@ -994,24 +1000,25 @@ void OptimizedFrame::Summarize(List<FrameSummary>* frames) {
receiver = isolate()->heap()->undefined_value();
}
- Code* const code = shared_info->code();
+ AbstractCode* abstract_code = shared_info->AbstractCode();
- unsigned pc_offset;
+ int code_offset;
rmcilroy 2016/01/22 19:16:34 Could this still be unsigned? It should never be n
Yang 2016/01/28 09:09:53 Done.
if (frame_opcode == Translation::JS_FRAME) {
+ Code* code = abstract_code->GetCode();
DeoptimizationOutputData* const output_data =
DeoptimizationOutputData::cast(code->deoptimization_data());
unsigned const entry =
Deoptimizer::GetOutputInfo(output_data, ast_id, shared_info);
- pc_offset =
- FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize;
- DCHECK_NE(0U, pc_offset);
+ code_offset = FullCodeGenerator::PcField::decode(entry);
+ DCHECK_LE(0, code_offset);
} else {
// TODO(rmcilroy): Modify FrameSummary to enable us to summarize
// based on the BytecodeArray and bytecode offset.
DCHECK_EQ(frame_opcode, Translation::INTERPRETED_FRAME);
- pc_offset = 0;
+ code_offset = 0;
rmcilroy 2016/01/22 19:16:34 Could this use GetBytecodeOffset now?
Yang 2016/01/28 09:09:53 No. The frame object is still an OptimizedFrame. T
}
- FrameSummary summary(receiver, function, code, pc_offset, is_constructor);
+ FrameSummary summary(receiver, function, abstract_code, code_offset,
+ is_constructor);
frames->Add(summary);
is_constructor = false;
} else if (frame_opcode == Translation::CONSTRUCT_STUB_FRAME) {
@@ -1155,6 +1162,18 @@ void InterpretedFrame::PatchBytecodeOffset(int new_offset) {
}
+void InterpretedFrame::Summarize(List<FrameSummary>* functions) {
+ DCHECK(functions->length() == 0);
+ DCHECK_EQ(
+ isolate()->builtins()->builtin(Builtins::kInterpreterEntryTrampoline),
+ LookupCode());
+ FrameSummary summary(receiver(), function(),
+ function()->shared()->bytecode_array(),
+ GetBytecodeOffset(), IsConstructor());
+ functions->Add(summary);
+}
+
+
int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const {
return Smi::cast(GetExpression(0))->value();
}

Powered by Google App Engine
This is Rietveld 408576698