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 { |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 166 } |
167 | 167 |
168 | 168 |
169 TEST_F(JSContextRelaxationTest, | 169 TEST_F(JSContextRelaxationTest, |
170 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) { | 170 RelaxJSCallFunctionDeepContextChainFullRelaxForWith) { |
171 Node* const input0 = Parameter(0); | 171 Node* const input0 = Parameter(0); |
172 Node* const input1 = Parameter(1); | 172 Node* const input1 = Parameter(1); |
173 Node* const context = Parameter(2); | 173 Node* const context = Parameter(2); |
174 Node* const outer_context = Parameter(3); | 174 Node* const outer_context = Parameter(3); |
175 const Operator* op = javascript()->CreateWithContext(); | 175 const Operator* op = javascript()->CreateWithContext(); |
176 Node* const frame_state_1 = | |
177 ShallowFrameStateChain(outer_context, CALL_MAINTAINS_NATIVE_CONTEXT); | |
178 Node* const effect = graph()->start(); | 176 Node* const effect = graph()->start(); |
179 Node* const control = graph()->start(); | 177 Node* const control = graph()->start(); |
180 Node* nested_context = | 178 Node* nested_context = graph()->NewNode( |
181 graph()->NewNode(op, graph()->start(), graph()->start(), outer_context, | 179 op, graph()->start(), graph()->start(), outer_context, effect, control); |
182 frame_state_1, effect, control); | |
183 Node* const frame_state_2 = | 180 Node* const frame_state_2 = |
184 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); | 181 ShallowFrameStateChain(nested_context, CALL_MAINTAINS_NATIVE_CONTEXT); |
185 Node* node = graph()->NewNode( | 182 Node* node = graph()->NewNode( |
186 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, | 183 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, |
187 context, frame_state_2, frame_state_2, effect, control); | 184 context, frame_state_2, frame_state_2, effect, control); |
188 Reduction const r = Reduce(node); | 185 Reduction const r = Reduce(node); |
189 EXPECT_TRUE(r.Changed()); | 186 EXPECT_TRUE(r.Changed()); |
190 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); | 187 EXPECT_EQ(outer_context, NodeProperties::GetContextInput(node)); |
191 } | 188 } |
192 | 189 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, | 275 javascript()->CallFunction(2, STRICT, VectorSlotPair()), input0, input1, |
279 context, frame_state_2, frame_state_2, effect, control); | 276 context, frame_state_2, frame_state_2, effect, control); |
280 Reduction const r = Reduce(node); | 277 Reduction const r = Reduce(node); |
281 EXPECT_FALSE(r.Changed()); | 278 EXPECT_FALSE(r.Changed()); |
282 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); | 279 EXPECT_EQ(context, NodeProperties::GetContextInput(node)); |
283 } | 280 } |
284 | 281 |
285 } // namespace compiler | 282 } // namespace compiler |
286 } // namespace internal | 283 } // namespace internal |
287 } // namespace v8 | 284 } // namespace v8 |
OLD | NEW |