Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(61)

Side by Side Diff: src/type-info.cc

Issue 1369973002: Use FeedbackVectorSlotKind instead of Code::Kind for type feedback vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/type-feedback-vector.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 // If we can't find an IC, assume we've seen *something*, but we don't know 101 // If we can't find an IC, assume we've seen *something*, but we don't know
102 // what. PREMONOMORPHIC roughly encodes this meaning. 102 // what. PREMONOMORPHIC roughly encodes this meaning.
103 return PREMONOMORPHIC; 103 return PREMONOMORPHIC;
104 } 104 }
105 105
106 106
107 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState( 107 InlineCacheState TypeFeedbackOracle::LoadInlineCacheState(
108 FeedbackVectorICSlot slot) { 108 FeedbackVectorICSlot slot) {
109 if (!slot.IsInvalid()) { 109 if (!slot.IsInvalid()) {
110 Code::Kind kind = feedback_vector_->GetKind(slot); 110 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
111 if (kind == Code::LOAD_IC) { 111 if (kind == FeedbackVectorSlotKind::LOAD_IC) {
112 LoadICNexus nexus(feedback_vector_, slot); 112 LoadICNexus nexus(feedback_vector_, slot);
113 return nexus.StateFromFeedback(); 113 return nexus.StateFromFeedback();
114 } else if (kind == Code::KEYED_LOAD_IC) { 114 } else if (kind == FeedbackVectorSlotKind::KEYED_LOAD_IC) {
115 KeyedLoadICNexus nexus(feedback_vector_, slot); 115 KeyedLoadICNexus nexus(feedback_vector_, slot);
116 return nexus.StateFromFeedback(); 116 return nexus.StateFromFeedback();
117 } 117 }
118 } 118 }
119 119
120 // If we can't find an IC, assume we've seen *something*, but we don't know 120 // If we can't find an IC, assume we've seen *something*, but we don't know
121 // what. PREMONOMORPHIC roughly encodes this meaning. 121 // what. PREMONOMORPHIC roughly encodes this meaning.
122 return PREMONOMORPHIC; 122 return PREMONOMORPHIC;
123 } 123 }
124 124
125 125
126 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) { 126 bool TypeFeedbackOracle::StoreIsUninitialized(TypeFeedbackId ast_id) {
127 Handle<Object> maybe_code = GetInfo(ast_id); 127 Handle<Object> maybe_code = GetInfo(ast_id);
128 if (!maybe_code->IsCode()) return false; 128 if (!maybe_code->IsCode()) return false;
129 Handle<Code> code = Handle<Code>::cast(maybe_code); 129 Handle<Code> code = Handle<Code>::cast(maybe_code);
130 return code->ic_state() == UNINITIALIZED; 130 return code->ic_state() == UNINITIALIZED;
131 } 131 }
132 132
133 133
134 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorICSlot slot) { 134 bool TypeFeedbackOracle::StoreIsUninitialized(FeedbackVectorICSlot slot) {
135 if (!slot.IsInvalid()) { 135 if (!slot.IsInvalid()) {
136 Code::Kind kind = feedback_vector_->GetKind(slot); 136 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
137 if (kind == Code::STORE_IC) { 137 if (kind == FeedbackVectorSlotKind::STORE_IC) {
138 StoreICNexus nexus(feedback_vector_, slot); 138 StoreICNexus nexus(feedback_vector_, slot);
139 return nexus.StateFromFeedback() == UNINITIALIZED; 139 return nexus.StateFromFeedback() == UNINITIALIZED;
140 } else if (kind == Code::KEYED_STORE_IC) { 140 } else if (kind == FeedbackVectorSlotKind::KEYED_STORE_IC) {
141 KeyedStoreICNexus nexus(feedback_vector_, slot); 141 KeyedStoreICNexus nexus(feedback_vector_, slot);
142 return nexus.StateFromFeedback() == UNINITIALIZED; 142 return nexus.StateFromFeedback() == UNINITIALIZED;
143 } 143 }
144 } 144 }
145 return true; 145 return true;
146 } 146 }
147 147
148 148
149 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorICSlot slot) { 149 bool TypeFeedbackOracle::CallIsUninitialized(FeedbackVectorICSlot slot) {
150 Handle<Object> value = GetInfo(slot); 150 Handle<Object> value = GetInfo(slot);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 } 190 }
191 *store_mode = STANDARD_STORE; 191 *store_mode = STANDARD_STORE;
192 *key_type = ELEMENT; 192 *key_type = ELEMENT;
193 } 193 }
194 194
195 195
196 void TypeFeedbackOracle::GetStoreModeAndKeyType( 196 void TypeFeedbackOracle::GetStoreModeAndKeyType(
197 FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode, 197 FeedbackVectorICSlot slot, KeyedAccessStoreMode* store_mode,
198 IcCheckType* key_type) { 198 IcCheckType* key_type) {
199 if (!slot.IsInvalid() && 199 if (!slot.IsInvalid() &&
200 feedback_vector_->GetKind(slot) == Code::KEYED_STORE_IC) { 200 feedback_vector_->GetKind(slot) ==
201 FeedbackVectorSlotKind::KEYED_STORE_IC) {
201 KeyedStoreICNexus nexus(feedback_vector_, slot); 202 KeyedStoreICNexus nexus(feedback_vector_, slot);
202 *store_mode = nexus.GetKeyedAccessStoreMode(); 203 *store_mode = nexus.GetKeyedAccessStoreMode();
203 *key_type = nexus.GetKeyType(); 204 *key_type = nexus.GetKeyType();
204 } else { 205 } else {
205 *store_mode = STANDARD_STORE; 206 *store_mode = STANDARD_STORE;
206 *key_type = ELEMENT; 207 *key_type = ELEMENT;
207 } 208 }
208 } 209 }
209 210
210 211
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
461 SmallMapList* types) { 462 SmallMapList* types) {
462 Handle<Object> object = GetInfo(ast_id); 463 Handle<Object> object = GetInfo(ast_id);
463 if (!object->IsCode()) return; 464 if (!object->IsCode()) return;
464 Handle<Code> code = Handle<Code>::cast(object); 465 Handle<Code> code = Handle<Code>::cast(object);
465 CollectReceiverTypes<Code>(*code, types); 466 CollectReceiverTypes<Code>(*code, types);
466 } 467 }
467 468
468 469
469 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot, 470 void TypeFeedbackOracle::CollectReceiverTypes(FeedbackVectorICSlot slot,
470 SmallMapList* types) { 471 SmallMapList* types) {
471 Code::Kind kind = feedback_vector_->GetKind(slot); 472 FeedbackVectorSlotKind kind = feedback_vector_->GetKind(slot);
472 if (kind == Code::STORE_IC) { 473 if (kind == FeedbackVectorSlotKind::STORE_IC) {
473 StoreICNexus nexus(feedback_vector_, slot); 474 StoreICNexus nexus(feedback_vector_, slot);
474 CollectReceiverTypes<FeedbackNexus>(&nexus, types); 475 CollectReceiverTypes<FeedbackNexus>(&nexus, types);
475 } else { 476 } else {
476 DCHECK(kind == Code::KEYED_STORE_IC); 477 DCHECK_EQ(FeedbackVectorSlotKind::KEYED_STORE_IC, kind);
477 KeyedStoreICNexus nexus(feedback_vector_, slot); 478 KeyedStoreICNexus nexus(feedback_vector_, slot);
478 CollectReceiverTypes<FeedbackNexus>(&nexus, types); 479 CollectReceiverTypes<FeedbackNexus>(&nexus, types);
479 } 480 }
480 } 481 }
481 482
482 483
483 template <class T> 484 template <class T>
484 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) { 485 void TypeFeedbackOracle::CollectReceiverTypes(T* obj, SmallMapList* types) {
485 MapHandleList maps; 486 MapHandleList maps;
486 if (obj->ic_state() == MONOMORPHIC) { 487 if (obj->ic_state() == MONOMORPHIC) {
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 // Dictionary has been allocated with sufficient size for all elements. 586 // Dictionary has been allocated with sufficient size for all elements.
586 DisallowHeapAllocation no_need_to_resize_dictionary; 587 DisallowHeapAllocation no_need_to_resize_dictionary;
587 HandleScope scope(isolate()); 588 HandleScope scope(isolate());
588 USE(UnseededNumberDictionary::AtNumberPut( 589 USE(UnseededNumberDictionary::AtNumberPut(
589 dictionary_, IdToKey(ast_id), handle(target, isolate()))); 590 dictionary_, IdToKey(ast_id), handle(target, isolate())));
590 } 591 }
591 592
592 593
593 } // namespace internal 594 } // namespace internal
594 } // namespace v8 595 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-feedback-vector.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698