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

Side by Side Diff: test/unittests/compiler/instruction-selector-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
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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/graph.h" 7 #include "src/compiler/graph.h"
8 #include "src/compiler/schedule.h" 8 #include "src/compiler/schedule.h"
9 #include "src/flags.h" 9 #include "src/flags.h"
10 #include "test/unittests/compiler/compiler-test-utils.h" 10 #include "test/unittests/compiler/compiler-test-utils.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind()); 77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind());
78 if (output->IsConstant()) { 78 if (output->IsConstant()) {
79 int vreg = ConstantOperand::cast(output)->virtual_register(); 79 int vreg = ConstantOperand::cast(output)->virtual_register();
80 s.constants_.insert(std::make_pair(vreg, sequence.GetConstant(vreg))); 80 s.constants_.insert(std::make_pair(vreg, sequence.GetConstant(vreg)));
81 } 81 }
82 } 82 }
83 for (size_t i = 0; i < instr->InputCount(); ++i) { 83 for (size_t i = 0; i < instr->InputCount(); ++i) {
84 InstructionOperand* input = instr->InputAt(i); 84 InstructionOperand* input = instr->InputAt(i);
85 EXPECT_NE(InstructionOperand::CONSTANT, input->kind()); 85 EXPECT_NE(InstructionOperand::CONSTANT, input->kind());
86 if (input->IsImmediate()) { 86 if (input->IsImmediate()) {
87 int index = ImmediateOperand::cast(input)->index(); 87 auto imm = ImmediateOperand::cast(input);
88 s.immediates_.insert( 88 if (imm->type() == ImmediateOperand::INDEXED) {
89 std::make_pair(index, sequence.GetImmediate(index))); 89 int index = imm->indexed_value();
90 s.immediates_.insert(
91 std::make_pair(index, sequence.GetImmediate(imm)));
92 }
90 } 93 }
91 } 94 }
92 s.instructions_.push_back(instr); 95 s.instructions_.push_back(instr);
93 } 96 }
94 for (auto i : s.virtual_registers_) { 97 for (auto i : s.virtual_registers_) {
95 int const virtual_register = i.second; 98 int const virtual_register = i.second;
96 if (sequence.IsDouble(virtual_register)) { 99 if (sequence.IsDouble(virtual_register)) {
97 EXPECT_FALSE(sequence.IsReference(virtual_register)); 100 EXPECT_FALSE(sequence.IsReference(virtual_register));
98 s.doubles_.insert(virtual_register); 101 s.doubles_.insert(virtual_register);
99 } 102 }
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); 586 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
584 // Continuation. 587 // Continuation.
585 588
586 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 589 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
587 EXPECT_EQ(index, s.size()); 590 EXPECT_EQ(index, s.size());
588 } 591 }
589 592
590 } // namespace compiler 593 } // namespace compiler
591 } // namespace internal 594 } // namespace internal
592 } // namespace v8 595 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.h ('k') | test/unittests/compiler/instruction-sequence-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698