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

Unified Diff: src/objects.cc

Issue 1259193004: [Interpreter] Consistency fixes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove redundant argument to Bytecodes::Decode(). Created 5 years, 4 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
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 053f7107b8e6cb03aac35dac8507dd42d2b09563..ced745e6140cab3a7d67644baf3a7104d6bf5a9a 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11611,39 +11611,18 @@ void Code::Disassemble(const char* name, std::ostream& os) { // NOLINT
void BytecodeArray::Disassemble(std::ostream& os) {
os << "Frame size " << frame_size() << "\n";
Vector<char> buf = Vector<char>::New(50);
- int bytes = 0;
- for (int i = 0; i < this->length(); i += bytes) {
- interpreter::Bytecode bytecode = interpreter::Bytecodes::FromByte(get(i));
- bytes = interpreter::Bytecodes::Size(bytecode);
- SNPrintF(buf, "%p : ", GetFirstBytecodeAddress() + i);
- os << buf.start();
- for (int j = 0; j < bytes; j++) {
- SNPrintF(buf, "%02x ", get(i + j));
- os << buf.start();
- }
- for (int j = bytes; j < interpreter::Bytecodes::MaximumSize(); j++) {
- os << " ";
- }
- os << bytecode << " ";
- for (int j = 1; j < bytes; j++) {
- interpreter::OperandType op_type =
- interpreter::Bytecodes::GetOperandType(bytecode, j - 1);
- uint8_t operand = get(i + j);
- switch (op_type) {
- case interpreter::OperandType::kImm8:
- os << "#" << static_cast<int>(operand);
- break;
- case interpreter::OperandType::kReg:
- os << "r" << static_cast<int>(operand);
- break;
- case interpreter::OperandType::kNone:
- UNREACHABLE();
- break;
- }
- if (j + 1 < bytes) {
- os << ", ";
- }
- }
+
+ const uint8_t* first_bytecode_address = GetFirstBytecodeAddress();
+ int bytecode_size = 0;
+ for (int i = 0; i < this->length(); i += bytecode_size) {
+ const uint8_t* bytecode_start = &first_bytecode_address[i];
+ interpreter::Bytecode bytecode =
+ interpreter::Bytecodes::FromByte(bytecode_start[0]);
+ bytecode_size = interpreter::Bytecodes::Size(bytecode);
+
+ SNPrintF(buf, "%p", bytecode_start);
+ os << buf.start() << " : ";
+ interpreter::Bytecodes::Decode(os, bytecode_start);
os << "\n";
}
}
« no previous file with comments | « src/interpreter/bytecodes.cc ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698