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 <iomanip> | 7 #include <iomanip> |
8 #include <iostream> | 8 #include <iostream> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "include/libplatform/libplatform.h" | 11 #include "include/libplatform/libplatform.h" |
12 #include "include/v8.h" | 12 #include "include/v8.h" |
13 | 13 |
14 #include "src/base/logging.h" | 14 #include "src/base/logging.h" |
15 #include "src/runtime/runtime.h" | 15 #include "src/runtime/runtime.h" |
16 | 16 |
17 #include "src/interpreter/bytecode-array-iterator.h" | 17 #include "src/interpreter/bytecode-array-iterator.h" |
18 #include "src/interpreter/bytecode-generator.h" | 18 #include "src/interpreter/bytecode-generator.h" |
19 #include "src/interpreter/bytecodes.h" | 19 #include "src/interpreter/bytecodes.h" |
20 #include "src/interpreter/interpreter-intrinsics.h" | 20 #include "src/interpreter/interpreter-intrinsics.h" |
21 #include "src/interpreter/interpreter.h" | 21 #include "src/interpreter/interpreter.h" |
22 #include "src/source-position-table.h" | 22 #include "src/source-position-table.h" |
23 | 23 |
24 namespace v8 { | 24 namespace v8 { |
25 namespace internal { | 25 namespace internal { |
26 namespace interpreter { | 26 namespace interpreter { |
27 | 27 |
| 28 static const char* NameForNativeContextIntrinsicIndex(uint32_t idx) { |
| 29 switch (idx) { |
| 30 #define COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX(NAME, Type, name) \ |
| 31 case Context::NAME: \ |
| 32 return #name; |
| 33 |
| 34 NATIVE_CONTEXT_INTRINSIC_FUNCTIONS(COMPARE_NATIVE_CONTEXT_INTRINSIC_IDX) |
| 35 |
| 36 default: |
| 37 break; |
| 38 } |
| 39 |
| 40 return "UnknownIntrinsicIndex"; |
| 41 } |
| 42 |
28 // static | 43 // static |
29 const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName = | 44 const char* const BytecodeExpectationsPrinter::kDefaultTopFunctionName = |
30 "__genbckexp_wrapper__"; | 45 "__genbckexp_wrapper__"; |
31 const char* const BytecodeExpectationsPrinter::kIndent = " "; | 46 const char* const BytecodeExpectationsPrinter::kIndent = " "; |
32 | 47 |
33 v8::Local<v8::String> BytecodeExpectationsPrinter::V8StringFromUTF8( | 48 v8::Local<v8::String> BytecodeExpectationsPrinter::V8StringFromUTF8( |
34 const char* data) const { | 49 const char* data) const { |
35 return v8::String::NewFromUtf8(isolate_, data, v8::NewStringType::kNormal) | 50 return v8::String::NewFromUtf8(isolate_, data, v8::NewStringType::kNormal) |
36 .ToLocalChecked(); | 51 .ToLocalChecked(); |
37 } | 52 } |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } else { | 170 } else { |
156 stream << '(' << register_value.index() << ')'; | 171 stream << '(' << register_value.index() << ')'; |
157 } | 172 } |
158 } else { | 173 } else { |
159 stream << 'U' << size_tag << '('; | 174 stream << 'U' << size_tag << '('; |
160 | 175 |
161 switch (op_type) { | 176 switch (op_type) { |
162 case OperandType::kFlag8: | 177 case OperandType::kFlag8: |
163 stream << bytecode_iterator.GetFlagOperand(op_index); | 178 stream << bytecode_iterator.GetFlagOperand(op_index); |
164 break; | 179 break; |
165 case OperandType::kIdx: | 180 case OperandType::kIdx: { |
166 stream << bytecode_iterator.GetIndexOperand(op_index); | 181 uint32_t idx = bytecode_iterator.GetIndexOperand(op_index); |
| 182 if (bytecode == Bytecode::kCallJSRuntime && op_index == 0) { |
| 183 stream << "%" << NameForNativeContextIntrinsicIndex(idx); |
| 184 } else { |
| 185 stream << idx; |
| 186 } |
167 break; | 187 break; |
| 188 } |
168 case OperandType::kUImm: | 189 case OperandType::kUImm: |
169 stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); | 190 stream << bytecode_iterator.GetUnsignedImmediateOperand(op_index); |
170 break; | 191 break; |
171 case OperandType::kImm: | 192 case OperandType::kImm: |
172 stream << bytecode_iterator.GetImmediateOperand(op_index); | 193 stream << bytecode_iterator.GetImmediateOperand(op_index); |
173 break; | 194 break; |
174 case OperandType::kRegCount: | 195 case OperandType::kRegCount: |
175 stream << bytecode_iterator.GetRegisterCountOperand(op_index); | 196 stream << bytecode_iterator.GetRegisterCountOperand(op_index); |
176 break; | 197 break; |
177 case OperandType::kRuntimeId: { | 198 case OperandType::kRuntimeId: { |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 | 379 |
359 stream << "---\n"; | 380 stream << "---\n"; |
360 PrintCodeSnippet(stream, snippet); | 381 PrintCodeSnippet(stream, snippet); |
361 PrintBytecodeArray(stream, bytecode_array); | 382 PrintBytecodeArray(stream, bytecode_array); |
362 stream << '\n'; | 383 stream << '\n'; |
363 } | 384 } |
364 | 385 |
365 } // namespace interpreter | 386 } // namespace interpreter |
366 } // namespace internal | 387 } // namespace internal |
367 } // namespace v8 | 388 } // namespace v8 |
OLD | NEW |