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 2354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2365 Handle<Name> key = args.at<Name>(1); | 2365 Handle<Name> key = args.at<Name>(1); |
2366 Handle<Object> result; | 2366 Handle<Object> result; |
2367 | 2367 |
2368 DCHECK(args.length() == 4); | 2368 DCHECK(args.length() == 4); |
2369 Handle<Smi> slot = args.at<Smi>(2); | 2369 Handle<Smi> slot = args.at<Smi>(2); |
2370 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); | 2370 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
2371 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); | 2371 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
2372 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the | 2372 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the |
2373 // LoadIC miss handler if the handler misses. Since the vector Nexus is | 2373 // LoadIC miss handler if the handler misses. Since the vector Nexus is |
2374 // set up outside the IC, handle that here. | 2374 // set up outside the IC, handle that here. |
2375 if (vector->GetKind(vector_slot) == Code::LOAD_IC) { | 2375 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) { |
2376 LoadICNexus nexus(vector, vector_slot); | 2376 LoadICNexus nexus(vector, vector_slot); |
2377 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2377 LoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2378 ic.UpdateState(receiver, key); | 2378 ic.UpdateState(receiver, key); |
2379 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2379 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2380 } else { | 2380 } else { |
2381 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); | 2381 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
| 2382 vector->GetKind(vector_slot)); |
2382 KeyedLoadICNexus nexus(vector, vector_slot); | 2383 KeyedLoadICNexus nexus(vector, vector_slot); |
2383 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2384 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2384 ic.UpdateState(receiver, key); | 2385 ic.UpdateState(receiver, key); |
2385 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2386 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2386 } | 2387 } |
2387 return *result; | 2388 return *result; |
2388 } | 2389 } |
2389 | 2390 |
2390 | 2391 |
2391 // Used from ic-<arch>.cc | 2392 // Used from ic-<arch>.cc |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2435 Handle<Object> receiver = args.at<Object>(0); | 2436 Handle<Object> receiver = args.at<Object>(0); |
2436 Handle<Name> key = args.at<Name>(1); | 2437 Handle<Name> key = args.at<Name>(1); |
2437 Handle<Object> value = args.at<Object>(2); | 2438 Handle<Object> value = args.at<Object>(2); |
2438 Handle<Object> result; | 2439 Handle<Object> result; |
2439 | 2440 |
2440 if (FLAG_vector_stores) { | 2441 if (FLAG_vector_stores) { |
2441 DCHECK(args.length() == 5 || args.length() == 6); | 2442 DCHECK(args.length() == 5 || args.length() == 6); |
2442 Handle<Smi> slot = args.at<Smi>(3); | 2443 Handle<Smi> slot = args.at<Smi>(3); |
2443 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); | 2444 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); |
2444 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); | 2445 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
2445 if (vector->GetKind(vector_slot) == Code::STORE_IC) { | 2446 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { |
2446 StoreICNexus nexus(vector, vector_slot); | 2447 StoreICNexus nexus(vector, vector_slot); |
2447 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2448 StoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2448 ic.UpdateState(receiver, key); | 2449 ic.UpdateState(receiver, key); |
2449 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2450 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2450 ic.Store(receiver, key, value)); | 2451 ic.Store(receiver, key, value)); |
2451 } else { | 2452 } else { |
2452 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_STORE_IC); | 2453 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, |
| 2454 vector->GetKind(vector_slot)); |
2453 KeyedStoreICNexus nexus(vector, vector_slot); | 2455 KeyedStoreICNexus nexus(vector, vector_slot); |
2454 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2456 KeyedStoreIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2455 ic.UpdateState(receiver, key); | 2457 ic.UpdateState(receiver, key); |
2456 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2458 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2457 ic.Store(receiver, key, value)); | 2459 ic.Store(receiver, key, value)); |
2458 } | 2460 } |
2459 } else { | 2461 } else { |
2460 DCHECK(args.length() == 3); | 2462 DCHECK(args.length() == 3); |
2461 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); | 2463 StoreIC ic(IC::NO_EXTRA_FRAME, isolate); |
2462 ic.UpdateState(receiver, key); | 2464 ic.UpdateState(receiver, key); |
(...skipping 10 matching lines...) Expand all Loading... |
2473 Handle<Object> receiver = args.at<Object>(0); | 2475 Handle<Object> receiver = args.at<Object>(0); |
2474 Handle<Name> key = args.at<Name>(1); | 2476 Handle<Name> key = args.at<Name>(1); |
2475 Handle<Object> value = args.at<Object>(2); | 2477 Handle<Object> value = args.at<Object>(2); |
2476 Handle<Object> result; | 2478 Handle<Object> result; |
2477 | 2479 |
2478 if (FLAG_vector_stores) { | 2480 if (FLAG_vector_stores) { |
2479 DCHECK(args.length() == 5 || args.length() == 6); | 2481 DCHECK(args.length() == 5 || args.length() == 6); |
2480 Handle<Smi> slot = args.at<Smi>(3); | 2482 Handle<Smi> slot = args.at<Smi>(3); |
2481 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); | 2483 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(4); |
2482 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); | 2484 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
2483 if (vector->GetKind(vector_slot) == Code::STORE_IC) { | 2485 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::STORE_IC) { |
2484 StoreICNexus nexus(vector, vector_slot); | 2486 StoreICNexus nexus(vector, vector_slot); |
2485 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2487 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2486 ic.UpdateState(receiver, key); | 2488 ic.UpdateState(receiver, key); |
2487 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2489 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2488 ic.Store(receiver, key, value)); | 2490 ic.Store(receiver, key, value)); |
2489 } else { | 2491 } else { |
2490 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_STORE_IC); | 2492 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, |
| 2493 vector->GetKind(vector_slot)); |
2491 KeyedStoreICNexus nexus(vector, vector_slot); | 2494 KeyedStoreICNexus nexus(vector, vector_slot); |
2492 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 2495 KeyedStoreIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
2493 ic.UpdateState(receiver, key); | 2496 ic.UpdateState(receiver, key); |
2494 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, | 2497 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, |
2495 ic.Store(receiver, key, value)); | 2498 ic.Store(receiver, key, value)); |
2496 } | 2499 } |
2497 } else { | 2500 } else { |
2498 DCHECK(args.length() == 3 || args.length() == 4); | 2501 DCHECK(args.length() == 3 || args.length() == 4); |
2499 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate); | 2502 StoreIC ic(IC::EXTRA_CALL_FRAME, isolate); |
2500 ic.UpdateState(receiver, key); | 2503 ic.UpdateState(receiver, key); |
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3103 Handle<Name> key = args.at<Name>(1); | 3106 Handle<Name> key = args.at<Name>(1); |
3104 Handle<Object> result; | 3107 Handle<Object> result; |
3105 | 3108 |
3106 DCHECK(args.length() == 4); | 3109 DCHECK(args.length() == 4); |
3107 Handle<Smi> slot = args.at<Smi>(2); | 3110 Handle<Smi> slot = args.at<Smi>(2); |
3108 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); | 3111 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
3109 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); | 3112 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
3110 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the | 3113 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the |
3111 // LoadIC miss handler if the handler misses. Since the vector Nexus is | 3114 // LoadIC miss handler if the handler misses. Since the vector Nexus is |
3112 // set up outside the IC, handle that here. | 3115 // set up outside the IC, handle that here. |
3113 if (vector->GetKind(vector_slot) == Code::LOAD_IC) { | 3116 if (vector->GetKind(vector_slot) == FeedbackVectorSlotKind::LOAD_IC) { |
3114 LoadICNexus nexus(vector, vector_slot); | 3117 LoadICNexus nexus(vector, vector_slot); |
3115 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3118 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3116 ic.UpdateState(receiver, key); | 3119 ic.UpdateState(receiver, key); |
3117 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3120 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3118 } else { | 3121 } else { |
3119 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); | 3122 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_LOAD_IC, |
| 3123 vector->GetKind(vector_slot)); |
3120 KeyedLoadICNexus nexus(vector, vector_slot); | 3124 KeyedLoadICNexus nexus(vector, vector_slot); |
3121 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3125 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3122 ic.UpdateState(receiver, key); | 3126 ic.UpdateState(receiver, key); |
3123 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3127 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3124 } | 3128 } |
3125 | 3129 |
3126 return *result; | 3130 return *result; |
3127 } | 3131 } |
3128 } // namespace internal | 3132 } // namespace internal |
3129 } // namespace v8 | 3133 } // namespace v8 |
OLD | NEW |