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

Side by Side Diff: src/frames.cc

Issue 1909663005: [interpreter] Fix stack trace printers for debugging. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: empty patch set as per comment Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/frames.h" 5 #include "src/frames.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/ast/scopeinfo.h" 10 #include "src/ast/scopeinfo.h"
(...skipping 1380 matching lines...) Expand 10 before | Expand all | Expand 10 after
1391 Script* script = Script::cast(script_obj); 1391 Script* script = Script::cast(script_obj);
1392 accumulator->Add(" ["); 1392 accumulator->Add(" [");
1393 accumulator->PrintName(script->name()); 1393 accumulator->PrintName(script->name());
1394 1394
1395 Address pc = this->pc(); 1395 Address pc = this->pc();
1396 if (code != NULL && code->kind() == Code::FUNCTION && 1396 if (code != NULL && code->kind() == Code::FUNCTION &&
1397 pc >= code->instruction_start() && pc < code->instruction_end()) { 1397 pc >= code->instruction_start() && pc < code->instruction_end()) {
1398 int offset = static_cast<int>(pc - code->instruction_start()); 1398 int offset = static_cast<int>(pc - code->instruction_start());
1399 int source_pos = code->SourcePosition(offset); 1399 int source_pos = code->SourcePosition(offset);
1400 int line = script->GetLineNumber(source_pos) + 1; 1400 int line = script->GetLineNumber(source_pos) + 1;
1401 accumulator->Add(":%d", line); 1401 accumulator->Add(":%d] [pc=%p]", line, pc);
1402 } else if (is_interpreted()) {
1403 const InterpretedFrame* iframe =
1404 reinterpret_cast<const InterpretedFrame*>(this);
1405 BytecodeArray* bytecodes = iframe->GetBytecodeArray();
1406 int offset = iframe->GetBytecodeOffset();
1407 int source_pos = bytecodes->SourcePosition(offset);
1408 int line = script->GetLineNumber(source_pos) + 1;
1409 accumulator->Add(":%d] [bytecode=%p offset=%d]", line, bytecodes, offset);
1402 } else { 1410 } else {
1403 int function_start_pos = shared->start_position(); 1411 int function_start_pos = shared->start_position();
1404 int line = script->GetLineNumber(function_start_pos) + 1; 1412 int line = script->GetLineNumber(function_start_pos) + 1;
1405 accumulator->Add(":~%d", line); 1413 accumulator->Add(":~%d] [pc=%p]", line, pc);
1406 } 1414 }
1407
1408 accumulator->Add("] [pc=%p] ", pc);
1409 } 1415 }
1410 1416
1411 accumulator->Add("(this=%o", receiver); 1417 accumulator->Add("(this=%o", receiver);
1412 1418
1413 // Print the parameters. 1419 // Print the parameters.
1414 int parameters_count = ComputeParametersCount(); 1420 int parameters_count = ComputeParametersCount();
1415 for (int i = 0; i < parameters_count; i++) { 1421 for (int i = 0; i < parameters_count; i++) {
1416 accumulator->Add(","); 1422 accumulator->Add(",");
1417 // If we have a name for the parameter we print it. Nameless 1423 // If we have a name for the parameter we print it. Nameless
1418 // parameters are either because we have more actual parameters 1424 // parameters are either because we have more actual parameters
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
1773 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { 1779 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) {
1774 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); 1780 StackFrame* frame = AllocateFrameCopy(it.frame(), zone);
1775 list.Add(frame, zone); 1781 list.Add(frame, zone);
1776 } 1782 }
1777 return list.ToVector(); 1783 return list.ToVector();
1778 } 1784 }
1779 1785
1780 1786
1781 } // namespace internal 1787 } // namespace internal
1782 } // namespace v8 1788 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/isolate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698