OLD | NEW |
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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #include "src/interpreter/bytecode-decoder.h" | 9 #include "src/interpreter/bytecode-decoder.h" |
| 10 #include "src/runtime/runtime.h" |
10 #include "test/unittests/interpreter/bytecode-utils.h" | 11 #include "test/unittests/interpreter/bytecode-utils.h" |
11 #include "test/unittests/test-utils.h" | 12 #include "test/unittests/test-utils.h" |
12 | 13 |
13 namespace v8 { | 14 namespace v8 { |
14 namespace internal { | 15 namespace internal { |
15 namespace interpreter { | 16 namespace interpreter { |
16 | 17 |
17 TEST(BytecodeDecoder, DecodeBytecodeAndOperands) { | 18 TEST(BytecodeDecoder, DecodeBytecodeAndOperands) { |
18 struct BytecodesAndResult { | 19 struct BytecodesAndResult { |
19 const uint8_t bytecode[32]; | 20 const uint8_t bytecode[32]; |
(...skipping 18 matching lines...) Expand all Loading... |
38 {{B(Star), R8(5)}, 2, 0, " Star r5"}, | 39 {{B(Star), R8(5)}, 2, 0, " Star r5"}, |
39 {{B(Wide), B(Star), R16(136)}, 4, 0, " Star.Wide r136"}, | 40 {{B(Wide), B(Star), R16(136)}, 4, 0, " Star.Wide r136"}, |
40 {{B(Wide), B(Call), R16(134), R16(135), U16(10), U16(177)}, | 41 {{B(Wide), B(Call), R16(134), R16(135), U16(10), U16(177)}, |
41 10, | 42 10, |
42 0, | 43 0, |
43 "Call.Wide r134, r135-r144, [177]"}, | 44 "Call.Wide r134, r135-r144, [177]"}, |
44 {{B(ForInPrepare), R8(10), R8(11)}, | 45 {{B(ForInPrepare), R8(10), R8(11)}, |
45 3, | 46 3, |
46 0, | 47 0, |
47 " ForInPrepare r10, r11-r13"}, | 48 " ForInPrepare r10, r11-r13"}, |
48 {{B(CallRuntime), U16(134), R8(0), U8(0)}, | 49 {{B(CallRuntime), U16(Runtime::FunctionId::kIsDate), R8(0), U8(0)}, |
49 5, | 50 5, |
50 0, | 51 0, |
51 " CallRuntime [134], r0-r0"}, | 52 " CallRuntime [IsDate], r0-r0"}, |
52 {{B(Ldar), | 53 {{B(Ldar), |
53 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, | 54 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, |
54 2, | 55 2, |
55 3, | 56 3, |
56 " Ldar a1"}, | 57 " Ldar a1"}, |
57 {{B(Wide), B(CreateObjectLiteral), U16(513), U16(1027), U8(165), | 58 {{B(Wide), B(CreateObjectLiteral), U16(513), U16(1027), U8(165), |
58 R16(137)}, | 59 R16(137)}, |
59 9, | 60 9, |
60 0, | 61 0, |
61 "CreateObjectLiteral.Wide [513], [1027], #165, r137"}, | 62 "CreateObjectLiteral.Wide [513], [1027], #165, r137"}, |
(...skipping 24 matching lines...) Expand all Loading... |
86 cases[i].parameter_count); | 87 cases[i].parameter_count); |
87 | 88 |
88 // Compare. | 89 // Compare. |
89 CHECK_EQ(actual_ss.str(), expected_ss.str()); | 90 CHECK_EQ(actual_ss.str(), expected_ss.str()); |
90 } | 91 } |
91 } | 92 } |
92 | 93 |
93 } // namespace interpreter | 94 } // namespace interpreter |
94 } // namespace internal | 95 } // namespace internal |
95 } // namespace v8 | 96 } // namespace v8 |
OLD | NEW |