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(), kMachPtr, flags); |
23 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); | 23 JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, |
| 24 &machine); |
24 // TODO(titzer): mock the GraphReducer here for better unit testing. | 25 // TODO(titzer): mock the GraphReducer here for better unit testing. |
25 GraphReducer graph_reducer(zone(), graph()); | 26 GraphReducer graph_reducer(zone(), graph()); |
26 JSContextRelaxation reducer; | 27 JSContextRelaxation reducer; |
27 return reducer.Reduce(node); | 28 return reducer.Reduce(node); |
28 } | 29 } |
29 | 30 |
30 Node* EmptyFrameState() { | 31 Node* EmptyFrameState() { |
31 MachineOperatorBuilder machine(zone()); | 32 MachineOperatorBuilder machine(zone()); |
32 JSGraph jsgraph(isolate(), graph(), common(), javascript(), &machine); | 33 JSGraph jsgraph(isolate(), graph(), common(), javascript(), nullptr, |
| 34 &machine); |
33 return jsgraph.EmptyFrameState(); | 35 return jsgraph.EmptyFrameState(); |
34 } | 36 } |
35 | 37 |
36 Node* ShallowFrameStateChain(Node* outer_context, | 38 Node* ShallowFrameStateChain(Node* outer_context, |
37 ContextCallingMode context_calling_mode) { | 39 ContextCallingMode context_calling_mode) { |
38 const FrameStateFunctionInfo* const frame_state_function_info = | 40 const FrameStateFunctionInfo* const frame_state_function_info = |
39 common()->CreateFrameStateFunctionInfo( | 41 common()->CreateFrameStateFunctionInfo( |
40 FrameStateType::kJavaScriptFunction, 3, 0, | 42 FrameStateType::kJavaScriptFunction, 3, 0, |
41 Handle<SharedFunctionInfo>(), context_calling_mode); | 43 Handle<SharedFunctionInfo>(), context_calling_mode); |
42 const Operator* op = common()->FrameState(BailoutId::None(), | 44 const Operator* op = common()->FrameState(BailoutId::None(), |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 STRICT, VectorSlotPair()), | 288 STRICT, VectorSlotPair()), |
287 input0, input1, context, frame_state_2, effect, control); | 289 input0, input1, context, frame_state_2, effect, control); |
288 Reduction const r = Reduce(node); | 290 Reduction const r = Reduce(node); |
289 EXPECT_FALSE(r.Changed()); | 291 EXPECT_FALSE(r.Changed()); |
290 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); | 292 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); |
291 } | 293 } |
292 | 294 |
293 } // namespace compiler | 295 } // namespace compiler |
294 } // namespace internal | 296 } // namespace internal |
295 } // namespace v8 | 297 } // namespace v8 |
OLD | NEW |