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 "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/typer.h" | 9 #include "src/compiler/typer.h" |
9 #include "src/isolate-inl.h" | 10 #include "src/isolate-inl.h" |
10 #include "test/unittests/compiler/graph-unittest.h" | 11 #include "test/unittests/compiler/graph-unittest.h" |
11 #include "test/unittests/compiler/node-test-utils.h" | 12 #include "test/unittests/compiler/node-test-utils.h" |
12 #include "testing/gmock-support.h" | 13 #include "testing/gmock-support.h" |
13 | 14 |
14 using testing::BitEq; | 15 using testing::BitEq; |
15 using testing::Capture; | 16 using testing::Capture; |
16 | 17 |
17 namespace v8 { | 18 namespace v8 { |
18 namespace internal { | 19 namespace internal { |
19 namespace compiler { | 20 namespace compiler { |
20 | 21 |
21 class JSBuiltinReducerTest : public TypedGraphTest { | 22 class JSBuiltinReducerTest : public TypedGraphTest { |
22 public: | 23 public: |
23 JSBuiltinReducerTest() : javascript_(zone()) {} | 24 JSBuiltinReducerTest() : javascript_(zone()) {} |
24 | 25 |
25 protected: | 26 protected: |
26 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = | 27 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
27 MachineOperatorBuilder::Flag::kNoFlags) { | 28 MachineOperatorBuilder::Flag::kNoFlags) { |
28 MachineOperatorBuilder machine(zone(), kMachPtr, flags); | 29 MachineOperatorBuilder machine(zone(), kMachPtr, flags); |
29 JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, | 30 SimplifiedOperatorBuilder simplified(zone()); |
| 31 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &simplified, |
30 &machine); | 32 &machine); |
31 // TODO(titzer): mock the GraphReducer here for better unit testing. | 33 // TODO(titzer): mock the GraphReducer here for better unit testing. |
32 GraphReducer graph_reducer(zone(), graph()); | 34 GraphReducer graph_reducer(zone(), graph()); |
33 JSBuiltinReducer reducer(&graph_reducer, &jsgraph); | 35 JSBuiltinReducer reducer(&graph_reducer, &jsgraph); |
34 return reducer.Reduce(node); | 36 return reducer.Reduce(node); |
35 } | 37 } |
36 | 38 |
37 Node* MathFunction(const char* name) { | 39 Node* MathFunction(const char* name) { |
38 Handle<Object> m = | 40 Handle<Object> m = |
39 JSObject::GetProperty(isolate()->global_object(), | 41 JSObject::GetProperty(isolate()->global_object(), |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 199 |
198 ASSERT_TRUE(r.Changed()); | 200 ASSERT_TRUE(r.Changed()); |
199 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); | 201 EXPECT_THAT(r.replacement(), IsTruncateFloat64ToFloat32(p0)); |
200 } | 202 } |
201 } | 203 } |
202 } | 204 } |
203 | 205 |
204 } // namespace compiler | 206 } // namespace compiler |
205 } // namespace internal | 207 } // namespace internal |
206 } // namespace v8 | 208 } // namespace v8 |
OLD | NEW |