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

Unified Diff: src/type-feedback-vector.cc

Issue 2065113002: [ic] LoadGlobalIC caches PropertyCells in the feedback vector. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebasing Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/type-feedback-vector.cc
diff --git a/src/type-feedback-vector.cc b/src/type-feedback-vector.cc
index 57c728bc61581897b72a21b6c60c22aa61dd6bda..e9e8b512dd3b6ca397f52f6885cb7bac475efb53 100644
--- a/src/type-feedback-vector.cc
+++ b/src/type-feedback-vector.cc
@@ -179,10 +179,25 @@ Handle<TypeFeedbackVector> TypeFeedbackVector::New(
// Ensure we can skip the write barrier
Handle<Object> uninitialized_sentinel = UninitializedSentinel(isolate);
DCHECK_EQ(*factory->uninitialized_symbol(), *uninitialized_sentinel);
- for (int i = kReservedIndexCount; i < length; i++) {
- array->set(i, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
- }
+ for (int i = 0; i < slot_count;) {
+ FeedbackVectorSlot slot(i);
+ FeedbackVectorSlotKind kind = metadata->GetKind(slot);
+ int index = TypeFeedbackVector::GetIndex(slot);
+ int entry_size = TypeFeedbackMetadata::GetSlotSize(kind);
+ Object* value;
+ if (FLAG_new_load_global_ic &&
+ kind == FeedbackVectorSlotKind::LOAD_GLOBAL_IC) {
+ value = *factory->empty_weak_cell();
+ } else {
+ value = *uninitialized_sentinel;
+ }
+ array->set(index, value, SKIP_WRITE_BARRIER);
+ for (int j = 1; j < entry_size; j++) {
+ array->set(index + j, *uninitialized_sentinel, SKIP_WRITE_BARRIER);
+ }
+ i += entry_size;
+ }
return Handle<TypeFeedbackVector>::cast(array);
}
@@ -448,21 +463,30 @@ InlineCacheState LoadGlobalICNexus::StateFromFeedback() const {
Isolate* isolate = GetIsolate();
Object* feedback = GetFeedback();
- if (feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)) {
- return UNINITIALIZED;
- } else if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate)) {
- return MEGAMORPHIC;
- } else if (feedback == *TypeFeedbackVector::PremonomorphicSentinel(isolate)) {
- return PREMONOMORPHIC;
- } else if (feedback->IsFixedArray()) {
- // Determine state purely by our structure, don't check if the maps are
- // cleared.
- return POLYMORPHIC;
- } else if (feedback->IsWeakCell()) {
- // Don't check if the map is cleared.
- return MONOMORPHIC;
- }
+ if (FLAG_new_load_global_ic) {
+ Object* extra = GetFeedbackExtra();
+ if (!WeakCell::cast(feedback)->cleared() ||
+ extra != *TypeFeedbackVector::UninitializedSentinel(isolate)) {
+ return MONOMORPHIC;
+ }
+ } else {
+ if (feedback == *TypeFeedbackVector::UninitializedSentinel(isolate)) {
+ return UNINITIALIZED;
+ } else if (feedback == *TypeFeedbackVector::MegamorphicSentinel(isolate)) {
+ return MEGAMORPHIC;
+ } else if (feedback ==
+ *TypeFeedbackVector::PremonomorphicSentinel(isolate)) {
+ return PREMONOMORPHIC;
+ } else if (feedback->IsFixedArray()) {
+ // Determine state purely by our structure, don't check if the maps are
+ // cleared.
+ return POLYMORPHIC;
+ } else if (feedback->IsWeakCell()) {
+ // Don't check if the map is cleared.
+ return MONOMORPHIC;
+ }
+ }
return UNINITIALIZED;
}
@@ -618,6 +642,25 @@ void LoadGlobalICNexus::ConfigureMonomorphic(Handle<Map> receiver_map,
SetFeedbackExtra(*handler);
}
+void LoadGlobalICNexus::ConfigureUninitialized() {
+ Isolate* isolate = GetIsolate();
+ SetFeedback(isolate->heap()->empty_weak_cell(), SKIP_WRITE_BARRIER);
+ SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate),
+ SKIP_WRITE_BARRIER);
+}
+
+void LoadGlobalICNexus::ConfigurePropertyCellMode(Handle<PropertyCell> cell) {
+ Isolate* isolate = GetIsolate();
+ SetFeedback(*isolate->factory()->NewWeakCell(cell));
+ SetFeedbackExtra(*TypeFeedbackVector::UninitializedSentinel(isolate),
+ SKIP_WRITE_BARRIER);
+}
+
+void LoadGlobalICNexus::ConfigureHandlerMode(Handle<Code> handler) {
+ SetFeedback(GetIsolate()->heap()->empty_weak_cell());
+ SetFeedbackExtra(*handler);
+}
+
void KeyedLoadICNexus::ConfigureMonomorphic(Handle<Name> name,
Handle<Map> receiver_map,
Handle<Code> handler) {
« no previous file with comments | « src/type-feedback-vector.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698