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

Side by Side Diff: test/cctest/compiler/test-instruction.cc

Issue 814043002: Revert of [turbofan] remove control field from instruction (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 6 years 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 "src/v8.h" 5 #include "src/v8.h"
6 #include "test/cctest/cctest.h" 6 #include "test/cctest/cctest.h"
7 7
8 #include "src/compiler/code-generator.h" 8 #include "src/compiler/code-generator.h"
9 #include "src/compiler/common-operator.h" 9 #include "src/compiler/common-operator.h"
10 #include "src/compiler/graph.h" 10 #include "src/compiler/graph.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 201
202 202
203 TEST(InstructionIsGapAt) { 203 TEST(InstructionIsGapAt) {
204 InstructionTester R; 204 InstructionTester R;
205 205
206 BasicBlock* b0 = R.schedule.start(); 206 BasicBlock* b0 = R.schedule.start();
207 R.schedule.AddReturn(b0, R.Int32Constant(1)); 207 R.schedule.AddReturn(b0, R.Int32Constant(1));
208 208
209 R.allocCode(); 209 R.allocCode();
210 TestInstr* i0 = TestInstr::New(R.zone(), 100); 210 TestInstr* i0 = TestInstr::New(R.zone(), 100);
211 TestInstr* g = TestInstr::New(R.zone(), 103); 211 TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl();
212 R.code->StartBlock(b0->GetRpoNumber()); 212 R.code->StartBlock(b0->GetRpoNumber());
213 R.code->AddInstruction(i0); 213 R.code->AddInstruction(i0);
214 R.code->AddInstruction(g); 214 R.code->AddInstruction(g);
215 R.code->EndBlock(b0->GetRpoNumber()); 215 R.code->EndBlock(b0->GetRpoNumber());
216 216
217 CHECK(R.code->instructions().size() == 4); 217 CHECK(R.code->instructions().size() == 4);
218 for (size_t i = 0; i < R.code->instructions().size(); ++i) { 218 for (size_t i = 0; i < R.code->instructions().size(); ++i) {
219 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves()); 219 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves());
220 } 220 }
221 } 221 }
222 222
223 223
224 TEST(InstructionIsGapAt2) { 224 TEST(InstructionIsGapAt2) {
225 InstructionTester R; 225 InstructionTester R;
226 226
227 BasicBlock* b0 = R.schedule.start(); 227 BasicBlock* b0 = R.schedule.start();
228 BasicBlock* b1 = R.schedule.end(); 228 BasicBlock* b1 = R.schedule.end();
229 R.schedule.AddGoto(b0, b1); 229 R.schedule.AddGoto(b0, b1);
230 R.schedule.AddReturn(b1, R.Int32Constant(1)); 230 R.schedule.AddReturn(b1, R.Int32Constant(1));
231 231
232 R.allocCode(); 232 R.allocCode();
233 TestInstr* i0 = TestInstr::New(R.zone(), 100); 233 TestInstr* i0 = TestInstr::New(R.zone(), 100);
234 TestInstr* g = TestInstr::New(R.zone(), 103); 234 TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl();
235 R.code->StartBlock(b0->GetRpoNumber()); 235 R.code->StartBlock(b0->GetRpoNumber());
236 R.code->AddInstruction(i0); 236 R.code->AddInstruction(i0);
237 R.code->AddInstruction(g); 237 R.code->AddInstruction(g);
238 R.code->EndBlock(b0->GetRpoNumber()); 238 R.code->EndBlock(b0->GetRpoNumber());
239 239
240 TestInstr* i1 = TestInstr::New(R.zone(), 102); 240 TestInstr* i1 = TestInstr::New(R.zone(), 102);
241 TestInstr* g1 = TestInstr::New(R.zone(), 104); 241 TestInstr* g1 = TestInstr::New(R.zone(), 104)->MarkAsControl();
242 R.code->StartBlock(b1->GetRpoNumber()); 242 R.code->StartBlock(b1->GetRpoNumber());
243 R.code->AddInstruction(i1); 243 R.code->AddInstruction(i1);
244 R.code->AddInstruction(g1); 244 R.code->AddInstruction(g1);
245 R.code->EndBlock(b1->GetRpoNumber()); 245 R.code->EndBlock(b1->GetRpoNumber());
246 246
247 CHECK(R.code->instructions().size() == 8); 247 CHECK(R.code->instructions().size() == 8);
248 for (size_t i = 0; i < R.code->instructions().size(); ++i) { 248 for (size_t i = 0; i < R.code->instructions().size(); ++i) {
249 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves()); 249 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves());
250 } 250 }
251 } 251 }
252 252
253 253
254 TEST(InstructionAddGapMove) { 254 TEST(InstructionAddGapMove) {
255 InstructionTester R; 255 InstructionTester R;
256 256
257 BasicBlock* b0 = R.schedule.start(); 257 BasicBlock* b0 = R.schedule.start();
258 R.schedule.AddReturn(b0, R.Int32Constant(1)); 258 R.schedule.AddReturn(b0, R.Int32Constant(1));
259 259
260 R.allocCode(); 260 R.allocCode();
261 TestInstr* i0 = TestInstr::New(R.zone(), 100); 261 TestInstr* i0 = TestInstr::New(R.zone(), 100);
262 TestInstr* g = TestInstr::New(R.zone(), 103); 262 TestInstr* g = TestInstr::New(R.zone(), 103)->MarkAsControl();
263 R.code->StartBlock(b0->GetRpoNumber()); 263 R.code->StartBlock(b0->GetRpoNumber());
264 R.code->AddInstruction(i0); 264 R.code->AddInstruction(i0);
265 R.code->AddInstruction(g); 265 R.code->AddInstruction(g);
266 R.code->EndBlock(b0->GetRpoNumber()); 266 R.code->EndBlock(b0->GetRpoNumber());
267 267
268 CHECK(R.code->instructions().size() == 4); 268 CHECK(R.code->instructions().size() == 4);
269 for (size_t i = 0; i < R.code->instructions().size(); ++i) { 269 for (size_t i = 0; i < R.code->instructions().size(); ++i) {
270 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves()); 270 CHECK_EQ(i % 2 == 0, R.code->instructions()[i]->IsGapMoves());
271 } 271 }
272 272
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 CHECK_EQ(inputs[z], m->InputAt(z)); 335 CHECK_EQ(inputs[z], m->InputAt(z));
336 } 336 }
337 337
338 for (size_t z = 0; z < k; z++) { 338 for (size_t z = 0; z < k; z++) {
339 CHECK_EQ(temps[z], m->TempAt(z)); 339 CHECK_EQ(temps[z], m->TempAt(z));
340 } 340 }
341 } 341 }
342 } 342 }
343 } 343 }
344 } 344 }
OLDNEW
« no previous file with comments | « src/compiler/x64/instruction-selector-x64.cc ('k') | test/cctest/compiler/test-jump-threading.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698