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

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

Issue 683933004: [turbofan] move Node to vreg mapping to InstructionSelector (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « test/cctest/compiler/test-instruction.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 "test/unittests/compiler/instruction-selector-unittest.h" 5 #include "test/unittests/compiler/instruction-selector-unittest.h"
6 6
7 #include "src/compiler/graph-inl.h" 7 #include "src/compiler/graph-inl.h"
8 #include "src/flags.h" 8 #include "src/flags.h"
9 #include "test/unittests/compiler/compiler-test-utils.h" 9 #include "test/unittests/compiler/compiler-test-utils.h"
10 10
(...skipping 19 matching lines...) Expand all
30 InstructionSelectorTest::StreamBuilderMode mode) { 30 InstructionSelectorTest::StreamBuilderMode mode) {
31 Schedule* schedule = Export(); 31 Schedule* schedule = Export();
32 if (FLAG_trace_turbo) { 32 if (FLAG_trace_turbo) {
33 OFStream out(stdout); 33 OFStream out(stdout);
34 out << "=== Schedule before instruction selection ===" << std::endl 34 out << "=== Schedule before instruction selection ===" << std::endl
35 << *schedule; 35 << *schedule;
36 } 36 }
37 EXPECT_NE(0, graph()->NodeCount()); 37 EXPECT_NE(0, graph()->NodeCount());
38 int initial_node_count = graph()->NodeCount(); 38 int initial_node_count = graph()->NodeCount();
39 Linkage linkage(test_->zone(), call_descriptor()); 39 Linkage linkage(test_->zone(), call_descriptor());
40 InstructionSequence sequence(test_->zone(), graph(), schedule); 40 InstructionSequence sequence(test_->zone(), schedule);
41 SourcePositionTable source_position_table(graph()); 41 SourcePositionTable source_position_table(graph());
42 InstructionSelector selector(test_->zone(), &linkage, &sequence, schedule, 42 InstructionSelector selector(test_->zone(), graph(), &linkage, &sequence,
43 &source_position_table, features); 43 schedule, &source_position_table, features);
44 selector.SelectInstructions(); 44 selector.SelectInstructions();
45 if (FLAG_trace_turbo) { 45 if (FLAG_trace_turbo) {
46 OFStream out(stdout); 46 OFStream out(stdout);
47 out << "=== Code sequence after instruction selection ===" << std::endl 47 out << "=== Code sequence after instruction selection ===" << std::endl
48 << sequence; 48 << sequence;
49 } 49 }
50 Stream s; 50 Stream s;
51 // Map virtual registers. 51 // Map virtual registers.
52 { 52 {
53 const NodeToVregMap& node_map = sequence.GetNodeMapForTesting(); 53 const NodeToVregMap& node_map = selector.GetNodeMapForTesting();
54 for (int i = 0; i < initial_node_count; ++i) { 54 for (int i = 0; i < initial_node_count; ++i) {
55 if (node_map[i] != InstructionSequence::kNodeUnmapped) { 55 if (node_map[i] != InstructionSelector::kNodeUnmapped) {
56 s.virtual_registers_.insert(std::make_pair(i, node_map[i])); 56 s.virtual_registers_.insert(std::make_pair(i, node_map[i]));
57 } 57 }
58 } 58 }
59 } 59 }
60 std::set<int> virtual_registers; 60 std::set<int> virtual_registers;
61 for (InstructionSequence::const_iterator i = sequence.begin(); 61 for (InstructionSequence::const_iterator i = sequence.begin();
62 i != sequence.end(); ++i) { 62 i != sequence.end(); ++i) {
63 Instruction* instr = *i; 63 Instruction* instr = *i;
64 if (instr->opcode() < 0) continue; 64 if (instr->opcode() < 0) continue;
65 if (mode == kTargetInstructions) { 65 if (mode == kTargetInstructions) {
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12))); 568 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(12)));
569 // Continuation. 569 // Continuation.
570 570
571 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 571 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
572 EXPECT_EQ(index, s.size()); 572 EXPECT_EQ(index, s.size());
573 } 573 }
574 574
575 } // namespace compiler 575 } // namespace compiler
576 } // namespace internal 576 } // namespace internal
577 } // namespace v8 577 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/compiler/test-instruction.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698