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

Unified Diff: src/runtime/runtime-interpreter.cc

Issue 1852213002: [interpreter] Add accumulator use description to bytecodes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase. 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | test/unittests/interpreter/bytecodes-unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-interpreter.cc
diff --git a/src/runtime/runtime-interpreter.cc b/src/runtime/runtime-interpreter.cc
index 8971edeb62fc709106230dcc41589a575b60a391..22ae9113d81cf087e1c526a17f227ad349153973 100644
--- a/src/runtime/runtime-interpreter.cc
+++ b/src/runtime/runtime-interpreter.cc
@@ -44,7 +44,8 @@ void AdvanceToOffsetForTracing(
void PrintRegisters(std::ostream& os, bool is_input,
interpreter::BytecodeArrayIterator& bytecode_iterator,
Handle<Object> accumulator) {
- static const int kRegFieldWidth = static_cast<int>(strlen("accumulator"));
+ static const char kAccumulator[] = "accumulator";
+ static const int kRegFieldWidth = static_cast<int>(sizeof(kAccumulator) - 1);
static const char* kInputColourCode = "\033[0;36m";
static const char* kOutputColourCode = "\033[0;35m";
static const char* kNormalColourCode = "\033[0;m";
@@ -53,10 +54,15 @@ void PrintRegisters(std::ostream& os, bool is_input,
os << (is_input ? kInputColourCode : kOutputColourCode);
}
+ interpreter::Bytecode bytecode = bytecode_iterator.current_bytecode();
+
// Print accumulator.
- os << " [ accumulator" << kArrowDirection;
- accumulator->ShortPrint();
- os << " ]" << std::endl;
+ if ((is_input && interpreter::Bytecodes::ReadsAccumulator(bytecode)) ||
+ (!is_input && interpreter::Bytecodes::WritesAccumulator(bytecode))) {
+ os << " [ " << kAccumulator << kArrowDirection;
+ accumulator->ShortPrint();
+ os << " ]" << std::endl;
+ }
// Find the location of the register file.
JavaScriptFrameIterator frame_iterator(
@@ -66,7 +72,6 @@ void PrintRegisters(std::ostream& os, bool is_input,
frame->fp() + InterpreterFrameConstants::kRegisterFilePointerFromFp;
// Print the registers.
- interpreter::Bytecode bytecode = bytecode_iterator.current_bytecode();
int operand_count = interpreter::Bytecodes::NumberOfOperands(bytecode);
for (int operand_index = 0; operand_index < operand_count; operand_index++) {
interpreter::OperandType operand_type =
« no previous file with comments | « src/interpreter/interpreter-assembler.cc ('k') | test/unittests/interpreter/bytecodes-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698