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