OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/ic/ic.h" | 5 #include "src/ic/ic.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/api.h" | 8 #include "src/api.h" |
9 #include "src/arguments.h" | 9 #include "src/arguments.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2471 | 2471 |
2472 RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { | 2472 RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { |
2473 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2473 TimerEventScope<TimerEventIcMiss> timer(isolate); |
2474 HandleScope scope(isolate); | 2474 HandleScope scope(isolate); |
2475 Handle<Object> receiver = args.at<Object>(0); | 2475 Handle<Object> receiver = args.at<Object>(0); |
2476 Handle<Name> key = args.at<Name>(1); | 2476 Handle<Name> key = args.at<Name>(1); |
2477 Handle<Object> value = args.at<Object>(2); | 2477 Handle<Object> value = args.at<Object>(2); |
2478 Handle<Object> result; | 2478 Handle<Object> result; |
2479 | 2479 |
2480 if (FLAG_vector_stores) { | 2480 if (FLAG_vector_stores) { |
2481 DCHECK(args.length() == 5 || args.length() == 6); | 2481 int length = args.length(); |
2482 Handle<Smi> slot = args.at<Smi>(3); | 2482 DCHECK(length == 5 || length == 6); |
2483 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); | 2483 // We might have slot and vector, for a normal miss (slot(3), vector(4)). |
| 2484 // Or, map and vector for a transitioning store miss (map(3), vector(4)). |
| 2485 // In this case, we need to recover the slot from a virtual register. |
| 2486 // If length == 6, then a map is included (map(3), slot(4), vector(5)). |
| 2487 Handle<Smi> slot; |
| 2488 Handle<TypeFeedbackVector> vector; |
| 2489 if (length == 5) { |
| 2490 if (args.at<Object>(3)->IsMap()) { |
| 2491 vector = args.at<TypeFeedbackVector>(4); |
| 2492 slot = handle( |
| 2493 *reinterpret_cast<Smi**>(isolate->virtual_slot_register_address()), |
| 2494 isolate); |
| 2495 } else { |
| 2496 vector = args.at<TypeFeedbackVector>(4); |
| 2497 slot = args.at<Smi>(3); |
| 2498 } |
| 2499 } else { |
| 2500 vector = args.at<TypeFeedbackVector>(5); |
| 2501 slot = args.at<Smi>(4); |
| 2502 } |
| 2503 |
2484 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2504 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
2485 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { | 2505 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { |
2486 StoreICNexus nexus(vector, vector_slot); | 2506 StoreICNexus nexus(vector, vector_slot); |
2487 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2507 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2488 ic.UpdateState(receiver, key); | 2508 ic.UpdateState(receiver, key); |
2489 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2509 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2490 ic.Store(receiver, key, value)); | 2510 ic.Store(receiver, key, value)); |
2491 } else { | 2511 } else { |
2492 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, | 2512 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, |
2493 vector->GetKind(vector_slot)); | 2513 vector->GetKind(vector_slot)); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2609 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( | 2629 ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
2610 isolate, result, | 2630 isolate, result, |
2611 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); | 2631 Runtime::SetObjectProperty(isolate, object, key, value, language_mode)); |
2612 return *result; | 2632 return *result; |
2613 } | 2633 } |
2614 | 2634 |
2615 | 2635 |
2616 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) { | 2636 RUNTIME_FUNCTION(Runtime_ElementsTransitionAndStoreIC_Miss) { |
2617 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2637 TimerEventScope<TimerEventIcMiss> timer(isolate); |
2618 HandleScope scope(isolate); | 2638 HandleScope scope(isolate); |
2619 DCHECK(args.length() == (FLAG_vector_stores ? 6 : 4)); | 2639 // Without vector stores, length == 4. |
| 2640 // With vector stores, length == 5 or 6, depending on whether the vector slot |
| 2641 // is passed in a virtual register or not. |
| 2642 DCHECK(!FLAG_vector_stores || args.length() == 5 || args.length() == 6); |
2620 Handle<Object> object = args.at<Object>(0); | 2643 Handle<Object> object = args.at<Object>(0); |
2621 Handle<Object> key = args.at<Object>(1); | 2644 Handle<Object> key = args.at<Object>(1); |
2622 Handle<Object> value = args.at<Object>(2); | 2645 Handle<Object> value = args.at<Object>(2); |
2623 Handle<Map> map = args.at<Map>(FLAG_vector_stores ? 5 : 3); | 2646 Handle<Map> map = args.at<Map>(3); |
2624 LanguageMode language_mode; | 2647 LanguageMode language_mode; |
2625 if (FLAG_vector_stores) { | 2648 if (FLAG_vector_stores) { |
2626 KeyedStoreICNexus nexus(isolate); | 2649 KeyedStoreICNexus nexus(isolate); |
2627 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2650 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2628 language_mode = ic.language_mode(); | 2651 language_mode = ic.language_mode(); |
2629 } else { | 2652 } else { |
2630 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | 2653 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate); |
2631 language_mode = ic.language_mode(); | 2654 language_mode = ic.language_mode(); |
2632 } | 2655 } |
2633 if (object->IsJSObject()) { | 2656 if (object->IsJSObject()) { |
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3124 KeyedLoadICNexus nexus(vector, vector_slot); | 3147 KeyedLoadICNexus nexus(vector, vector_slot); |
3125 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3148 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3126 ic.UpdateState(receiver, key); | 3149 ic.UpdateState(receiver, key); |
3127 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3150 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3128 } | 3151 } |
3129 | 3152 |
3130 return *result; | 3153 return *result; |
3131 } | 3154 } |
3132 } // namespace internal | 3155 } // namespace internal |
3133 } // namespace v8 | 3156 } // namespace v8 |
OLD | NEW |