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

Unified Diff: test/unittests/compiler/coalesced-live-ranges-unittest.cc

Issue 1305313008: [turbofan] Factored out the test live range builder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/unittests/compiler/live-range-builder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/unittests/compiler/coalesced-live-ranges-unittest.cc
diff --git a/test/unittests/compiler/coalesced-live-ranges-unittest.cc b/test/unittests/compiler/coalesced-live-ranges-unittest.cc
index e728c9ff6461ae1cecb174ea9b1076c0f8718aef..fe8fac4bfe815fa44d09988383a4a6cd966497a4 100644
--- a/test/unittests/compiler/coalesced-live-ranges-unittest.cc
+++ b/test/unittests/compiler/coalesced-live-ranges-unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "src/compiler/coalesced-live-ranges.h"
+#include "test/unittests/compiler/live-range-builder.h"
#include "test/unittests/test-utils.h"
namespace v8 {
@@ -10,50 +11,6 @@ namespace internal {
namespace compiler {
-// Utility offering shorthand syntax for building up a range by providing its ID
-// and pairs (start, end) specifying intervals. Circumvents current incomplete
-// support for C++ features such as instantiation lists, on OS X and Android.
-class TestRangeBuilder {
- public:
- explicit TestRangeBuilder(Zone* zone) : id_(-1), pairs_(), zone_(zone) {}
-
- TestRangeBuilder& Id(int id) {
- id_ = id;
- return *this;
- }
- TestRangeBuilder& Add(int start, int end) {
- pairs_.push_back({start, end});
- return *this;
- }
-
- LiveRange* Build(int start, int end) { return Add(start, end).Build(); }
-
- LiveRange* Build() {
- TopLevelLiveRange* range =
- new (zone_) TopLevelLiveRange(id_, MachineType::kRepTagged);
- // Traverse the provided interval specifications backwards, because that is
- // what LiveRange expects.
- for (int i = static_cast<int>(pairs_.size()) - 1; i >= 0; --i) {
- Interval pair = pairs_[i];
- LifetimePosition start = LifetimePosition::FromInt(pair.first);
- LifetimePosition end = LifetimePosition::FromInt(pair.second);
- CHECK(start < end);
- range->AddUseInterval(start, end, zone_);
- }
-
- pairs_.clear();
- return range;
- }
-
- private:
- typedef std::pair<int, int> Interval;
- typedef std::vector<Interval> IntervalList;
- int id_;
- IntervalList pairs_;
- Zone* zone_;
-};
-
-
class CoalescedLiveRangesTest : public TestWithZone {
public:
CoalescedLiveRangesTest() : TestWithZone(), ranges_(zone()) {}
« no previous file with comments | « no previous file | test/unittests/compiler/live-range-builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698