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

Side by Side Diff: test/unittests/compiler/instruction-sequence-unittest.cc

Issue 1075903002: [turbofan] support small immediates (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 unified diff | Download patch
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/base/utils/random-number-generator.h" 5 #include "src/base/utils/random-number-generator.h"
6 #include "src/compiler/pipeline.h" 6 #include "src/compiler/pipeline.h"
7 #include "test/unittests/compiler/instruction-sequence-unittest.h" 7 #include "test/unittests/compiler/instruction-sequence-unittest.h"
8 #include "test/unittests/test-utils.h" 8 #include "test/unittests/test-utils.h"
9 #include "testing/gmock/include/gmock/gmock.h" 9 #include "testing/gmock/include/gmock/gmock.h"
10 10
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 } 122 }
123 completions_.push_back(completion); 123 completions_.push_back(completion);
124 CHECK(current_block_ != nullptr); 124 CHECK(current_block_ != nullptr);
125 sequence()->EndBlock(current_block_->rpo_number()); 125 sequence()->EndBlock(current_block_->rpo_number());
126 current_block_ = nullptr; 126 current_block_ = nullptr;
127 return result; 127 return result;
128 } 128 }
129 129
130 130
131 InstructionSequenceTest::TestOperand InstructionSequenceTest::Imm(int32_t imm) { 131 InstructionSequenceTest::TestOperand InstructionSequenceTest::Imm(int32_t imm) {
132 int index = sequence()->AddImmediate(Constant(imm)); 132 return TestOperand(kImmediate, imm);
133 return TestOperand(kImmediate, index);
134 } 133 }
135 134
136 135
137 InstructionSequenceTest::VReg InstructionSequenceTest::Define( 136 InstructionSequenceTest::VReg InstructionSequenceTest::Define(
138 TestOperand output_op) { 137 TestOperand output_op) {
139 VReg vreg = NewReg(); 138 VReg vreg = NewReg();
140 InstructionOperand outputs[1]{ConvertOutputOp(vreg, output_op)}; 139 InstructionOperand outputs[1]{ConvertOutputOp(vreg, output_op)};
141 Emit(kArchNop, 1, outputs); 140 Emit(kArchNop, 1, outputs);
142 return vreg; 141 return vreg;
143 } 142 }
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
350 for (size_t i = 0; i < input_size; ++i) { 349 for (size_t i = 0; i < input_size; ++i) {
351 mapped_inputs[i] = ConvertInputOp(inputs[i]); 350 mapped_inputs[i] = ConvertInputOp(inputs[i]);
352 } 351 }
353 return mapped_inputs; 352 return mapped_inputs;
354 } 353 }
355 354
356 355
357 InstructionOperand InstructionSequenceTest::ConvertInputOp(TestOperand op) { 356 InstructionOperand InstructionSequenceTest::ConvertInputOp(TestOperand op) {
358 if (op.type_ == kImmediate) { 357 if (op.type_ == kImmediate) {
359 CHECK_EQ(op.vreg_.value_, kNoValue); 358 CHECK_EQ(op.vreg_.value_, kNoValue);
360 return ImmediateOperand(op.value_); 359 return ImmediateOperand(ImmediateOperand::INLINE, op.value_);
361 } 360 }
362 CHECK_NE(op.vreg_.value_, kNoValue); 361 CHECK_NE(op.vreg_.value_, kNoValue);
363 switch (op.type_) { 362 switch (op.type_) {
364 case kNone: 363 case kNone:
365 return Unallocated(op, UnallocatedOperand::NONE, 364 return Unallocated(op, UnallocatedOperand::NONE,
366 UnallocatedOperand::USED_AT_START); 365 UnallocatedOperand::USED_AT_START);
367 case kUnique: 366 case kUnique:
368 return Unallocated(op, UnallocatedOperand::NONE); 367 return Unallocated(op, UnallocatedOperand::NONE);
369 case kUniqueRegister: 368 case kUniqueRegister:
370 return Unallocated(op, UnallocatedOperand::MUST_HAVE_REGISTER); 369 return Unallocated(op, UnallocatedOperand::MUST_HAVE_REGISTER);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 483
485 484
486 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) { 485 Instruction* InstructionSequenceTest::AddInstruction(Instruction* instruction) {
487 sequence()->AddInstruction(instruction); 486 sequence()->AddInstruction(instruction);
488 return instruction; 487 return instruction;
489 } 488 }
490 489
491 } // namespace compiler 490 } // namespace compiler
492 } // namespace internal 491 } // namespace internal
493 } // namespace v8 492 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698