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

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

Issue 2342853002: [TypeFeedbackVector] special ic slots for interpreter compare/binary ops. (Closed)
Patch Set: Code comments. Created 4 years, 3 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
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.h" 8 #include "src/ic/ic.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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
195 case FeedbackVectorSlotKind::LOAD_IC: 195 case FeedbackVectorSlotKind::LOAD_IC:
196 return "LOAD_IC"; 196 return "LOAD_IC";
197 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC: 197 case FeedbackVectorSlotKind::LOAD_GLOBAL_IC:
198 return "LOAD_GLOBAL_IC"; 198 return "LOAD_GLOBAL_IC";
199 case FeedbackVectorSlotKind::KEYED_LOAD_IC: 199 case FeedbackVectorSlotKind::KEYED_LOAD_IC:
200 return "KEYED_LOAD_IC"; 200 return "KEYED_LOAD_IC";
201 case FeedbackVectorSlotKind::STORE_IC: 201 case FeedbackVectorSlotKind::STORE_IC:
202 return "STORE_IC"; 202 return "STORE_IC";
203 case FeedbackVectorSlotKind::KEYED_STORE_IC: 203 case FeedbackVectorSlotKind::KEYED_STORE_IC:
204 return "KEYED_STORE_IC"; 204 return "KEYED_STORE_IC";
205 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
206 return "INTERPRETER_BINARYOP_IC";
207 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC:
208 return "INTERPRETER_COMPARE_IC";
205 case FeedbackVectorSlotKind::GENERAL: 209 case FeedbackVectorSlotKind::GENERAL:
206 return "STUB"; 210 return "STUB";
207 case FeedbackVectorSlotKind::KINDS_NUMBER: 211 case FeedbackVectorSlotKind::KINDS_NUMBER:
208 break; 212 break;
209 } 213 }
210 UNREACHABLE(); 214 UNREACHABLE();
211 return "?"; 215 return "?";
212 } 216 }
213 217
214 FeedbackVectorSlotKind TypeFeedbackVector::GetKind( 218 FeedbackVectorSlotKind TypeFeedbackVector::GetKind(
(...skipping 30 matching lines...) Expand all
245 DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel); 249 DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel);
246 for (int i = 0; i < slot_count;) { 250 for (int i = 0; i < slot_count;) {
247 FeedbackVectorSlot slot(i); 251 FeedbackVectorSlot slot(i);
248 FeedbackVectorSlotKind kind = metadata->GetKind(slot); 252 FeedbackVectorSlotKind kind = metadata->GetKind(slot);
249 int index = TypeFeedbackVector::GetIndex(slot); 253 int index = TypeFeedbackVector::GetIndex(slot);
250 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind); 254 int entry_size = TypeFeedbackMetadata::GetSlotSize(kind);
251 255
252 Object* value; 256 Object* value;
253 if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) { 257 if (kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
254 value = *factory->empty_weak_cell(); 258 value = *factory->empty_weak_cell();
259 } else if (kind == FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC ||
260 kind == FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC) {
261 value = Smi::FromInt(0);
255 } else { 262 } else {
256 value = *uninitialized_sentinel; 263 value = *uninitialized_sentinel;
257 } 264 }
258 array->set(index, value, SKIP_WRITE_BARRIER); 265 array->set(index, value, SKIP_WRITE_BARRIER);
259 266
260 value = kind == FeedbackVectorSlotKind::CALL_IC ? Smi::FromInt(0) 267 value = kind == FeedbackVectorSlotKind::CALL_IC ? Smi::FromInt(0)
261 : *uninitialized_sentinel; 268 : *uninitialized_sentinel;
262 for (int j = 1; j < entry_size; j++) { 269 for (int j = 1; j < entry_size; j++) {
263 array->set(index + j, value, SKIP_WRITE_BARRIER); 270 array->set(index + j, value, SKIP_WRITE_BARRIER);
264 } 271 }
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 case FeedbackVectorSlotKind::STORE_IC: { 339 case FeedbackVectorSlotKind::STORE_IC: {
333 StoreICNexus nexus(this, slot); 340 StoreICNexus nexus(this, slot);
334 nexus.Clear(shared->code()); 341 nexus.Clear(shared->code());
335 break; 342 break;
336 } 343 }
337 case FeedbackVectorSlotKind::KEYED_STORE_IC: { 344 case FeedbackVectorSlotKind::KEYED_STORE_IC: {
338 KeyedStoreICNexus nexus(this, slot); 345 KeyedStoreICNexus nexus(this, slot);
339 nexus.Clear(shared->code()); 346 nexus.Clear(shared->code());
340 break; 347 break;
341 } 348 }
349 case FeedbackVectorSlotKind::INTERPRETER_BINARYOP_IC:
350 case FeedbackVectorSlotKind::INTERPRETER_COMPARE_IC: {
351 DCHECK(Get(slot)->IsSmi());
352 // don't clear these smi slots.
353 // Set(slot, Smi::FromInt(0));
354 break;
355 }
342 case FeedbackVectorSlotKind::GENERAL: { 356 case FeedbackVectorSlotKind::GENERAL: {
343 if (obj->IsHeapObject()) { 357 if (obj->IsHeapObject()) {
344 InstanceType instance_type = 358 InstanceType instance_type =
345 HeapObject::cast(obj)->map()->instance_type(); 359 HeapObject::cast(obj)->map()->instance_type();
346 // AllocationSites are exempt from clearing. They don't store Maps 360 // AllocationSites are exempt from clearing. They don't store Maps
347 // or Code pointers which can cause memory leaks if not cleared 361 // or Code pointers which can cause memory leaks if not cleared
348 // regularly. 362 // regularly.
349 if (instance_type != ALLOCATION_SITE_TYPE) { 363 if (instance_type != ALLOCATION_SITE_TYPE) {
350 Set(slot, uninitialized_sentinel, SKIP_WRITE_BARRIER); 364 Set(slot, uninitialized_sentinel, SKIP_WRITE_BARRIER);
351 } 365 }
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; 1044 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT;
1031 } 1045 }
1032 1046
1033 IcCheckType KeyedStoreICNexus::GetKeyType() const { 1047 IcCheckType KeyedStoreICNexus::GetKeyType() const {
1034 Object* feedback = GetFeedback(); 1048 Object* feedback = GetFeedback();
1035 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) { 1049 if (feedback == *TypeFeedbackVector::MegamorphicSentinel(GetIsolate())) {
1036 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value()); 1050 return static_cast<IcCheckType>(Smi::cast(GetFeedbackExtra())->value());
1037 } 1051 }
1038 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT; 1052 return IsPropertyNameFeedback(feedback) ? PROPERTY : ELEMENT;
1039 } 1053 }
1054
1055 InlineCacheState BinaryOpICNexus::StateFromFeedback() const {
1056 BinaryOperationHint hint = GetBinaryOperationFeedback();
1057 if (hint == BinaryOperationHint::kNone) {
1058 return UNINITIALIZED;
1059 } else if (hint == BinaryOperationHint::kAny) {
1060 return GENERIC;
1061 }
1062
1063 return MONOMORPHIC;
1064 }
1065
1066 InlineCacheState CompareICNexus::StateFromFeedback() const {
1067 CompareOperationHint hint = GetCompareOperationFeedback();
1068 if (hint == CompareOperationHint::kNone) {
1069 return UNINITIALIZED;
1070 } else if (hint == CompareOperationHint::kAny) {
1071 return GENERIC;
1072 }
1073
1074 return MONOMORPHIC;
1075 }
1076
1077 BinaryOperationHint BinaryOpICNexus::GetBinaryOperationFeedback() const {
1078 int feedback = Smi::cast(GetFeedback())->value();
1079 return BinaryOperationHintFromFeedback(feedback);
1080 }
1081
1082 CompareOperationHint CompareICNexus::GetCompareOperationFeedback() const {
1083 int feedback = Smi::cast(GetFeedback())->value();
1084 return CompareOperationHintFromFeedback(feedback);
1085 }
1086
1040 } // namespace internal 1087 } // namespace internal
1041 } // namespace v8 1088 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698