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/objects.cc

Issue 1803373002: [interpreter] Print bytecode offsets when dumping bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Addressed comments. 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/runtime/runtime-interpreter.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 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 14552 matching lines...) Expand 10 before | Expand all | Expand 10 after
14563 } 14563 }
14564 } 14564 }
14565 iterator.Advance(); 14565 iterator.Advance();
14566 } 14566 }
14567 return statement_position; 14567 return statement_position;
14568 } 14568 }
14569 14569
14570 void BytecodeArray::Disassemble(std::ostream& os) { 14570 void BytecodeArray::Disassemble(std::ostream& os) {
14571 os << "Parameter count " << parameter_count() << "\n"; 14571 os << "Parameter count " << parameter_count() << "\n";
14572 os << "Frame size " << frame_size() << "\n"; 14572 os << "Frame size " << frame_size() << "\n";
14573 Vector<char> buf = Vector<char>::New(50);
14574 14573
14575 const uint8_t* base_address = GetFirstBytecodeAddress(); 14574 const uint8_t* base_address = GetFirstBytecodeAddress();
14576 interpreter::SourcePositionTableIterator source_positions( 14575 interpreter::SourcePositionTableIterator source_positions(
14577 source_position_table()); 14576 source_position_table());
14578 14577
14579 interpreter::BytecodeArrayIterator iterator(handle(this)); 14578 interpreter::BytecodeArrayIterator iterator(handle(this));
14580 while (!iterator.done()) { 14579 while (!iterator.done()) {
14581 if (!source_positions.done() && 14580 if (!source_positions.done() &&
14582 iterator.current_offset() == source_positions.bytecode_offset()) { 14581 iterator.current_offset() == source_positions.bytecode_offset()) {
14583 os << std::setw(5) << source_positions.source_position(); 14582 os << std::setw(5) << source_positions.source_position();
14584 os << (source_positions.is_statement() ? " S> " : " E> "); 14583 os << (source_positions.is_statement() ? " S> " : " E> ");
14585 source_positions.Advance(); 14584 source_positions.Advance();
14586 } else { 14585 } else {
14587 os << " "; 14586 os << " ";
14588 } 14587 }
14589 const uint8_t* current_address = base_address + iterator.current_offset(); 14588 const uint8_t* current_address = base_address + iterator.current_offset();
14590 SNPrintF(buf, "%p", current_address); 14589 os << reinterpret_cast<const void*>(current_address) << " @ "
14591 os << buf.start() << " : "; 14590 << std::setw(4) << iterator.current_offset() << " : ";
14592 interpreter::Bytecodes::Decode(os, current_address, parameter_count()); 14591 interpreter::Bytecodes::Decode(os, current_address, parameter_count());
14593 if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) { 14592 if (interpreter::Bytecodes::IsJump(iterator.current_bytecode())) {
14594 SNPrintF(buf, " (%p)", base_address + iterator.GetJumpTargetOffset()); 14593 const void* jump_target = base_address + iterator.GetJumpTargetOffset();
14595 os << buf.start(); 14594 os << " (" << jump_target << " @ " << iterator.GetJumpTargetOffset()
14595 << ")";
14596 } 14596 }
14597 os << std::endl; 14597 os << std::endl;
14598 iterator.Advance(); 14598 iterator.Advance();
14599 } 14599 }
14600 14600
14601 if (constant_pool()->length() > 0) { 14601 if (constant_pool()->length() > 0) {
14602 os << "Constant pool (size = " << constant_pool()->length() << ")\n"; 14602 os << "Constant pool (size = " << constant_pool()->length() << ")\n";
14603 constant_pool()->Print(); 14603 constant_pool()->Print();
14604 } 14604 }
14605 14605
(...skipping 4710 matching lines...) Expand 10 before | Expand all | Expand 10 after
19316 if (cell->value() != *new_value) { 19316 if (cell->value() != *new_value) {
19317 cell->set_value(*new_value); 19317 cell->set_value(*new_value);
19318 Isolate* isolate = cell->GetIsolate(); 19318 Isolate* isolate = cell->GetIsolate();
19319 cell->dependent_code()->DeoptimizeDependentCodeGroup( 19319 cell->dependent_code()->DeoptimizeDependentCodeGroup(
19320 isolate, DependentCode::kPropertyCellChangedGroup); 19320 isolate, DependentCode::kPropertyCellChangedGroup);
19321 } 19321 }
19322 } 19322 }
19323 19323
19324 } // namespace internal 19324 } // namespace internal
19325 } // namespace v8 19325 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698