OLD | NEW |
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/graph-unittest.h" | 5 #include "test/unittests/compiler/graph-unittest.h" |
6 | 6 |
7 #include "src/compiler/js-builtin-reducer.h" | 7 #include "src/compiler/js-builtin-reducer.h" |
8 #include "src/compiler/js-graph.h" | 8 #include "src/compiler/js-graph.h" |
9 #include "src/compiler/node-properties-inl.h" | 9 #include "src/compiler/node-properties-inl.h" |
10 #include "src/compiler/typer.h" | 10 #include "src/compiler/typer.h" |
11 #include "testing/gmock-support.h" | 11 #include "testing/gmock-support.h" |
12 | 12 |
13 using testing::Capture; | 13 using testing::Capture; |
14 | 14 |
15 namespace v8 { | 15 namespace v8 { |
16 namespace internal { | 16 namespace internal { |
17 namespace compiler { | 17 namespace compiler { |
18 | 18 |
19 class JSBuiltinReducerTest : public GraphTest { | 19 class JSBuiltinReducerTest : public TypedGraphTest { |
20 public: | 20 public: |
21 JSBuiltinReducerTest() : javascript_(zone()) {} | 21 JSBuiltinReducerTest() : javascript_(zone()) {} |
22 | 22 |
23 protected: | 23 protected: |
24 Reduction Reduce(Node* node) { | 24 Reduction Reduce(Node* node) { |
25 Typer typer(zone()); | |
26 MachineOperatorBuilder machine; | 25 MachineOperatorBuilder machine; |
27 JSGraph jsgraph(graph(), common(), javascript(), &typer, &machine); | 26 JSGraph jsgraph(graph(), common(), javascript(), &machine); |
28 JSBuiltinReducer reducer(&jsgraph); | 27 JSBuiltinReducer reducer(&jsgraph); |
29 return reducer.Reduce(node); | 28 return reducer.Reduce(node); |
30 } | 29 } |
31 | 30 |
32 Node* Parameter(Type* t, int32_t index = 0) { | 31 Node* Parameter(Type* t, int32_t index = 0) { |
33 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); | 32 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); |
34 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); | 33 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); |
35 return n; | 34 return n; |
36 } | 35 } |
37 | 36 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 Reduction r = Reduce(call); | 233 Reduction r = Reduce(call); |
235 | 234 |
236 ASSERT_TRUE(r.Changed()); | 235 ASSERT_TRUE(r.Changed()); |
237 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); | 236 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); |
238 } | 237 } |
239 } | 238 } |
240 | 239 |
241 } // namespace compiler | 240 } // namespace compiler |
242 } // namespace internal | 241 } // namespace internal |
243 } // namespace v8 | 242 } // namespace v8 |
OLD | NEW |