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-call-reducer.h" | 5 #include "src/compiler/js-call-reducer.h" |
6 | 6 |
7 #include "src/compiler/js-graph.h" | 7 #include "src/compiler/js-graph.h" |
8 #include "src/compiler/node-matchers.h" | 8 #include "src/compiler/node-matchers.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 #include "src/type-feedback-vector-inl.h" | 10 #include "src/type-feedback-vector-inl.h" |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); | 254 CallICNexus nexus(p.feedback().vector(), p.feedback().slot()); |
255 Handle<Object> feedback(nexus.GetFeedback(), isolate()); | 255 Handle<Object> feedback(nexus.GetFeedback(), isolate()); |
256 if (feedback->IsAllocationSite()) { | 256 if (feedback->IsAllocationSite()) { |
257 // Retrieve the Array function from the {node}. | 257 // Retrieve the Array function from the {node}. |
258 Node* array_function; | 258 Node* array_function; |
259 Handle<Context> native_context; | 259 Handle<Context> native_context; |
260 if (GetNativeContext(node).ToHandle(&native_context)) { | 260 if (GetNativeContext(node).ToHandle(&native_context)) { |
261 array_function = jsgraph()->HeapConstant( | 261 array_function = jsgraph()->HeapConstant( |
262 handle(native_context->array_function(), isolate())); | 262 handle(native_context->array_function(), isolate())); |
263 } else { | 263 } else { |
| 264 Node* global_object = effect = graph()->NewNode( |
| 265 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), |
| 266 context, context, effect); |
264 Node* native_context = effect = graph()->NewNode( | 267 Node* native_context = effect = graph()->NewNode( |
265 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | 268 javascript()->LoadNativeContext(), global_object, context, effect); |
266 context, context, effect); | |
267 array_function = effect = graph()->NewNode( | 269 array_function = effect = graph()->NewNode( |
268 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), | 270 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), |
269 native_context, native_context, effect); | 271 native_context, native_context, effect); |
270 } | 272 } |
271 | 273 |
272 // Check that the {target} is still the {array_function}. | 274 // Check that the {target} is still the {array_function}. |
273 Node* check = effect = | 275 Node* check = effect = |
274 graph()->NewNode(javascript()->StrictEqual(), target, array_function, | 276 graph()->NewNode(javascript()->StrictEqual(), target, array_function, |
275 context, effect, control); | 277 context, effect, control); |
276 Node* branch = | 278 Node* branch = |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
395 // implementation of the CallConstructStub. | 397 // implementation of the CallConstructStub. |
396 Handle<AllocationSite> site = Handle<AllocationSite>::cast(feedback); | 398 Handle<AllocationSite> site = Handle<AllocationSite>::cast(feedback); |
397 | 399 |
398 // Retrieve the Array function from the {node}. | 400 // Retrieve the Array function from the {node}. |
399 Node* array_function; | 401 Node* array_function; |
400 Handle<Context> native_context; | 402 Handle<Context> native_context; |
401 if (GetNativeContext(node).ToHandle(&native_context)) { | 403 if (GetNativeContext(node).ToHandle(&native_context)) { |
402 array_function = jsgraph()->HeapConstant( | 404 array_function = jsgraph()->HeapConstant( |
403 handle(native_context->array_function(), isolate())); | 405 handle(native_context->array_function(), isolate())); |
404 } else { | 406 } else { |
| 407 Node* global_object = effect = graph()->NewNode( |
| 408 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true), |
| 409 context, context, effect); |
405 Node* native_context = effect = graph()->NewNode( | 410 Node* native_context = effect = graph()->NewNode( |
406 javascript()->LoadContext(0, Context::NATIVE_CONTEXT_INDEX, true), | 411 javascript()->LoadNativeContext(), global_object, context, effect); |
407 context, context, effect); | |
408 array_function = effect = graph()->NewNode( | 412 array_function = effect = graph()->NewNode( |
409 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), | 413 javascript()->LoadContext(0, Context::ARRAY_FUNCTION_INDEX, true), |
410 native_context, native_context, effect); | 414 native_context, native_context, effect); |
411 } | 415 } |
412 | 416 |
413 // Check that the {target} is still the {array_function}. | 417 // Check that the {target} is still the {array_function}. |
414 Node* check = effect = | 418 Node* check = effect = |
415 graph()->NewNode(javascript()->StrictEqual(), target, array_function, | 419 graph()->NewNode(javascript()->StrictEqual(), target, array_function, |
416 context, effect, control); | 420 context, effect, control); |
417 Node* branch = | 421 Node* branch = |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 } | 493 } |
490 | 494 |
491 | 495 |
492 JSOperatorBuilder* JSCallReducer::javascript() const { | 496 JSOperatorBuilder* JSCallReducer::javascript() const { |
493 return jsgraph()->javascript(); | 497 return jsgraph()->javascript(); |
494 } | 498 } |
495 | 499 |
496 } // namespace compiler | 500 } // namespace compiler |
497 } // namespace internal | 501 } // namespace internal |
498 } // namespace v8 | 502 } // namespace v8 |
OLD | NEW |