| 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 #ifndef V8_IC_INL_H_ | 5 #ifndef V8_IC_INL_H_ |
| 6 #define V8_IC_INL_H_ | 6 #define V8_IC_INL_H_ |
| 7 | 7 |
| 8 #include "src/ic/ic.h" | 8 #include "src/ic/ic.h" |
| 9 | 9 |
| 10 #include "src/compiler.h" | 10 #include "src/compiler.h" |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 JSFunction* builtin_ctor = GetRootConstructor(type, native_context); | 201 JSFunction* builtin_ctor = GetRootConstructor(type, native_context); |
| 202 if (builtin_ctor != NULL) { | 202 if (builtin_ctor != NULL) { |
| 203 *flag = kCacheOnPrototype; | 203 *flag = kCacheOnPrototype; |
| 204 return handle(builtin_ctor->initial_map()); | 204 return handle(builtin_ctor->initial_map()); |
| 205 } | 205 } |
| 206 *flag = kCacheOnReceiver; | 206 *flag = kCacheOnReceiver; |
| 207 return TypeToMap(type, isolate); | 207 return TypeToMap(type, isolate); |
| 208 } | 208 } |
| 209 | 209 |
| 210 | 210 |
| 211 // static |
| 212 IC::State CallIC::FeedbackToState(Isolate* isolate, TypeFeedbackVector* vector, |
| 213 FeedbackVectorICSlot slot) { |
| 214 IC::State state = UNINITIALIZED; |
| 215 Object* feedback = vector->Get(slot); |
| 216 |
| 217 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate)) { |
| 218 state = GENERIC; |
| 219 } else if (feedback->IsAllocationSite() || feedback->IsJSFunction()) { |
| 220 state = MONOMORPHIC; |
| 221 } else { |
| 222 CHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)); |
| 223 } |
| 224 |
| 225 return state; |
| 226 } |
| 227 |
| 228 |
| 211 IC::State CallIC::FeedbackToState(Handle<TypeFeedbackVector> vector, | 229 IC::State CallIC::FeedbackToState(Handle<TypeFeedbackVector> vector, |
| 212 Handle<Smi> slot) const { | 230 FeedbackVectorICSlot slot) const { |
| 213 IC::State state = UNINITIALIZED; | 231 return FeedbackToState(isolate(), *vector, slot); |
| 214 Object* feedback = vector->get(slot->value()); | 232 } |
| 215 | 233 |
| 216 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate())) { | |
| 217 state = GENERIC; | |
| 218 } else if (feedback->IsAllocationSite() || feedback->IsJSFunction()) { | |
| 219 state = MONOMORPHIC; | |
| 220 } else { | |
| 221 CHECK(feedback == *TypeFeedbackVector::UninitializedSentinel(isolate())); | |
| 222 } | |
| 223 | 234 |
| 224 return state; | 235 void CallIC::OnTypeFeedbackChanged(Handle<TypeFeedbackVector> vector, |
| 236 State old_state, State new_state) { |
| 237 OnTypeFeedbackChanged(isolate(), address(), *vector, old_state, new_state); |
| 225 } | 238 } |
| 226 } | 239 } |
| 227 } // namespace v8::internal | 240 } // namespace v8::internal |
| 228 | 241 |
| 229 #endif // V8_IC_INL_H_ | 242 #endif // V8_IC_INL_H_ |
| OLD | NEW |