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

Side by Side Diff: test/unittests/compiler/checkpoint-elimination-unittest.cc

Issue 2022913003: [turbofan] Implement simplistic checkpoint reducer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Move into separate reducer. Created 4 years, 6 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "src/compiler/checkpoint-elimination.h"
6 #include "src/compiler/common-operator.h"
7 #include "src/compiler/operator.h"
8 #include "test/unittests/compiler/graph-reducer-unittest.h"
9 #include "test/unittests/compiler/graph-unittest.h"
10 #include "test/unittests/compiler/node-test-utils.h"
11
12 using testing::StrictMock;
13
14 namespace v8 {
15 namespace internal {
16 namespace compiler {
17
18 class CheckpointEliminationTest : public GraphTest {
19 public:
20 CheckpointEliminationTest() : GraphTest() {}
21 ~CheckpointEliminationTest() override {}
22
23 protected:
24 Reduction Reduce(AdvancedReducer::Editor* editor, Node* node) {
25 CheckpointElimination reducer(editor);
26 return reducer.Reduce(node);
27 }
28
29 Reduction Reduce(Node* node) {
30 StrictMock<MockAdvancedReducerEditor> editor;
31 return Reduce(&editor, node);
32 }
33 };
34
35 namespace {
36
37 const Operator kOpNoWrite(0, Operator::kNoWrite, "OpNoWrite", 0, 1, 0, 0, 1, 0);
38
39 } // namespace
40
41 // -----------------------------------------------------------------------------
42 // CheckPoint
43
44 TEST_F(CheckpointEliminationTest, CheckPointChain) {
45 Node* const control = graph()->start();
46 Node* frame_state = EmptyFrameState();
47 Node* checkpoint1 = graph()->NewNode(common()->CheckPoint(), frame_state,
48 graph()->start(), control);
49 Node* effect_link = graph()->NewNode(&kOpNoWrite, checkpoint1);
50 Node* checkpoint2 = graph()->NewNode(common()->CheckPoint(), frame_state,
51 effect_link, control);
52 Reduction r = Reduce(checkpoint2);
53 ASSERT_TRUE(r.Changed());
54 EXPECT_EQ(effect_link, r.replacement());
55 }
56
57 } // namespace compiler
58 } // namespace internal
59 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698