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

Side by Side Diff: test/unittests/compiler/register-allocator-unittest.cc

Issue 1018853003: [turbofan] add non fixed slot constraint to register allocator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « test/unittests/compiler/instruction-sequence-unittest.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 "src/compiler/pipeline.h" 5 #include "src/compiler/pipeline.h"
6 #include "test/unittests/compiler/instruction-sequence-unittest.h" 6 #include "test/unittests/compiler/instruction-sequence-unittest.h"
7 7
8 namespace v8 { 8 namespace v8 {
9 namespace internal { 9 namespace internal {
10 namespace compiler { 10 namespace compiler {
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 484
485 StartBlock(); 485 StartBlock();
486 // Force c to split within to_spill's definition. 486 // Force c to split within to_spill's definition.
487 EmitI(Reg(c)); 487 EmitI(Reg(c));
488 EmitI(Reg(to_spill)); 488 EmitI(Reg(to_spill));
489 EndBlock(Last()); 489 EndBlock(Last());
490 490
491 Allocate(); 491 Allocate();
492 } 492 }
493 493
494
495 namespace {
496
497 enum class ParameterType { kFixedSlot, kSlot, kRegister, kFixedRegister };
498
499 const ParameterType kParameterTypes[] = {
500 ParameterType::kFixedSlot, ParameterType::kSlot, ParameterType::kRegister,
501 ParameterType::kFixedRegister};
502
503 class SlotConstraintTest : public RegisterAllocatorTest,
504 public ::testing::WithParamInterface<
505 ::testing::tuple<ParameterType, int>> {
506 public:
507 static const int kMaxVariant = 5;
508
509 protected:
510 ParameterType parameter_type() const {
511 return ::testing::get<0>(B::GetParam());
512 }
513 int variant() const { return ::testing::get<1>(B::GetParam()); }
514
515 private:
516 typedef ::testing::WithParamInterface<::testing::tuple<ParameterType, int>> B;
517 };
518 }
519
520
521 #if GTEST_HAS_COMBINE
522
523 TEST_P(SlotConstraintTest, SlotConstraint) {
524 StartBlock();
525 VReg p_0;
526 switch (parameter_type()) {
527 case ParameterType::kFixedSlot:
528 p_0 = Parameter(Slot(-1));
529 break;
530 case ParameterType::kSlot:
531 p_0 = Parameter(Slot(-1));
532 break;
533 case ParameterType::kRegister:
534 p_0 = Parameter(Reg());
535 break;
536 case ParameterType::kFixedRegister:
537 p_0 = Parameter(Reg(1));
538 break;
539 }
540 switch (variant()) {
541 case 0:
542 EmitI(Slot(p_0), Reg(p_0));
543 break;
544 case 1:
545 EmitI(Slot(p_0));
546 break;
547 case 2:
548 EmitI(Reg(p_0));
549 EmitI(Slot(p_0));
550 break;
551 case 3:
552 EmitI(Slot(p_0));
553 EmitI(Reg(p_0));
554 break;
555 case 4:
556 EmitI(Slot(p_0, -1), Slot(p_0), Reg(p_0), Reg(p_0, 1));
557 break;
558 default:
559 UNREACHABLE();
560 break;
561 }
562 EndBlock(Last());
563
564 Allocate();
565 }
566
567
568 INSTANTIATE_TEST_CASE_P(
569 RegisterAllocatorTest, SlotConstraintTest,
570 ::testing::Combine(::testing::ValuesIn(kParameterTypes),
571 ::testing::Range(0, SlotConstraintTest::kMaxVariant)));
572
573 #endif // GTEST_HAS_COMBINE
574
494 } // namespace compiler 575 } // namespace compiler
495 } // namespace internal 576 } // namespace internal
496 } // namespace v8 577 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/instruction-sequence-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698