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 2359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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) == Code::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 | |
2381 // Sanity check: The loaded value must be a JS-exposed kind of object, | |
2382 // not something internal (like a Map, or FixedArray). Check this here | |
2383 // to chase after a rare but recurring crash bug. | |
2384 // TODO(chromium:527994): Remove this when we have a few crash reports. | |
2385 if (!result->IsSmi()) { | |
2386 InstanceType type = | |
2387 Handle<HeapObject>::cast(result)->map()->instance_type(); | |
2388 CHECK(type <= LAST_PRIMITIVE_TYPE || type >= FIRST_JS_RECEIVER_TYPE); | |
2389 } | |
2390 | |
2391 } else { | 2380 } else { |
2392 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); | 2381 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); |
2393 KeyedLoadICNexus nexus(vector, vector_slot); | 2382 KeyedLoadICNexus nexus(vector, vector_slot); |
2394 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); | 2383 KeyedLoadIC ic(IC::NO_EXTRA_FRAME, isolate, &nexus); |
2395 ic.UpdateState(receiver, key); | 2384 ic.UpdateState(receiver, key); |
2396 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 2385 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
2397 } | 2386 } |
2398 return *result; | 2387 return *result; |
2399 } | 2388 } |
2400 | 2389 |
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3119 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); | 3108 Handle<TypeFeedbackVector> vector = args.at<TypeFeedbackVector>(3); |
3120 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); | 3109 FeedbackVectorICSlot vector_slot = vector->ToICSlot(slot->value()); |
3121 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the | 3110 // A monomorphic or polymorphic KeyedLoadIC with a string key can call the |
3122 // LoadIC miss handler if the handler misses. Since the vector Nexus is | 3111 // LoadIC miss handler if the handler misses. Since the vector Nexus is |
3123 // set up outside the IC, handle that here. | 3112 // set up outside the IC, handle that here. |
3124 if (vector->GetKind(vector_slot) == Code::LOAD_IC) { | 3113 if (vector->GetKind(vector_slot) == Code::LOAD_IC) { |
3125 LoadICNexus nexus(vector, vector_slot); | 3114 LoadICNexus nexus(vector, vector_slot); |
3126 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3115 LoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3127 ic.UpdateState(receiver, key); | 3116 ic.UpdateState(receiver, key); |
3128 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3117 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3129 | |
3130 // Sanity check: The loaded value must be a JS-exposed kind of object, | |
3131 // not something internal (like a Map, or FixedArray). Check this here | |
3132 // to chase after a rare but recurring crash bug. | |
3133 // TODO(chromium:527994): Remove this when we have a few crash reports. | |
3134 if (!result->IsSmi()) { | |
3135 InstanceType type = | |
3136 Handle<HeapObject>::cast(result)->map()->instance_type(); | |
3137 CHECK(type <= LAST_PRIMITIVE_TYPE || type >= FIRST_JS_RECEIVER_TYPE); | |
3138 } | |
3139 | |
3140 } else { | 3118 } else { |
3141 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); | 3119 DCHECK(vector->GetKind(vector_slot) == Code::KEYED_LOAD_IC); |
3142 KeyedLoadICNexus nexus(vector, vector_slot); | 3120 KeyedLoadICNexus nexus(vector, vector_slot); |
3143 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); | 3121 KeyedLoadIC ic(IC::EXTRA_CALL_FRAME, isolate, &nexus); |
3144 ic.UpdateState(receiver, key); | 3122 ic.UpdateState(receiver, key); |
3145 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); | 3123 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, result, ic.Load(receiver, key)); |
3146 } | 3124 } |
3147 | 3125 |
3148 return *result; | 3126 return *result; |
3149 } | 3127 } |
3150 } // namespace internal | 3128 } // namespace internal |
3151 } // namespace v8 | 3129 } // namespace v8 |
OLD | NEW |