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

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

Issue 1050803002: [turbofan] cleanup InstructionOperand a little (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 continue; 69 continue;
70 } 70 }
71 } 71 }
72 if (mode == kAllExceptNopInstructions && instr->arch_opcode() == kArchNop) { 72 if (mode == kAllExceptNopInstructions && instr->arch_opcode() == kArchNop) {
73 continue; 73 continue;
74 } 74 }
75 for (size_t i = 0; i < instr->OutputCount(); ++i) { 75 for (size_t i = 0; i < instr->OutputCount(); ++i) {
76 InstructionOperand* output = instr->OutputAt(i); 76 InstructionOperand* output = instr->OutputAt(i);
77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind()); 77 EXPECT_NE(InstructionOperand::IMMEDIATE, output->kind());
78 if (output->IsConstant()) { 78 if (output->IsConstant()) {
79 s.constants_.insert(std::make_pair( 79 int vreg = ConstantOperand::cast(output)->virtual_register();
80 output->index(), sequence.GetConstant(output->index()))); 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 s.immediates_.insert(std::make_pair( 87 int index = ImmediateOperand::cast(input)->index();
88 input->index(), sequence.GetImmediate(input->index()))); 88 s.immediates_.insert(
89 std::make_pair(index, sequence.GetImmediate(index)));
89 } 90 }
90 } 91 }
91 s.instructions_.push_back(instr); 92 s.instructions_.push_back(instr);
92 } 93 }
93 for (auto i : s.virtual_registers_) { 94 for (auto i : s.virtual_registers_) {
94 int const virtual_register = i.second; 95 int const virtual_register = i.second;
95 if (sequence.IsDouble(virtual_register)) { 96 if (sequence.IsDouble(virtual_register)) {
96 EXPECT_FALSE(sequence.IsReference(virtual_register)); 97 EXPECT_FALSE(sequence.IsReference(virtual_register));
97 s.doubles_.insert(virtual_register); 98 s.doubles_.insert(virtual_register);
98 } 99 }
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); 583 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
583 // Continuation. 584 // Continuation.
584 585
585 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 586 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
586 EXPECT_EQ(index, s.size()); 587 EXPECT_EQ(index, s.size());
587 } 588 }
588 589
589 } // namespace compiler 590 } // namespace compiler
590 } // namespace internal 591 } // namespace internal
591 } // namespace v8 592 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-selector-unittest.h ('k') | test/unittests/compiler/move-optimizer-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698