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

Side by Side Diff: test/cctest/compiler/test-gap-resolver.cc

Issue 1287383003: Re-reland: Remove register index/code indirection (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix MIPS tests again 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
« no previous file with comments | « src/x87/assembler-x87.h ('k') | test/cctest/compiler/test-run-native-calls.cc » ('j') | 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/compiler/gap-resolver.h" 5 #include "src/compiler/gap-resolver.h"
6 6
7 #include "src/base/utils/random-number-generator.h" 7 #include "src/base/utils/random-number-generator.h"
8 #include "test/cctest/cctest.h" 8 #include "test/cctest/cctest.h"
9 9
10 using namespace v8::internal; 10 using namespace v8::internal;
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 } else { 66 } else {
67 values_[KeyFor(op)] = v; 67 values_[KeyFor(op)] = v;
68 } 68 }
69 } 69 }
70 70
71 static Key KeyFor(const InstructionOperand& op) { 71 static Key KeyFor(const InstructionOperand& op) {
72 bool is_constant = op.IsConstant(); 72 bool is_constant = op.IsConstant();
73 AllocatedOperand::AllocatedKind kind; 73 AllocatedOperand::AllocatedKind kind;
74 int index; 74 int index;
75 if (!is_constant) { 75 if (!is_constant) {
76 index = AllocatedOperand::cast(op).index(); 76 if (op.IsRegister()) {
77 index = AllocatedOperand::cast(op).GetRegister().code();
78 } else if (op.IsDoubleRegister()) {
79 index = AllocatedOperand::cast(op).GetDoubleRegister().code();
80 } else {
81 index = AllocatedOperand::cast(op).index();
82 }
77 kind = AllocatedOperand::cast(op).allocated_kind(); 83 kind = AllocatedOperand::cast(op).allocated_kind();
78 } else { 84 } else {
79 index = ConstantOperand::cast(op).virtual_register(); 85 index = ConstantOperand::cast(op).virtual_register();
80 kind = AllocatedOperand::REGISTER; 86 kind = AllocatedOperand::REGISTER;
81 } 87 }
82 Key key = {is_constant, kind, index}; 88 Key key = {is_constant, kind, index};
83 return key; 89 return key;
84 } 90 }
85 91
86 static Value ValueFor(const InstructionOperand& op) { return KeyFor(op); } 92 static Value ValueFor(const InstructionOperand& op) { return KeyFor(op); }
87 93
88 static InstructionOperand FromKey(Key key) { 94 static InstructionOperand FromKey(Key key) {
89 if (key.is_constant) { 95 if (key.is_constant) {
90 return ConstantOperand(key.index); 96 return ConstantOperand(key.index);
91 } 97 }
92 return AllocatedOperand( 98 return AllocatedOperand(
93 key.kind, InstructionSequence::DefaultRepresentation(), key.index); 99 key.kind,
100 v8::internal::compiler::InstructionSequence::DefaultRepresentation(),
101 key.index);
94 } 102 }
95 103
96 friend std::ostream& operator<<(std::ostream& os, 104 friend std::ostream& operator<<(std::ostream& os,
97 const InterpreterState& is) { 105 const InterpreterState& is) {
98 for (OperandMap::const_iterator it = is.values_.begin(); 106 for (OperandMap::const_iterator it = is.values_.begin();
99 it != is.values_.end(); ++it) { 107 it != is.values_.end(); ++it) {
100 if (it != is.values_.begin()) os << " "; 108 if (it != is.values_.begin()) os << " ";
101 InstructionOperand source = FromKey(it->first); 109 InstructionOperand source = FromKey(it->first);
102 InstructionOperand destination = FromKey(it->second); 110 InstructionOperand destination = FromKey(it->second);
103 MoveOperands mo(source, destination); 111 MoveOperands mo(source, destination);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 mi1.AssembleParallelMove(pm); 224 mi1.AssembleParallelMove(pm);
217 225
218 MoveInterpreter mi2(pmc.main_zone()); 226 MoveInterpreter mi2(pmc.main_zone());
219 GapResolver resolver(&mi2); 227 GapResolver resolver(&mi2);
220 resolver.Resolve(pm); 228 resolver.Resolve(pm);
221 229
222 CHECK(mi1.state() == mi2.state()); 230 CHECK(mi1.state() == mi2.state());
223 } 231 }
224 } 232 }
225 } 233 }
OLDNEW
« no previous file with comments | « src/x87/assembler-x87.h ('k') | test/cctest/compiler/test-run-native-calls.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698