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

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

Issue 1399423002: [turbofan] Introduce node regions for protection from scheduling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move RelaxControls 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
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 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) { 234 TARGET_TEST_F(InstructionSelectorTest, ReferenceParameter) {
235 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged); 235 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
236 Node* param = m.Parameter(0); 236 Node* param = m.Parameter(0);
237 m.Return(param); 237 m.Return(param);
238 Stream s = m.Build(kAllInstructions); 238 Stream s = m.Build(kAllInstructions);
239 EXPECT_TRUE(s.IsReference(param)); 239 EXPECT_TRUE(s.IsReference(param));
240 } 240 }
241 241
242 242
243 // ----------------------------------------------------------------------------- 243 // -----------------------------------------------------------------------------
244 // Finish. 244 // FinishRegion.
245 245
246 246
247 TARGET_TEST_F(InstructionSelectorTest, Finish) { 247 TARGET_TEST_F(InstructionSelectorTest, FinishRegion) {
248 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged); 248 StreamBuilder m(this, kMachAnyTagged, kMachAnyTagged);
249 Node* param = m.Parameter(0); 249 Node* param = m.Parameter(0);
250 Node* finish = m.AddNode(m.common()->Finish(1), param, m.graph()->start()); 250 Node* finish =
251 m.AddNode(m.common()->FinishRegion(), param, m.graph()->start());
251 m.Return(finish); 252 m.Return(finish);
252 Stream s = m.Build(kAllInstructions); 253 Stream s = m.Build(kAllInstructions);
253 ASSERT_EQ(4U, s.size()); 254 ASSERT_EQ(4U, s.size());
254 EXPECT_EQ(kArchNop, s[0]->arch_opcode()); 255 EXPECT_EQ(kArchNop, s[0]->arch_opcode());
255 ASSERT_EQ(1U, s[0]->OutputCount()); 256 ASSERT_EQ(1U, s[0]->OutputCount());
256 ASSERT_TRUE(s[0]->Output()->IsUnallocated()); 257 ASSERT_TRUE(s[0]->Output()->IsUnallocated());
257 EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->Output())); 258 EXPECT_EQ(s.ToVreg(param), s.ToVreg(s[0]->Output()));
258 EXPECT_EQ(kArchNop, s[1]->arch_opcode()); 259 EXPECT_EQ(kArchNop, s[1]->arch_opcode());
259 ASSERT_EQ(1U, s[1]->InputCount()); 260 ASSERT_EQ(1U, s[1]->InputCount());
260 ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated()); 261 ASSERT_TRUE(s[1]->InputAt(0)->IsUnallocated());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 // ValueEffect. 327 // ValueEffect.
327 328
328 329
329 TARGET_TEST_F(InstructionSelectorTest, ValueEffect) { 330 TARGET_TEST_F(InstructionSelectorTest, ValueEffect) {
330 StreamBuilder m1(this, kMachInt32, kMachPtr); 331 StreamBuilder m1(this, kMachInt32, kMachPtr);
331 Node* p1 = m1.Parameter(0); 332 Node* p1 = m1.Parameter(0);
332 m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0))); 333 m1.Return(m1.Load(kMachInt32, p1, m1.Int32Constant(0)));
333 Stream s1 = m1.Build(kAllInstructions); 334 Stream s1 = m1.Build(kAllInstructions);
334 StreamBuilder m2(this, kMachInt32, kMachPtr); 335 StreamBuilder m2(this, kMachInt32, kMachPtr);
335 Node* p2 = m2.Parameter(0); 336 Node* p2 = m2.Parameter(0);
336 m2.Return(m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0), 337 m2.Return(
337 m2.AddNode(m2.common()->ValueEffect(1), p2))); 338 m2.AddNode(m2.machine()->Load(kMachInt32), p2, m2.Int32Constant(0),
339 m2.AddNode(m2.common()->BeginRegion(), m2.graph()->start())));
338 Stream s2 = m2.Build(kAllInstructions); 340 Stream s2 = m2.Build(kAllInstructions);
339 EXPECT_LE(3U, s1.size()); 341 EXPECT_LE(3U, s1.size());
340 ASSERT_EQ(s1.size(), s2.size()); 342 ASSERT_EQ(s1.size(), s2.size());
341 TRACED_FORRANGE(size_t, i, 0, s1.size() - 1) { 343 TRACED_FORRANGE(size_t, i, 0, s1.size() - 1) {
342 const Instruction* i1 = s1[i]; 344 const Instruction* i1 = s1[i];
343 const Instruction* i2 = s2[i]; 345 const Instruction* i2 = s2[i];
344 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode()); 346 EXPECT_EQ(i1->arch_opcode(), i2->arch_opcode());
345 EXPECT_EQ(i1->InputCount(), i2->InputCount()); 347 EXPECT_EQ(i1->InputCount(), i2->InputCount());
346 EXPECT_EQ(i1->OutputCount(), i2->OutputCount()); 348 EXPECT_EQ(i1->OutputCount(), i2->OutputCount());
347 } 349 }
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
610 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14))); 612 EXPECT_EQ(s.ToVreg(context2), s.ToVreg(call_instr->InputAt(14)));
611 // Continuation. 613 // Continuation.
612 614
613 EXPECT_EQ(kArchRet, s[index++]->arch_opcode()); 615 EXPECT_EQ(kArchRet, s[index++]->arch_opcode());
614 EXPECT_EQ(index, s.size()); 616 EXPECT_EQ(index, s.size());
615 } 617 }
616 618
617 } // namespace compiler 619 } // namespace compiler
618 } // namespace internal 620 } // namespace internal
619 } // namespace v8 621 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/common-operator-unittest.cc ('k') | test/unittests/compiler/js-typed-lowering-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698