| 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/ast.h" | 7 #include "src/ast/ast.h" |
| 8 #include "src/code-stubs.h" | 8 #include "src/code-stubs.h" |
| 9 #include "src/ic/ic.h" | 9 #include "src/ic/ic.h" |
| 10 #include "src/ic/stub-cache.h" | 10 #include "src/ic/stub-cache.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 } | 68 } |
| 69 | 69 |
| 70 return undefined; | 70 return undefined; |
| 71 } | 71 } |
| 72 | 72 |
| 73 | 73 |
| 74 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( | 74 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( |
| 75 FeedbackVectorSlot slot) { | 75 FeedbackVectorSlot slot) { |
| 76 if (!slot.IsInvalid()) { | 76 if (!slot.IsInvalid()) { |
| 77 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 77 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
| 78 if (kind == FeedbackVectorSlotKind::LOAD_IC) { | 78 if (IsLoadICKind(kind)) { |
| 79 LoadICNexus nexus(feedback_vector_, slot); | 79 LoadICNexus nexus(feedback_vector_, slot); |
| 80 return nexus.StateFromFeedback(); | 80 return nexus.StateFromFeedback(); |
| 81 } else if (kind == FeedbackVectorSlotKind::KEYED_LOAD_IC) { | 81 } else if (IsKeyedLoadICKind(kind)) { |
| 82 KeyedLoadICNexus nexus(feedback_vector_, slot); | 82 KeyedLoadICNexus nexus(feedback_vector_, slot); |
| 83 return nexus.StateFromFeedback(); | 83 return nexus.StateFromFeedback(); |
| 84 } | 84 } |
| 85 } | 85 } |
| 86 | 86 |
| 87 // If we can't find an IC, assume we've seen *something*, but we don't know | 87 // If we can't find an IC, assume we've seen *something*, but we don't know |
| 88 // what. PREMONOMORPHIC roughly encodes this meaning. | 88 // what. PREMONOMORPHIC roughly encodes this meaning. |
| 89 return PREMONOMORPHIC; | 89 return PREMONOMORPHIC; |
| 90 } | 90 } |
| 91 | 91 |
| 92 | 92 |
| 93 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorSlot slot) { | 93 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorSlot slot) { |
| 94 if (!slot.IsInvalid()) { | 94 if (!slot.IsInvalid()) { |
| 95 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 95 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); |
| 96 if (kind == FeedbackVectorSlotKind::STORE_IC) { | 96 if (IsStoreICKind(kind)) { |
| 97 StoreICNexus nexus(feedback_vector_, slot); | 97 StoreICNexus nexus(feedback_vector_, slot); |
| 98 return nexus.StateFromFeedback() == UNINITIALIZED; | 98 return nexus.StateFromFeedback() == UNINITIALIZED; |
| 99 } else if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) { | 99 } else if (IsKeyedStoreICKind(kind)) { |
| 100 KeyedStoreICNexus nexus(feedback_vector_, slot); | 100 KeyedStoreICNexus nexus(feedback_vector_, slot); |
| 101 return nexus.StateFromFeedback() == UNINITIALIZED; | 101 return nexus.StateFromFeedback() == UNINITIALIZED; |
| 102 } | 102 } |
| 103 } | 103 } |
| 104 return true; | 104 return true; |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorSlot slot) { | 108 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorSlot slot) { |
| 109 Handle<Object> value = GetInfo(slot); | 109 Handle<Object> value = GetInfo(slot); |
| (...skipping 20 matching lines...) Expand all Loading... |
| 130 return value.is_identical_to( | 130 return value.is_identical_to( |
| 131 TypeFeedbackVector::UninitializedSentinel(isolate())) | 131 TypeFeedbackVector::UninitializedSentinel(isolate())) |
| 132 ? ForInStatement::FAST_FOR_IN | 132 ? ForInStatement::FAST_FOR_IN |
| 133 : ForInStatement::SLOW_FOR_IN; | 133 : ForInStatement::SLOW_FOR_IN; |
| 134 } | 134 } |
| 135 | 135 |
| 136 | 136 |
| 137 void TypeFeedbackOracle::GetStoreModeAndKeyType( | 137 void TypeFeedbackOracle::GetStoreModeAndKeyType( |
| 138 FeedbackVectorSlot slot, KeyedAccessStoreMode* store_mode, | 138 FeedbackVectorSlot slot, KeyedAccessStoreMode* store_mode, |
| 139 IcCheckType* key_type) { | 139 IcCheckType* key_type) { |
| 140 if (!slot.IsInvalid() && | 140 if (!slot.IsInvalid() && feedback_vector_->IsKeyedStoreIC(slot)) { |
| 141 feedback_vector_->GetKind(slot) == | |
| 142 FeedbackVectorSlotKind::KEYED_STORE_IC) { | |
| 143 KeyedStoreICNexus nexus(feedback_vector_, slot); | 141 KeyedStoreICNexus nexus(feedback_vector_, slot); |
| 144 *store_mode = nexus.GetKeyedAccessStoreMode(); | 142 *store_mode = nexus.GetKeyedAccessStoreMode(); |
| 145 *key_type = nexus.GetKeyType(); | 143 *key_type = nexus.GetKeyType(); |
| 146 } else { | 144 } else { |
| 147 *store_mode = STANDARD_STORE; | 145 *store_mode = STANDARD_STORE; |
| 148 *key_type = ELEMENT; | 146 *key_type = ELEMENT; |
| 149 } | 147 } |
| 150 } | 148 } |
| 151 | 149 |
| 152 | 150 |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 types->Reserve(4, zone()); | 468 types->Reserve(4, zone()); |
| 471 stub_cache->CollectMatchingMaps(types, name, native_context_, zone()); | 469 stub_cache->CollectMatchingMaps(types, name, native_context_, zone()); |
| 472 } else { | 470 } else { |
| 473 CollectReceiverTypes(nexus, types); | 471 CollectReceiverTypes(nexus, types); |
| 474 } | 472 } |
| 475 } | 473 } |
| 476 | 474 |
| 477 | 475 |
| 478 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, | 476 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorSlot slot, |
| 479 SmallMapList* types) { | 477 SmallMapList* types) { |
| 480 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot); | 478 if (feedback_vector_->IsStoreIC(slot)) { |
| 481 if (kind == FeedbackVectorSlotKind::STORE_IC) { | |
| 482 StoreICNexus nexus(feedback_vector_, slot); | 479 StoreICNexus nexus(feedback_vector_, slot); |
| 483 CollectReceiverTypes(&nexus, types); | 480 CollectReceiverTypes(&nexus, types); |
| 484 } else { | 481 } else { |
| 485 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind); | 482 DCHECK(feedback_vector_->IsKeyedStoreIC(slot)); |
| 486 KeyedStoreICNexus nexus(feedback_vector_, slot); | 483 KeyedStoreICNexus nexus(feedback_vector_, slot); |
| 487 CollectReceiverTypes(&nexus, types); | 484 CollectReceiverTypes(&nexus, types); |
| 488 } | 485 } |
| 489 } | 486 } |
| 490 | 487 |
| 491 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus, | 488 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackNexus* nexus, |
| 492 SmallMapList* types) { | 489 SmallMapList* types) { |
| 493 MapHandleList maps; | 490 MapHandleList maps; |
| 494 if (nexus->ic_state() == MONOMORPHIC) { | 491 if (nexus->ic_state() == MONOMORPHIC) { |
| 495 Map* map = nexus->FindFirstMap(); | 492 Map* map = nexus->FindFirstMap(); |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 // Dictionary has been allocated with sufficient size for all elements. | 589 // Dictionary has been allocated with sufficient size for all elements. |
| 593 DisallowHeapAllocation no_need_to_resize_dictionary; | 590 DisallowHeapAllocation no_need_to_resize_dictionary; |
| 594 HandleScope scope(isolate()); | 591 HandleScope scope(isolate()); |
| 595 USE(UnseededNumberDictionary::AtNumberPut( | 592 USE(UnseededNumberDictionary::AtNumberPut( |
| 596 dictionary_, IdToKey(ast_id), handle(target, isolate()))); | 593 dictionary_, IdToKey(ast_id), handle(target, isolate()))); |
| 597 } | 594 } |
| 598 | 595 |
| 599 | 596 |
| 600 } // namespace internal | 597 } // namespace internal |
| 601 } // namespace v8 | 598 } // namespace v8 |
| OLD | NEW |