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