| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/ic/ic.h" | 7 #include "src/ic/ic.h" |
| 8 #include "src/ic/ic-state.h" | 8 #include "src/ic/ic-state.h" |
| 9 #include "src/objects.h" | 9 #include "src/objects.h" |
| 10 #include "src/type-feedback-vector-inl.h" | 10 #include "src/type-feedback-vector-inl.h" |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 } | 257 } |
| 258 | 258 |
| 259 | 259 |
| 260 InlineCacheState KeyedLoadICNexus::StateFromFeedback() const { | 260 InlineCacheState KeyedLoadICNexus::StateFromFeedback() const { |
| 261 Isolate* isolate = GetIsolate(); | 261 Isolate* isolate = GetIsolate(); |
| 262 Object* feedback = GetFeedback(); | 262 Object* feedback = GetFeedback(); |
| 263 if (feedback == *vector()->UninitializedSentinel(isolate)) { | 263 if (feedback == *vector()->UninitializedSentinel(isolate)) { |
| 264 return UNINITIALIZED; | 264 return UNINITIALIZED; |
| 265 } else if (feedback == *vector()->PremonomorphicSentinel(isolate)) { | 265 } else if (feedback == *vector()->PremonomorphicSentinel(isolate)) { |
| 266 return PREMONOMORPHIC; | 266 return PREMONOMORPHIC; |
| 267 } else if (feedback == *vector()->GenericSentinel(isolate)) { | 267 } else if (feedback == *vector()->MegamorphicSentinel(isolate)) { |
| 268 return GENERIC; | 268 return MEGAMORPHIC; |
| 269 } else if (feedback->IsFixedArray()) { | 269 } else if (feedback->IsFixedArray()) { |
| 270 // Determine state purely by our structure, don't check if the maps are | 270 // Determine state purely by our structure, don't check if the maps are |
| 271 // cleared. | 271 // cleared. |
| 272 FixedArray* array = FixedArray::cast(feedback); | 272 FixedArray* array = FixedArray::cast(feedback); |
| 273 int length = array->length(); | 273 int length = array->length(); |
| 274 DCHECK(length >= 3); | 274 DCHECK(length >= 3); |
| 275 return length == 3 ? MONOMORPHIC : POLYMORPHIC; | 275 return length == 3 ? MONOMORPHIC : POLYMORPHIC; |
| 276 } | 276 } |
| 277 | 277 |
| 278 return UNINITIALIZED; | 278 return UNINITIALIZED; |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), | 316 SetFeedback(*vector()->UninitializedSentinel(GetIsolate()), |
| 317 SKIP_WRITE_BARRIER); | 317 SKIP_WRITE_BARRIER); |
| 318 } | 318 } |
| 319 | 319 |
| 320 | 320 |
| 321 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { | 321 void CallICNexus::ConfigureMonomorphic(Handle<JSFunction> function) { |
| 322 SetFeedback(*function); | 322 SetFeedback(*function); |
| 323 } | 323 } |
| 324 | 324 |
| 325 | 325 |
| 326 void KeyedLoadICNexus::ConfigureGeneric() { | 326 void KeyedLoadICNexus::ConfigureMegamorphic() { |
| 327 SetFeedback(*vector()->GenericSentinel(GetIsolate()), SKIP_WRITE_BARRIER); | 327 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); |
| 328 } | 328 } |
| 329 | 329 |
| 330 | 330 |
| 331 void LoadICNexus::ConfigureMegamorphic() { | 331 void LoadICNexus::ConfigureMegamorphic() { |
| 332 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); | 332 SetFeedback(*vector()->MegamorphicSentinel(GetIsolate()), SKIP_WRITE_BARRIER); |
| 333 } | 333 } |
| 334 | 334 |
| 335 | 335 |
| 336 void LoadICNexus::ConfigurePremonomorphic() { | 336 void LoadICNexus::ConfigurePremonomorphic() { |
| 337 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()), | 337 SetFeedback(*vector()->PremonomorphicSentinel(GetIsolate()), |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 if (feedback->IsFixedArray()) { | 507 if (feedback->IsFixedArray()) { |
| 508 FixedArray* array = FixedArray::cast(feedback); | 508 FixedArray* array = FixedArray::cast(feedback); |
| 509 DCHECK(array->length() >= 3); | 509 DCHECK(array->length() >= 3); |
| 510 Object* name = array->get(0); | 510 Object* name = array->get(0); |
| 511 if (name->IsName()) return Name::cast(name); | 511 if (name->IsName()) return Name::cast(name); |
| 512 } | 512 } |
| 513 return NULL; | 513 return NULL; |
| 514 } | 514 } |
| 515 } | 515 } |
| 516 } // namespace v8::internal | 516 } // namespace v8::internal |
| OLD | NEW |