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

Side by Side Diff: test/unittests/interpreter/bytecode-pipeline-unittest.cc

Issue 2393683004: [Interpreter] Optimize the Register Optimizer. (Closed)
Patch Set: Rebase Created 4 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
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-pipeline.h" 7 #include "src/interpreter/bytecode-pipeline.h"
8 #include "src/interpreter/bytecode-register-allocator.h" 8 #include "src/interpreter/bytecode-register-allocator.h"
9 #include "src/isolate.h" 9 #include "src/isolate.h"
10 #include "test/unittests/test-utils.h" 10 #include "test/unittests/test-utils.h"
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 CHECK_EQ(node, node); 108 CHECK_EQ(node, node);
109 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], 109 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1],
110 operands[2], operands[3]); 110 operands[2], operands[3]);
111 CHECK_EQ(node, other); 111 CHECK_EQ(node, other);
112 } 112 }
113 113
114 TEST_F(BytecodeNodeTest, EqualityWithSourceInfo) { 114 TEST_F(BytecodeNodeTest, EqualityWithSourceInfo) {
115 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; 115 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc};
116 BytecodeSourceInfo first_source_info(3, true); 116 BytecodeSourceInfo first_source_info(3, true);
117 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], 117 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2],
118 operands[3], &first_source_info); 118 operands[3], first_source_info);
119 CHECK_EQ(node, node); 119 CHECK_EQ(node, node);
120 BytecodeSourceInfo second_source_info(3, true); 120 BytecodeSourceInfo second_source_info(3, true);
121 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], 121 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1],
122 operands[2], operands[3], &second_source_info); 122 operands[2], operands[3], second_source_info);
123 CHECK_EQ(node, other); 123 CHECK_EQ(node, other);
124 } 124 }
125 125
126 TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) { 126 TEST_F(BytecodeNodeTest, NoEqualityWithDifferentSourceInfo) {
127 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; 127 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc};
128 BytecodeSourceInfo source_info(77, true); 128 BytecodeSourceInfo source_info(77, true);
129 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], 129 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2],
130 operands[3], &source_info); 130 operands[3], source_info);
131 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1], 131 BytecodeNode other(Bytecode::kForInNext, operands[0], operands[1],
132 operands[2], operands[3]); 132 operands[2], operands[3]);
133 CHECK_NE(node, other); 133 CHECK_NE(node, other);
134 } 134 }
135 135
136 TEST_F(BytecodeNodeTest, Clone) {
137 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc};
138 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2],
139 operands[3]);
140 BytecodeNode clone(Bytecode::kIllegal);
141 clone.Clone(&node);
142 CHECK_EQ(clone, node);
143 }
144
145 TEST_F(BytecodeNodeTest, SetBytecode0) { 136 TEST_F(BytecodeNodeTest, SetBytecode0) {
146 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; 137 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc};
147 BytecodeSourceInfo source_info(77, false); 138 BytecodeSourceInfo source_info(77, false);
148 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], 139 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2],
149 operands[3], &source_info); 140 operands[3], source_info);
150 CHECK_EQ(node.source_info(), BytecodeSourceInfo(77, false)); 141 CHECK_EQ(node.source_info(), source_info);
151 142
152 BytecodeNode clone(Bytecode::kIllegal); 143 BytecodeNode clone(Bytecode::kIllegal);
153 clone.Clone(&node); 144 clone = node;
154 clone.set_bytecode(Bytecode::kNop); 145 clone.set_bytecode(Bytecode::kNop);
155 CHECK_EQ(clone.bytecode(), Bytecode::kNop); 146 CHECK_EQ(clone.bytecode(), Bytecode::kNop);
156 CHECK_EQ(clone.operand_count(), 0); 147 CHECK_EQ(clone.operand_count(), 0);
157 CHECK_EQ(clone.source_info(), BytecodeSourceInfo(77, false)); 148 CHECK_EQ(clone.source_info(), source_info);
158 } 149 }
159 150
160 TEST_F(BytecodeNodeTest, SetBytecode1) { 151 TEST_F(BytecodeNodeTest, SetBytecode1) {
161 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc}; 152 uint32_t operands[] = {0x71, 0xa5, 0x5a, 0xfc};
162 BytecodeSourceInfo source_info(77, false); 153 BytecodeSourceInfo source_info(77, false);
163 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2], 154 BytecodeNode node(Bytecode::kForInNext, operands[0], operands[1], operands[2],
164 operands[3], &source_info); 155 operands[3], source_info);
165 156
166 BytecodeNode clone(Bytecode::kIllegal); 157 BytecodeNode clone(Bytecode::kIllegal);
167 clone.Clone(&node); 158 clone = node;
168 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc); 159 clone.set_bytecode(Bytecode::kJump, 0x01aabbcc);
169 CHECK_EQ(clone.bytecode(), Bytecode::kJump); 160 CHECK_EQ(clone.bytecode(), Bytecode::kJump);
170 CHECK_EQ(clone.operand_count(), 1); 161 CHECK_EQ(clone.operand_count(), 1);
171 CHECK_EQ(clone.operand(0), 0x01aabbcc); 162 CHECK_EQ(clone.operand(0), 0x01aabbcc);
172 CHECK_EQ(clone.source_info(), BytecodeSourceInfo(77, false)); 163 CHECK_EQ(clone.source_info(), source_info);
173 } 164 }
174 165
175 } // namespace interpreter 166 } // namespace interpreter
176 } // namespace internal 167 } // namespace internal
177 } // namespace v8 168 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698