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

Side by Side Diff: src/objects.cc

Issue 1803373002: [interpreter] Print bytecode offsets when dumping bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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 | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 14959 matching lines...) Expand 10 before | Expand all | Expand 10 after
14970 } 14970 }
14971 } 14971 }
14972 iterator.Advance(); 14972 iterator.Advance();
14973 } 14973 }
14974 return statement_position; 14974 return statement_position;
14975 } 14975 }
14976 14976
14977 void BytecodeArray::Disassemble(std::ostream& os) { 14977 void BytecodeArray::Disassemble(std::ostream& os) {
14978 os << "Parameter count " << parameter_count() << "\n"; 14978 os << "Parameter count " << parameter_count() << "\n";
14979 os << "Frame size " << frame_size() << "\n"; 14979 os << "Frame size " << frame_size() << "\n";
14980 Vector<char> buf = Vector<char>::New(50);
14981 14980
14982 const uint8_t* base_address = GetFirstBytecodeAddress(); 14981 const uint8_t* base_address = GetFirstBytecodeAddress();
14983 interpreter::SourcePositionTableIterator source_positions( 14982 interpreter::SourcePositionTableIterator source_positions(
14984 source_position_table()); 14983 source_position_table());
14985 interpreter::BytecodeArrayIterator iterator(handle(this)); 14984 interpreter::BytecodeArrayIterator iterator(handle(this));
14986 while (!iterator.done()) { 14985 while (!iterator.done()) {
14987 if (!source_positions.done() && 14986 if (!source_positions.done() &&
14988 iterator.current_offset() == source_positions.bytecode_offset()) { 14987 iterator.current_offset() == source_positions.bytecode_offset()) {
14989 os << std::setw(5) << source_positions.source_position(); 14988 os << std::setw(5) << source_positions.source_position();
14990 os << (source_positions.is_statement() ? " S> " : " E> "); 14989 os << (source_positions.is_statement() ? " S> " : " E> ");
14991 source_positions.Advance(); 14990 source_positions.Advance();
14992 } else { 14991 } else {
14993 os << " "; 14992 os << " ";
14994 } 14993 }
14995 const uint8_t* current_address = base_address + iterator.current_offset(); 14994 const uint8_t* current_address = base_address + iterator.current_offset();
14996 SNPrintF(buf, "%p", current_address); 14995 os << reinterpret_cast<const void*>(current_address) << " " << std::setw(4)
14997 os << buf.start() << " : "; 14996 << iterator.current_offset() << " : ";
rmcilroy 2016/03/17 11:29:37 It's difficult to tell what this looks like when r
Michael Starzinger 2016/03/17 11:51:14 I went with this formatting because it is the same
rmcilroy 2016/03/17 13:17:08 @ symbols sound good to me, let's go with that.
Michael Starzinger 2016/04/08 13:49:29 Done.
14998 interpreter::Bytecodes::Decode(os, current_address, parameter_count()); 14997 interpreter::Bytecodes::Decode(os, current_address, parameter_count());
14999 if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) { 14998 if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) {
15000 SNPrintF(buf, " (%p)", base_address + iterator.GetJumpTargetOffset()); 14999 const void* jump_target = base_address + iterator.GetJumpTargetOffset();
15001 os << buf.start(); 15000 os << " (" << jump_target << " / " << iterator.GetJumpTargetOffset()
15001 << ")";
15002 } 15002 }
15003 os << std::endl; 15003 os << std::endl;
15004 iterator.Advance(); 15004 iterator.Advance();
15005 } 15005 }
15006 15006
15007 if (constant_pool()->length() > 0) { 15007 if (constant_pool()->length() > 0) {
15008 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; 15008 os << "Constant pool (size = " << constant_pool()->length() << ")\n";
15009 constant_pool()->Print(); 15009 constant_pool()->Print();
15010 } 15010 }
15011 15011
(...skipping 4716 matching lines...) Expand 10 before | Expand all | Expand 10 after
19728 if (cell->value() != *new_value) { 19728 if (cell->value() != *new_value) {
19729 cell->set_value(*new_value); 19729 cell->set_value(*new_value);
19730 Isolate* isolate = cell->GetIsolate(); 19730 Isolate* isolate = cell->GetIsolate();
19731 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19731 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19732 isolate, DependentCode::kPropertyCellChangedGroup); 19732 isolate, DependentCode::kPropertyCellChangedGroup);
19733 } 19733 }
19734 } 19734 }
19735 19735
19736 } // namespace internal 19736 } // namespace internal
19737 } // namespace v8 19737 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698