| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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-context-relaxation.h" | 5 #include "src/compiler/js-context-relaxation.h" |
| 6 #include "src/compiler/js-graph.h" | 6 #include "src/compiler/js-graph.h" |
| 7 #include "test/unittests/compiler/graph-unittest.h" | 7 #include "test/unittests/compiler/graph-unittest.h" |
| 8 #include "test/unittests/compiler/node-test-utils.h" | 8 #include "test/unittests/compiler/node-test-utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace compiler { | 12 namespace compiler { |
| 13 | 13 |
| 14 class JSContextRelaxationTest : public GraphTest { | 14 class JSContextRelaxationTest : public GraphTest { |
| 15 public: | 15 public: |
| 16 JSContextRelaxationTest() : GraphTest(3), javascript_(zone()) {} | 16 JSContextRelaxationTest() : GraphTest(3), javascript_(zone()) {} |
| 17 ~JSContextRelaxationTest() override {} | 17 ~JSContextRelaxationTest() override {} |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = | 20 Reduction Reduce(Node* node, MachineOperatorBuilder::Flags flags = |
| 21 MachineOperatorBuilder::kNoFlags) { | 21 MachineOperatorBuilder::kNoFlags) { |
| 22 MachineOperatorBuilder machine(zone(), kMachPtr, flags); | 22 MachineOperatorBuilder machine(zone(), MachineType::PointerRepresentation(), |
| 23 flags); |
| 23 JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, | 24 JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, |
| 24 &machine); | 25 &machine); |
| 25 // TODO(titzer): mock the GraphReducer here for better unit testing. | 26 // TODO(titzer): mock the GraphReducer here for better unit testing. |
| 26 GraphReducer graph_reducer(zone(), graph()); | 27 GraphReducer graph_reducer(zone(), graph()); |
| 27 JSContextRelaxation reducer; | 28 JSContextRelaxation reducer; |
| 28 return reducer.Reduce(node); | 29 return reducer.Reduce(node); |
| 29 } | 30 } |
| 30 | 31 |
| 31 Node* EmptyFrameState() { | 32 Node* EmptyFrameState() { |
| 32 MachineOperatorBuilder machine(zone()); | 33 MachineOperatorBuilder machine(zone()); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, | 276 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, |
| 276 context, frame_state_2, frame_state_2, effect, control); | 277 context, frame_state_2, frame_state_2, effect, control); |
| 277 Reduction const r = Reduce(node); | 278 Reduction const r = Reduce(node); |
| 278 EXPECT_FALSE(r.Changed()); | 279 EXPECT_FALSE(r.Changed()); |
| 279 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); | 280 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); |
| 280 } | 281 } |
| 281 | 282 |
| 282 } // namespace compiler | 283 } // namespace compiler |
| 283 } // namespace internal | 284 } // namespace internal |
| 284 } // namespace v8 | 285 } // namespace v8 |
| OLD | NEW |