| 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::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 TypedGraphTest { | 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, MachineOperatorBuilder::Flags flags = | 24 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
| 25 MachineOperatorBuilder::Flag::kNoFlags) { | 25 MachineOperatorBuilder::Flag::kNoFlags) { |
| 26 MachineOperatorBuilder machine(kMachPtr, flags); | 26 MachineOperatorBuilder machine(zone(), kMachPtr, flags); |
| 27 JSGraph jsgraph(graph(), common(), javascript(), &machine); | 27 JSGraph jsgraph(graph(), common(), javascript(), &machine); |
| 28 JSBuiltinReducer reducer(&jsgraph); | 28 JSBuiltinReducer reducer(&jsgraph); |
| 29 return reducer.Reduce(node); | 29 return reducer.Reduce(node); |
| 30 } | 30 } |
| 31 | 31 |
| 32 Node* Parameter(Type* t, int32_t index = 0) { | 32 Node* Parameter(Type* t, int32_t index = 0) { |
| 33 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); | 33 Node* n = graph()->NewNode(common()->Parameter(index), graph()->start()); |
| 34 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); | 34 NodeProperties::SetBounds(n, Bounds(Type::None(), t)); |
| 35 return n; | 35 return n; |
| 36 } | 36 } |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), | 296 graph()->NewNode(javascript()->CallFunction(3, NO_CALL_FUNCTION_FLAGS), |
| 297 fun, UndefinedConstant(), p0); | 297 fun, UndefinedConstant(), p0); |
| 298 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); | 298 Reduction r = Reduce(call, MachineOperatorBuilder::Flag::kNoFlags); |
| 299 | 299 |
| 300 ASSERT_FALSE(r.Changed()); | 300 ASSERT_FALSE(r.Changed()); |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } // namespace compiler | 303 } // namespace compiler |
| 304 } // namespace internal | 304 } // namespace internal |
| 305 } // namespace v8 | 305 } // namespace v8 |
| OLD | NEW |