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-arguments-inl.h" | 8 #include "src/api-arguments-inl.h" |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2419 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, | 2419 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, |
2420 vector->GetKind(vector_slot)); | 2420 vector->GetKind(vector_slot)); |
2421 KeyedStoreICNexus nexus(vector, vector_slot); | 2421 KeyedStoreICNexus nexus(vector, vector_slot); |
2422 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2422 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2423 ic.UpdateState(receiver, key); | 2423 ic.UpdateState(receiver, key); |
2424 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2424 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
2425 } | 2425 } |
2426 } | 2426 } |
2427 | 2427 |
2428 | 2428 |
2429 RUNTIME_FUNCTION(Runtime_StoreIC_MissFromStubFailure) { | |
2430 TimerEventScope<TimerEventIcMiss> timer(isolate); | |
2431 HandleScope scope(isolate); | |
2432 typedef StoreWithVectorDescriptor Descriptor; | |
2433 DCHECK_EQ(Descriptor::kParameterCount, args.length()); | |
2434 Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver); | |
2435 Handle<Name> key = args.at<Name>(Descriptor::kName); | |
2436 Handle<Object> value = args.at<Object>(Descriptor::kValue); | |
2437 Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot); | |
2438 Handle<TypeFeedbackVector> vector = | |
2439 args.at<TypeFeedbackVector>(Descriptor::kVector); | |
2440 | |
2441 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | |
2442 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { | |
2443 StoreICNexus nexus(vector, vector_slot); | |
2444 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | |
2445 ic.UpdateState(receiver, key); | |
2446 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | |
2447 } else { | |
2448 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, | |
2449 vector->GetKind(vector_slot)); | |
2450 KeyedStoreICNexus nexus(vector, vector_slot); | |
2451 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | |
2452 ic.UpdateState(receiver, key); | |
2453 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | |
2454 } | |
2455 } | |
2456 | |
2457 // Used from ic-<arch>.cc. | 2429 // Used from ic-<arch>.cc. |
2458 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { | 2430 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Miss) { |
2459 TimerEventScope<TimerEventIcMiss> timer(isolate); | 2431 TimerEventScope<TimerEventIcMiss> timer(isolate); |
2460 HandleScope scope(isolate); | 2432 HandleScope scope(isolate); |
2461 DCHECK_EQ(5, args.length()); | 2433 DCHECK_EQ(5, args.length()); |
2462 // Runtime functions don't follow the IC's calling convention. | 2434 // Runtime functions don't follow the IC's calling convention. |
2463 Handle<Object> value = args.at<Object>(0); | 2435 Handle<Object> value = args.at<Object>(0); |
2464 Handle<Smi> slot = args.at<Smi>(1); | 2436 Handle<Smi> slot = args.at<Smi>(1); |
2465 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); | 2437 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(2); |
2466 Handle<Object> receiver = args.at<Object>(3); | 2438 Handle<Object> receiver = args.at<Object>(3); |
2467 Handle<Object> key = args.at<Object>(4); | 2439 Handle<Object> key = args.at<Object>(4); |
2468 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | 2440 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); |
2469 KeyedStoreICNexus nexus(vector, vector_slot); | 2441 KeyedStoreICNexus nexus(vector, vector_slot); |
2470 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2442 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2471 ic.UpdateState(receiver, key); | 2443 ic.UpdateState(receiver, key); |
2472 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | 2444 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); |
2473 } | 2445 } |
2474 | 2446 |
2475 | 2447 |
2476 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_MissFromStubFailure) { | |
2477 TimerEventScope<TimerEventIcMiss> timer(isolate); | |
2478 HandleScope scope(isolate); | |
2479 typedef StoreWithVectorDescriptor Descriptor; | |
2480 DCHECK_EQ(Descriptor::kParameterCount, args.length()); | |
2481 Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver); | |
2482 Handle<Object> key = args.at<Object>(Descriptor::kName); | |
2483 Handle<Object> value = args.at<Object>(Descriptor::kValue); | |
2484 Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot); | |
2485 Handle<TypeFeedbackVector> vector = | |
2486 args.at<TypeFeedbackVector>(Descriptor::kVector); | |
2487 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | |
2488 KeyedStoreICNexus nexus(vector, vector_slot); | |
2489 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | |
2490 ic.UpdateState(receiver, key); | |
2491 RETURN_RESULT_OR_FAILURE(isolate, ic.Store(receiver, key, value)); | |
2492 } | |
2493 | |
2494 | |
2495 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { | 2448 RUNTIME_FUNCTION(Runtime_KeyedStoreIC_Slow) { |
2496 HandleScope scope(isolate); | 2449 HandleScope scope(isolate); |
2497 DCHECK_EQ(5, args.length()); | 2450 DCHECK_EQ(5, args.length()); |
2498 // Runtime functions don't follow the IC's calling convention. | 2451 // Runtime functions don't follow the IC's calling convention. |
2499 Handle<Object> value = args.at<Object>(0); | 2452 Handle<Object> value = args.at<Object>(0); |
2500 // slot and vector parameters are not used. | 2453 // slot and vector parameters are not used. |
2501 Handle<Object> object = args.at<Object>(3); | 2454 Handle<Object> object = args.at<Object>(3); |
2502 Handle<Object> key = args.at<Object>(4); | 2455 Handle<Object> key = args.at<Object>(4); |
2503 LanguageMode language_mode; | 2456 LanguageMode language_mode; |
2504 KeyedStoreICNexus nexus(isolate); | 2457 KeyedStoreICNexus nexus(isolate); |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2952 if (result.is_null()) { | 2905 if (result.is_null()) { |
2953 LookupIterator it(isolate, receiver, index, receiver); | 2906 LookupIterator it(isolate, receiver, index, receiver); |
2954 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); | 2907 DCHECK_EQ(LookupIterator::INTERCEPTOR, it.state()); |
2955 it.Next(); | 2908 it.Next(); |
2956 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2909 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2957 Object::GetProperty(&it)); | 2910 Object::GetProperty(&it)); |
2958 } | 2911 } |
2959 | 2912 |
2960 return *result; | 2913 return *result; |
2961 } | 2914 } |
2962 | |
2963 | |
2964 RUNTIME_FUNCTION(Runtime_LoadIC_MissFromStubFailure) { | |
2965 TimerEventScope<TimerEventIcMiss> timer(isolate); | |
2966 HandleScope scope(isolate); | |
2967 DCHECK_EQ(4, args.length()); | |
2968 typedef LoadWithVectorDescriptor Descriptor; | |
2969 Handle<Object> receiver = args.at<Object>(Descriptor::kReceiver); | |
2970 Handle<Name> key = args.at<Name>(Descriptor::kName); | |
2971 Handle<Smi> slot = args.at<Smi>(Descriptor::kSlot); | |
2972 Handle<TypeFeedbackVector> vector = | |
2973 args.at<TypeFeedbackVector>(Descriptor::kVector); | |
2974 FeedbackVectorSlot vector_slot = vector->ToSlot(slot->value()); | |
2975 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the | |
2976 // LoadIC miss handler if the handler misses. Since the vector Nexus is | |
2977 // set up outside the IC, handle that here. | |
2978 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) { | |
2979 LoadICNexus nexus(vector, vector_slot); | |
2980 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | |
2981 ic.UpdateState(receiver, key); | |
2982 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | |
2983 } else { | |
2984 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, | |
2985 vector->GetKind(vector_slot)); | |
2986 KeyedLoadICNexus nexus(vector, vector_slot); | |
2987 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | |
2988 ic.UpdateState(receiver, key); | |
2989 RETURN_RESULT_OR_FAILURE(isolate, ic.Load(receiver, key)); | |
2990 } | |
2991 } | |
2992 } // namespace internal | 2915 } // namespace internal |
2993 } // namespace v8 | 2916 } // namespace v8 |
OLD | NEW |