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/type-info.h" | 5 #include "src/type-info.h" |
6 | 6 |
7 #include "src/ast.h" | 7 #include "src/ast.h" |
8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
9 #include "src/compiler.h" | 9 #include "src/compiler.h" |
10 #include "src/ic/ic.h" | 10 #include "src/ic/ic.h" |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 } | 191 } |
192 } | 192 } |
193 *store_mode = STANDARD_STORE; | 193 *store_mode = STANDARD_STORE; |
194 *key_type = ELEMENT; | 194 *key_type = ELEMENT; |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 void TypeFeedbackOracle::GetStoreModeAndKeyType( | 198 void TypeFeedbackOracle::GetStoreModeAndKeyType( |
199 FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode, | 199 FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode, |
200 IcCheckType* key_type) { | 200 IcCheckType* key_type) { |
201 if (!slot.IsInvalid()) { | 201 if (!slot.IsInvalid() && |
| 202 feedback_vector_->GetKind(slot) == Code::KEYED_STORE_IC) { |
202 KeyedStoreICNexus nexus(feedback_vector_, slot); | 203 KeyedStoreICNexus nexus(feedback_vector_, slot); |
203 *store_mode = nexus.GetKeyedAccessStoreMode(); | 204 *store_mode = nexus.GetKeyedAccessStoreMode(); |
204 *key_type = nexus.GetKeyType(); | 205 *key_type = nexus.GetKeyType(); |
205 } else { | 206 } else { |
206 *store_mode = STANDARD_STORE; | 207 *store_mode = STANDARD_STORE; |
207 *key_type = ELEMENT; | 208 *key_type = ELEMENT; |
208 } | 209 } |
209 } | 210 } |
210 | 211 |
211 | 212 |
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 } | 408 } |
408 | 409 |
409 | 410 |
410 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, | 411 void TypeFeedbackOracle::CountReceiverTypes(TypeFeedbackId id, |
411 SmallMapList* receiver_types) { | 412 SmallMapList* receiver_types) { |
412 receiver_types->Clear(); | 413 receiver_types->Clear(); |
413 CollectReceiverTypes(id, receiver_types); | 414 CollectReceiverTypes(id, receiver_types); |
414 } | 415 } |
415 | 416 |
416 | 417 |
| 418 void TypeFeedbackOracle::CountReceiverTypes(FeedbackVectorICSlot slot, |
| 419 SmallMapList* receiver_types) { |
| 420 receiver_types->Clear(); |
| 421 if (!slot.IsInvalid()) CollectReceiverTypes(slot, receiver_types); |
| 422 } |
| 423 |
| 424 |
417 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, | 425 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, |
418 Handle<Name> name, | 426 Handle<Name> name, |
419 Code::Flags flags, | 427 Code::Flags flags, |
420 SmallMapList* types) { | 428 SmallMapList* types) { |
421 StoreICNexus nexus(feedback_vector_, slot); | 429 StoreICNexus nexus(feedback_vector_, slot); |
422 CollectReceiverTypes<FeedbackNexus>(&nexus, name, flags, types); | 430 CollectReceiverTypes<FeedbackNexus>(&nexus, name, flags, types); |
423 } | 431 } |
424 | 432 |
425 | 433 |
426 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, | 434 void TypeFeedbackOracle::CollectReceiverTypes(TypeFeedbackId ast_id, |
(...skipping 28 matching lines...) Expand all Loading... |
455 SmallMapList* types) { | 463 SmallMapList* types) { |
456 Handle<Object> object = GetInfo(ast_id); | 464 Handle<Object> object = GetInfo(ast_id); |
457 if (!object->IsCode()) return; | 465 if (!object->IsCode()) return; |
458 Handle<Code> code = Handle<Code>::cast(object); | 466 Handle<Code> code = Handle<Code>::cast(object); |
459 CollectReceiverTypes<Code>(*code, types); | 467 CollectReceiverTypes<Code>(*code, types); |
460 } | 468 } |
461 | 469 |
462 | 470 |
463 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, | 471 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, |
464 SmallMapList* types) { | 472 SmallMapList* types) { |
465 KeyedStoreICNexus nexus(feedback_vector_, slot); | 473 Code::Kind kind = feedback_vector_->GetKind(slot); |
466 CollectReceiverTypes<FeedbackNexus>(&nexus, types); | 474 if (kind == Code::STORE_IC) { |
| 475 StoreICNexus nexus(feedback_vector_, slot); |
| 476 CollectReceiverTypes<FeedbackNexus>(&nexus, types); |
| 477 } else { |
| 478 DCHECK(kind == Code::KEYED_STORE_IC); |
| 479 KeyedStoreICNexus nexus(feedback_vector_, slot); |
| 480 CollectReceiverTypes<FeedbackNexus>(&nexus, types); |
| 481 } |
467 } | 482 } |
468 | 483 |
469 | 484 |
470 template <class T> | 485 template <class T> |
471 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) { | 486 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) { |
472 MapHandleList maps; | 487 MapHandleList maps; |
473 if (obj->ic_state() == MONOMORPHIC) { | 488 if (obj->ic_state() == MONOMORPHIC) { |
474 Map* map = obj->FindFirstMap(); | 489 Map* map = obj->FindFirstMap(); |
475 if (map != NULL) maps.Add(handle(map)); | 490 if (map != NULL) maps.Add(handle(map)); |
476 } else if (obj->ic_state() == POLYMORPHIC) { | 491 } else if (obj->ic_state() == POLYMORPHIC) { |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 // Dictionary has been allocated with sufficient size for all elements. | 587 // Dictionary has been allocated with sufficient size for all elements. |
573 DisallowHeapAllocation no_need_to_resize_dictionary; | 588 DisallowHeapAllocation no_need_to_resize_dictionary; |
574 HandleScope scope(isolate()); | 589 HandleScope scope(isolate()); |
575 USE(UnseededNumberDictionary::AtNumberPut( | 590 USE(UnseededNumberDictionary::AtNumberPut( |
576 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 591 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
577 } | 592 } |
578 | 593 |
579 | 594 |
580 } // namespace internal | 595 } // namespace internal |
581 } // namespace v8 | 596 } // namespace v8 |
OLD | NEW |