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

Side by Side Diff: test/unittests/compiler/js-builtin-reducer-unittest.cc

Issue 1513543003: [turbofan] Make MachineType a pair of enums. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Moar rebase Created 5 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/compiler/js-builtin-reducer.h" 5 #include "src/compiler/js-builtin-reducer.h"
6 #include "src/compiler/js-graph.h" 6 #include "src/compiler/js-graph.h"
7 #include "src/compiler/node-properties.h" 7 #include "src/compiler/node-properties.h"
8 #include "src/compiler/simplified-operator.h" 8 #include "src/compiler/simplified-operator.h"
9 #include "src/compiler/typer.h" 9 #include "src/compiler/typer.h"
10 #include "src/isolate-inl.h" 10 #include "src/isolate-inl.h"
11 #include "test/unittests/compiler/graph-unittest.h" 11 #include "test/unittests/compiler/graph-unittest.h"
12 #include "test/unittests/compiler/node-test-utils.h" 12 #include "test/unittests/compiler/node-test-utils.h"
13 #include "testing/gmock-support.h" 13 #include "testing/gmock-support.h"
14 14
15 using testing::BitEq; 15 using testing::BitEq;
16 using testing::Capture; 16 using testing::Capture;
17 17
18 namespace v8 { 18 namespace v8 {
19 namespace internal { 19 namespace internal {
20 namespace compiler { 20 namespace compiler {
21 21
22 class JSBuiltinReducerTest : public TypedGraphTest { 22 class JSBuiltinReducerTest : public TypedGraphTest {
23 public: 23 public:
24 JSBuiltinReducerTest() : javascript_(zone()) {} 24 JSBuiltinReducerTest() : javascript_(zone()) {}
25 25
26 protected: 26 protected:
27 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = 27 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags =
28 MachineOperatorBuilder::Flag::kNoFlags) { 28 MachineOperatorBuilder::Flag::kNoFlags) {
29 MachineOperatorBuilder machine(zone(), kMachPtr, flags); 29 MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(),
30 flags);
30 SimplifiedOperatorBuilder simplified(zone()); 31 SimplifiedOperatorBuilder simplified(zone());
31 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, 32 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified,
32 &machine); 33 &machine);
33 // TODO(titzer): mock the GraphReducer here for better unit testing. 34 // TODO(titzer): mock the GraphReducer here for better unit testing.
34 GraphReducer graph_reducer(zone(), graph()); 35 GraphReducer graph_reducer(zone(), graph());
35 JSBuiltinReducer reducer(&graph_reducer, &jsgraph); 36 JSBuiltinReducer reducer(&graph_reducer, &jsgraph);
36 return reducer.Reduce(node); 37 return reducer.Reduce(node);
37 } 38 }
38 39
39 Node* MathFunction(const char* name) { 40 Node* MathFunction(const char* name) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 Node* p0 = Parameter(t0, 0); 136 Node* p0 = Parameter(t0, 0);
136 Node* p1 = Parameter(t1, 1); 137 Node* p1 = Parameter(t1, 1);
137 Node* call = 138 Node* call =
138 graph()->NewNode(javascript()->CallFunction(4, language_mode), 139 graph()->NewNode(javascript()->CallFunction(4, language_mode),
139 function, UndefinedConstant(), p0, p1, context, 140 function, UndefinedConstant(), p0, p1, context,
140 frame_state, frame_state, effect, control); 141 frame_state, frame_state, effect, control);
141 Reduction r = Reduce(call); 142 Reduction r = Reduce(call);
142 143
143 ASSERT_TRUE(r.Changed()); 144 ASSERT_TRUE(r.Changed());
144 EXPECT_THAT(r.replacement(), 145 EXPECT_THAT(r.replacement(),
145 IsSelect(kMachNone, IsNumberLessThan(p1, p0), p0, p1)); 146 IsSelect(MachineRepresentation::kNone,
147 IsNumberLessThan(p1, p0), p0, p1));
146 } 148 }
147 } 149 }
148 } 150 }
149 } 151 }
150 152
151 153
152 // ----------------------------------------------------------------------------- 154 // -----------------------------------------------------------------------------
153 // Math.imul 155 // Math.imul
154 156
155 157
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 203
202 ASSERT_TRUE(r.Changed()); 204 ASSERT_TRUE(r.Changed());
203 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); 205 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0));
204 } 206 }
205 } 207 }
206 } 208 }
207 209
208 } // namespace compiler 210 } // namespace compiler
209 } // namespace internal 211 } // namespace internal
210 } // namespace v8 212 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/compiler/interpreter-assembler-unittest.cc ('k') | test/unittests/compiler/js-context-relaxation-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698