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

Side by Side Diff: test/unittests/compiler/interpreter-assembler-unittest.cc

Issue 1370893002: [Interpreter] Add support for short (16 bit) operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix Win bots. Created 5 years, 2 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 unified diff | Download patch
OLDNEW
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 "test/unittests/compiler/interpreter-assembler-unittest.h" 5 #include "test/unittests/compiler/interpreter-assembler-unittest.h"
6 6
7 #include "src/code-factory.h" 7 #include "src/code-factory.h"
8 #include "src/compiler/graph.h" 8 #include "src/compiler/graph.h"
9 #include "src/compiler/node.h" 9 #include "src/compiler/node.h"
10 #include "src/interface-descriptors.h" 10 #include "src/interface-descriptors.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 template <class... A> 80 template <class... A>
81 Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsCall( 81 Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::IsCall(
82 const Matcher<const CallDescriptor*>& descriptor_matcher, A... args) { 82 const Matcher<const CallDescriptor*>& descriptor_matcher, A... args) {
83 return ::i::compiler::IsCall(descriptor_matcher, args..., graph()->start(), 83 return ::i::compiler::IsCall(descriptor_matcher, args..., graph()->start(),
84 graph()->start()); 84 graph()->start());
85 } 85 }
86 86
87 87
88 Matcher<Node*> 88 Matcher<Node*>
89 InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand( 89 InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperand(
90 int operand) { 90 int offset) {
91 return IsLoad( 91 return IsLoad(
92 kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter), 92 kMachUint8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
93 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), 93 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
94 IsInt32Constant(1 + operand))); 94 IsInt32Constant(offset)));
95 } 95 }
96 96
97 97
98 Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest:: 98 Matcher<Node*> InterpreterAssemblerTest::InterpreterAssemblerForTest::
99 IsBytecodeOperandSignExtended(int operand) { 99 IsBytecodeOperandSignExtended(int offset) {
100 Matcher<Node*> load_matcher = IsLoad( 100 Matcher<Node*> load_matcher = IsLoad(
101 kMachInt8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter), 101 kMachInt8, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
102 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter), 102 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
103 IsInt32Constant(1 + operand))); 103 IsInt32Constant(offset)));
104 if (kPointerSize == 8) { 104 if (kPointerSize == 8) {
105 load_matcher = IsChangeInt32ToInt64(load_matcher); 105 load_matcher = IsChangeInt32ToInt64(load_matcher);
106 } 106 }
107 return load_matcher; 107 return load_matcher;
108 } 108 }
109 109
110 110
111 Matcher<Node*>
112 InterpreterAssemblerTest::InterpreterAssemblerForTest::IsBytecodeOperandWide(
113 int offset) {
114 return IsLoad(
115 kMachUint16, IsParameter(Linkage::kInterpreterBytecodeArrayParameter),
116 IsIntPtrAdd(IsParameter(Linkage::kInterpreterBytecodeOffsetParameter),
117 IsInt32Constant(offset)));
118 }
119
120
111 Graph* 121 Graph*
112 InterpreterAssemblerTest::InterpreterAssemblerForTest::GetCompletedGraph() { 122 InterpreterAssemblerTest::InterpreterAssemblerForTest::GetCompletedGraph() {
113 End(); 123 End();
114 return graph(); 124 return graph();
115 } 125 }
116 126
117 127
118 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) { 128 TARGET_TEST_F(InterpreterAssemblerTest, Dispatch) {
119 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 129 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
120 InterpreterAssemblerForTest m(this, bytecode); 130 InterpreterAssemblerForTest m(this, bytecode);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 graph->start(), graph->start())); 271 graph->start(), graph->start()));
262 } 272 }
263 } 273 }
264 274
265 275
266 TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) { 276 TARGET_TEST_F(InterpreterAssemblerTest, BytecodeOperand) {
267 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) { 277 TRACED_FOREACH(interpreter::Bytecode, bytecode, kBytecodes) {
268 InterpreterAssemblerForTest m(this, bytecode); 278 InterpreterAssemblerForTest m(this, bytecode);
269 int number_of_operands = interpreter::Bytecodes::NumberOfOperands(bytecode); 279 int number_of_operands = interpreter::Bytecodes::NumberOfOperands(bytecode);
270 for (int i = 0; i < number_of_operands; i++) { 280 for (int i = 0; i < number_of_operands; i++) {
281 int offset = interpreter::Bytecodes::GetOperandOffset(bytecode, i);
271 switch (interpreter::Bytecodes::GetOperandType(bytecode, i)) { 282 switch (interpreter::Bytecodes::GetOperandType(bytecode, i)) {
272 case interpreter::OperandType::kCount: 283 case interpreter::OperandType::kCount:
273 EXPECT_THAT(m.BytecodeOperandCount(i), m.IsBytecodeOperand(i)); 284 EXPECT_THAT(m.BytecodeOperandCount(i), m.IsBytecodeOperand(offset));
274 break; 285 break;
275 case interpreter::OperandType::kIdx: 286 case interpreter::OperandType::kIdx:
276 EXPECT_THAT(m.BytecodeOperandIdx(i), m.IsBytecodeOperand(i)); 287 EXPECT_THAT(m.BytecodeOperandIdx(i), m.IsBytecodeOperand(offset));
277 break; 288 break;
278 case interpreter::OperandType::kImm8: 289 case interpreter::OperandType::kImm8:
279 EXPECT_THAT(m.BytecodeOperandImm8(i), 290 EXPECT_THAT(m.BytecodeOperandImm8(i),
280 m.IsBytecodeOperandSignExtended(i)); 291 m.IsBytecodeOperandSignExtended(offset));
281 break; 292 break;
282 case interpreter::OperandType::kReg: 293 case interpreter::OperandType::kReg:
283 EXPECT_THAT(m.BytecodeOperandReg(i), 294 EXPECT_THAT(m.BytecodeOperandReg(i),
284 m.IsBytecodeOperandSignExtended(i)); 295 m.IsBytecodeOperandSignExtended(offset));
296 break;
297 case interpreter::OperandType::kWideIdx:
298 EXPECT_THAT(m.BytecodeOperandWideIdx(i),
299 m.IsBytecodeOperandWide(offset));
285 break; 300 break;
286 case interpreter::OperandType::kNone: 301 case interpreter::OperandType::kNone:
287 UNREACHABLE(); 302 UNREACHABLE();
288 break; 303 break;
289 } 304 }
290 } 305 }
291 } 306 }
292 } 307 }
293 308
294 309
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 feedback_vector, 540 feedback_vector,
526 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher, 541 m.IsLoad(kMachAnyTagged, load_shared_function_info_matcher,
527 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset - 542 IsIntPtrConstant(SharedFunctionInfo::kFeedbackVectorOffset -
528 kHeapObjectTag))); 543 kHeapObjectTag)));
529 } 544 }
530 } 545 }
531 546
532 } // namespace compiler 547 } // namespace compiler
533 } // namespace internal 548 } // namespace internal
534 } // namespace v8 549 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698