Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 "test/cctest/interpreter/bytecode-expectations-printer.h" | 5 #include "test/cctest/interpreter/bytecode-expectations-printer.h" |
| 6 | 6 |
| 7 #include <iostream> | 7 #include <iostream> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "include/libplatform/libplatform.h" | 10 #include "include/libplatform/libplatform.h" |
| 11 #include "include/v8.h" | 11 #include "include/v8.h" |
| 12 | 12 |
| 13 #include "src/base/logging.h" | 13 #include "src/base/logging.h" |
| 14 #include "src/base/smart-pointers.h" | 14 #include "src/base/smart-pointers.h" |
| 15 #include "src/compiler.h" | 15 #include "src/compiler.h" |
| 16 #include "src/runtime/runtime.h" | |
| 16 | 17 |
| 17 #include "src/interpreter/bytecode-array-iterator.h" | 18 #include "src/interpreter/bytecode-array-iterator.h" |
| 18 #include "src/interpreter/bytecode-generator.h" | 19 #include "src/interpreter/bytecode-generator.h" |
| 19 #include "src/interpreter/bytecodes.h" | 20 #include "src/interpreter/bytecodes.h" |
| 20 #include "src/interpreter/interpreter.h" | 21 #include "src/interpreter/interpreter.h" |
| 21 | 22 |
| 22 namespace v8 { | 23 namespace v8 { |
| 23 namespace internal { | 24 namespace internal { |
| 24 namespace interpreter { | 25 namespace interpreter { |
| 25 | 26 |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 stream << "(this)"; | 130 stream << "(this)"; |
| 130 } else { | 131 } else { |
| 131 stream << "(arg" << (parameter_index - 1) << ')'; | 132 stream << "(arg" << (parameter_index - 1) << ')'; |
| 132 } | 133 } |
| 133 } else { | 134 } else { |
| 134 stream << '(' << register_value.index() << ')'; | 135 stream << '(' << register_value.index() << ')'; |
| 135 } | 136 } |
| 136 } else { | 137 } else { |
| 137 stream << 'U' << size_tag << '('; | 138 stream << 'U' << size_tag << '('; |
| 138 | 139 |
| 139 if (Bytecodes::IsImmediateOperandType(op_type)) { | 140 if (op_index == 0 && Bytecodes::IsCallRuntime(bytecode)) { |
| 141 stream << "Runtime::" | |
| 142 << i::Runtime::FunctionForId( | |
|
oth
2016/02/23 17:37:15
Nit - this is a bit dense with braces and brackets
Stefano Sanfilippo
2016/02/23 17:43:50
Done.
| |
| 143 static_cast<i::Runtime::FunctionId>( | |
| 144 bytecode_iter.GetIndexOperand(op_index))) | |
| 145 ->name; | |
| 146 } else if (Bytecodes::IsImmediateOperandType(op_type)) { | |
| 140 // We need a cast, otherwise the result is printed as char. | 147 // We need a cast, otherwise the result is printed as char. |
| 141 stream << static_cast<int>(bytecode_iter.GetImmediateOperand(op_index)); | 148 stream << static_cast<int>(bytecode_iter.GetImmediateOperand(op_index)); |
| 142 } else if (Bytecodes::IsRegisterCountOperandType(op_type)) { | 149 } else if (Bytecodes::IsRegisterCountOperandType(op_type)) { |
| 143 stream << bytecode_iter.GetRegisterCountOperand(op_index); | 150 stream << bytecode_iter.GetRegisterCountOperand(op_index); |
| 144 } else if (Bytecodes::IsIndexOperandType(op_type)) { | 151 } else if (Bytecodes::IsIndexOperandType(op_type)) { |
| 145 stream << bytecode_iter.GetIndexOperand(op_index); | 152 stream << bytecode_iter.GetIndexOperand(op_index); |
| 146 } else { | 153 } else { |
| 147 UNREACHABLE(); | 154 UNREACHABLE(); |
| 148 } | 155 } |
| 149 | 156 |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 292 | 299 |
| 293 stream << "---\n"; | 300 stream << "---\n"; |
| 294 PrintCodeSnippet(stream, snippet); | 301 PrintCodeSnippet(stream, snippet); |
| 295 PrintBytecodeArray(stream, bytecode_array); | 302 PrintBytecodeArray(stream, bytecode_array); |
| 296 stream << '\n'; | 303 stream << '\n'; |
| 297 } | 304 } |
| 298 | 305 |
| 299 } // namespace interpreter | 306 } // namespace interpreter |
| 300 } // namespace internal | 307 } // namespace internal |
| 301 } // namespace v8 | 308 } // namespace v8 |
| OLD | NEW |