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-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/typer.h" | 8 #include "src/compiler/typer.h" |
9 #include "test/unittests/compiler/graph-unittest.h" | 9 #include "test/unittests/compiler/graph-unittest.h" |
10 #include "test/unittests/compiler/node-test-utils.h" | 10 #include "test/unittests/compiler/node-test-utils.h" |
11 #include "testing/gmock-support.h" | 11 #include "testing/gmock-support.h" |
12 | 12 |
13 using testing::BitEq; | 13 using testing::BitEq; |
14 using testing::Capture; | 14 using testing::Capture; |
15 | 15 |
16 namespace v8 { | 16 namespace v8 { |
17 namespace internal { | 17 namespace internal { |
18 namespace compiler { | 18 namespace compiler { |
19 | 19 |
20 class JSBuiltinReducerTest : public TypedGraphTest { | 20 class JSBuiltinReducerTest : public TypedGraphTest { |
21 public: | 21 public: |
22 JSBuiltinReducerTest() : javascript_(zone()) {} | 22 JSBuiltinReducerTest() : javascript_(zone()) {} |
23 | 23 |
24 protected: | 24 protected: |
25 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = | 25 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
26 MachineOperatorBuilder::Flag::kNoFlags) { | 26 MachineOperatorBuilder::Flag::kNoFlags) { |
27 MachineOperatorBuilder machine(zone(), kMachPtr, flags); | 27 MachineOperatorBuilder machine(zone(), kMachPtr, flags); |
28 JSGraph jsgraph(graph(), common(), javascript(), &machine); | 28 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); |
29 JSBuiltinReducer reducer(&jsgraph); | 29 JSBuiltinReducer reducer(&jsgraph); |
30 return reducer.Reduce(node); | 30 return reducer.Reduce(node); |
31 } | 31 } |
32 | 32 |
33 Handle<JSFunction> MathFunction(const char* name) { | 33 Handle<JSFunction> MathFunction(const char* name) { |
34 Handle<Object> m = | 34 Handle<Object> m = |
35 JSObject::GetProperty(isolate()->global_object(), | 35 JSObject::GetProperty(isolate()->global_object(), |
36 isolate()->factory()->NewStringFromAsciiChecked( | 36 isolate()->factory()->NewStringFromAsciiChecked( |
37 "Math")).ToHandleChecked(); | 37 "Math")).ToHandleChecked(); |
38 Handle<JSFunction> f = Handle<JSFunction>::cast( | 38 Handle<JSFunction> f = Handle<JSFunction>::cast( |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), | 294 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), |
295 fun, UndefinedConstant(), p0); | 295 fun, UndefinedConstant(), p0); |
296 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); | 296 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); |
297 | 297 |
298 ASSERT_FALSE(r.Changed()); | 298 ASSERT_FALSE(r.Changed()); |
299 } | 299 } |
300 } | 300 } |
301 } // namespace compiler | 301 } // namespace compiler |
302 } // namespace internal | 302 } // namespace internal |
303 } // namespace v8 | 303 } // namespace v8 |
OLD | NEW |