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

Side by Side Diff: src/type-feedback-vector.cc

Issue 2662113005: [ic] Introduce IsXyzIC() predicates. (Closed)
Patch Set: Created 3 years, 10 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.h ('k') | src/type-feedback-vector-inl.h » ('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 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/type-feedback-vector.h" 5 #include "src/type-feedback-vector.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/ic/ic-inl.h" 8 #include "src/ic/ic-inl.h"
9 #include "src/ic/ic-state.h" 9 #include "src/ic/ic-state.h"
10 #include "src/objects.h" 10 #include "src/objects.h"
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 const int length = slot_count + kReservedIndexCount; 190 const int length = slot_count + kReservedIndexCount;
191 if (length == kReservedIndexCount) { 191 if (length == kReservedIndexCount) {
192 return Handle<TypeFeedbackVector>::cast( 192 return Handle<TypeFeedbackVector>::cast(
193 factory->empty_type_feedback_vector()); 193 factory->empty_type_feedback_vector());
194 } 194 }
195 195
196 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED); 196 Handle<FixedArray> array = factory->NewFixedArray(length, TENURED);
197 array->set_map_no_write_barrier(isolate->heap()->type_feedback_vector_map()); 197 array->set_map_no_write_barrier(isolate->heap()->type_feedback_vector_map());
198 array->set(kMetadataIndex, *metadata); 198 array->set(kMetadataIndex, *metadata);
199 array->set(kInvocationCountIndex, Smi::kZero); 199 array->set(kInvocationCountIndex, Smi::kZero);
200 for (int i = 0; i < slot_count;) {
mvstanton 2017/02/01 15:57:12 Actually if you can keep this here I'd prefer it,
Igor Sheludko 2017/02/01 16:10:01 As discussed offline, we should better remove the
201 FeedbackVectorSlot slot(i);
202 FeedbackVectorSlotKind kind = metadata->GetKind(slot);
203 int index = TypeFeedbackVector::GetIndex(slot);
204 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind);
205
206 if (kind == FeedbackVectorSlotKind::CREATE_CLOSURE) {
207 // TODO(mvstanton): Root feedback vectors in this location.
208 array->set(index, *factory->empty_type_feedback_vector(),
209 SKIP_WRITE_BARRIER);
210 }
211 i += entry_size;
212 }
213 200
214 DisallowHeapAllocation no_gc; 201 DisallowHeapAllocation no_gc;
215 202
216 // Ensure we can skip the write barrier 203 // Ensure we can skip the write barrier
217 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate); 204 Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate);
218 Handle<Oddball> undefined_value = factory->undefined_value(); 205 Handle<Oddball> undefined_value = factory->undefined_value();
219 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel); 206 DCHECK_EQ(isolate->heap()->uninitialized_symbol(), *uninitialized_sentinel);
220 for (int i = 0; i < slot_count;) { 207 for (int i = 0; i < slot_count;) {
221 FeedbackVectorSlot slot(i); 208 FeedbackVectorSlot slot(i);
222 FeedbackVectorSlotKind kind = metadata->GetKind(slot); 209 FeedbackVectorSlotKind kind = metadata->GetKind(slot);
223 int index = TypeFeedbackVector::GetIndex(slot); 210 int index = TypeFeedbackVector::GetIndex(slot);
224 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); 211 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind);
225 212
226 Object* value; 213 Object* value;
227 if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) { 214 Object* extra_value = *uninitialized_sentinel;
228 value = isolate->heap()->empty_weak_cell(); 215 switch (kind) {
229 } else if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC || 216 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC:
230 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) { 217 value = isolate->heap()->empty_weak_cell();
231 value = Smi::kZero; 218 break;
232 } else if (kind == FeedbackVectorSlotKind::LITERAL) { 219 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC:
233 value = *undefined_value; 220 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
234 } else { 221 value = Smi::kZero;
235 value = *uninitialized_sentinel; 222 break;
223 case FeedbackVectorSlotKind::CREATE_CLOSURE:
224 // TODO(mvstanton): Root feedback vectors in this location.
225 value = isolate->heap()->empty_type_feedback_vector();
226 break;
227 case FeedbackVectorSlotKind::LITERAL:
228 value = *undefined_value;
229 break;
230 case FeedbackVectorSlotKind::CALL_IC:
231 value = *uninitialized_sentinel;
232 extra_value = Smi::kZero;
233 break;
234 case FeedbackVectorSlotKind::LOAD_IC:
235 case FeedbackVectorSlotKind::KEYED_LOAD_IC:
236 case FeedbackVectorSlotKind::STORE_IC:
237 case FeedbackVectorSlotKind::KEYED_STORE_IC:
238 case FeedbackVectorSlotKind::STORE_DATA_PROPERTY_IN_LITERAL_IC:
239 case FeedbackVectorSlotKind::GENERAL:
240 value = *uninitialized_sentinel;
241 break;
242
243 case FeedbackVectorSlotKind::INVALID:
244 case FeedbackVectorSlotKind::KINDS_NUMBER:
245 UNREACHABLE();
246 value = Smi::kZero;
247 break;
236 } 248 }
237 249 array->set(index, value, SKIP_WRITE_BARRIER);
238 if (kind != FeedbackVectorSlotKind::CREATE_CLOSURE) { 250 for (int j = 1; j < entry_size; j++) {
239 array->set(index, value, SKIP_WRITE_BARRIER); 251 array->set(index + j, extra_value, SKIP_WRITE_BARRIER);
240 value = kind == FeedbackVectorSlotKind::CALL_IC ? Smi::kZero
241 : *uninitialized_sentinel;
242 for (int j = 1; j < entry_size; j++) {
243 array->set(index + j, value, SKIP_WRITE_BARRIER);
244 }
245 } 252 }
246 i += entry_size; 253 i += entry_size;
247 } 254 }
248 return Handle<TypeFeedbackVector>::cast(array); 255 return Handle<TypeFeedbackVector>::cast(array);
249 } 256 }
250 257
251 // static 258 // static
252 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy( 259 Handle<TypeFeedbackVector> TypeFeedbackVector::Copy(
253 Isolate* isolate, Handle<TypeFeedbackVector> vector) { 260 Isolate* isolate, Handle<TypeFeedbackVector> vector) {
254 Handle<TypeFeedbackVector> result; 261 Handle<TypeFeedbackVector> result;
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 void FeedbackNexus::ConfigurePremonomorphic() { 418 void FeedbackNexus::ConfigurePremonomorphic() {
412 SetFeedback(*TypeFeedbackVector::PremonomorphicSentinel(GetIsolate()), 419 SetFeedback(*TypeFeedbackVector::PremonomorphicSentinel(GetIsolate()),
413 SKIP_WRITE_BARRIER); 420 SKIP_WRITE_BARRIER);
414 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()), 421 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(GetIsolate()),
415 SKIP_WRITE_BARRIER); 422 SKIP_WRITE_BARRIER);
416 } 423 }
417 424
418 425
419 void FeedbackNexus::ConfigureMegamorphic() { 426 void FeedbackNexus::ConfigureMegamorphic() {
420 // Keyed ICs must use ConfigureMegamorphicKeyed. 427 // Keyed ICs must use ConfigureMegamorphicKeyed.
421 DCHECK_NE(FeedbackVectorSlotKind::KEYED_LOAD_IC, vector()->GetKind(slot())); 428 DCHECK(!vector()->IsKeyedLoadIC(slot()));
422 DCHECK_NE(FeedbackVectorSlotKind::KEYED_STORE_IC, vector()->GetKind(slot())); 429 DCHECK(!vector()->IsKeyedStoreIC(slot()));
423 430
424 Isolate* isolate = GetIsolate(); 431 Isolate* isolate = GetIsolate();
425 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate), 432 SetFeedback(*TypeFeedbackVector::MegamorphicSentinel(isolate),
426 SKIP_WRITE_BARRIER); 433 SKIP_WRITE_BARRIER);
427 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate), 434 SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate),
428 SKIP_WRITE_BARRIER); 435 SKIP_WRITE_BARRIER);
429 } 436 }
430 437
431 void KeyedLoadICNexus::ConfigureMegamorphicKeyed(IcCheckType property_type) { 438 void KeyedLoadICNexus::ConfigureMegamorphicKeyed(IcCheckType property_type) {
432 Isolate* isolate = GetIsolate(); 439 Isolate* isolate = GetIsolate();
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
1034 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic( 1041 void StoreDataPropertyInLiteralICNexus::ConfigureMonomorphic(
1035 Handle<Name> name, Handle<Map> receiver_map) { 1042 Handle<Name> name, Handle<Map> receiver_map) {
1036 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map); 1043 Handle<WeakCell> cell = Map::WeakCellForMap(receiver_map);
1037 1044
1038 SetFeedback(*cell); 1045 SetFeedback(*cell);
1039 SetFeedbackExtra(*name); 1046 SetFeedbackExtra(*name);
1040 } 1047 }
1041 1048
1042 } // namespace internal 1049 } // namespace internal
1043 } // namespace v8 1050 } // namespace v8
OLDNEW
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/type-feedback-vector-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698