[ic] Handlify an object reference in ConfigureCloneObject

Bug: v8:9989
Change-Id: I6923f99398c0a1c8b447e18e0416a2630a09ee5d
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/1924259
Reviewed-by: Michael Stanton <mvstanton@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Auto-Submit: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#65065}
This commit is contained in:
Georg Neis 2019-11-20 12:06:48 +01:00 committed by Commit Bot
parent 7d74acdfeb
commit 7b3b82f04f

View File

@ -764,11 +764,15 @@ void FeedbackNexus::ConfigureHandlerMode(const MaybeObjectHandle& handler) {
void FeedbackNexus::ConfigureCloneObject(Handle<Map> source_map, void FeedbackNexus::ConfigureCloneObject(Handle<Map> source_map,
Handle<Map> result_map) { Handle<Map> result_map) {
Isolate* isolate = GetIsolate(); Isolate* isolate = GetIsolate();
MaybeObject maybe_feedback = GetFeedback(); Handle<HeapObject> feedback;
Handle<HeapObject> feedback(maybe_feedback->IsStrongOrWeak() {
? maybe_feedback->GetHeapObject() MaybeObject maybe_feedback = GetFeedback();
: HeapObject(), if (maybe_feedback->IsStrongOrWeak()) {
isolate); feedback = handle(maybe_feedback->GetHeapObject(), isolate);
} else {
DCHECK(maybe_feedback->IsCleared());
}
}
switch (ic_state()) { switch (ic_state()) {
case UNINITIALIZED: case UNINITIALIZED:
// Cache the first map seen which meets the fast case requirements. // Cache the first map seen which meets the fast case requirements.
@ -776,16 +780,15 @@ void FeedbackNexus::ConfigureCloneObject(Handle<Map> source_map,
SetFeedbackExtra(*result_map); SetFeedbackExtra(*result_map);
break; break;
case MONOMORPHIC: case MONOMORPHIC:
if (maybe_feedback->IsCleared() || feedback.is_identical_to(source_map) || if (feedback.is_null() || feedback.is_identical_to(source_map) ||
Map::cast(*feedback).is_deprecated()) { Map::cast(*feedback).is_deprecated()) {
// Remain in MONOMORPHIC state if previous feedback has been collected.
SetFeedback(HeapObjectReference::Weak(*source_map)); SetFeedback(HeapObjectReference::Weak(*source_map));
SetFeedbackExtra(*result_map); SetFeedbackExtra(*result_map);
} else { } else {
// Transition to POLYMORPHIC. // Transition to POLYMORPHIC.
Handle<WeakFixedArray> array = Handle<WeakFixedArray> array =
EnsureArrayOfSize(2 * kCloneObjectPolymorphicEntrySize); EnsureArrayOfSize(2 * kCloneObjectPolymorphicEntrySize);
array->Set(0, maybe_feedback); array->Set(0, HeapObjectReference::Weak(*feedback));
array->Set(1, GetFeedbackExtra()); array->Set(1, GetFeedbackExtra());
array->Set(2, HeapObjectReference::Weak(*source_map)); array->Set(2, HeapObjectReference::Weak(*source_map));
array->Set(3, MaybeObject::FromObject(*result_map)); array->Set(3, MaybeObject::FromObject(*result_map));
@ -798,9 +801,10 @@ void FeedbackNexus::ConfigureCloneObject(Handle<Map> source_map,
Handle<WeakFixedArray> array = Handle<WeakFixedArray>::cast(feedback); Handle<WeakFixedArray> array = Handle<WeakFixedArray>::cast(feedback);
int i = 0; int i = 0;
for (; i < array->length(); i += kCloneObjectPolymorphicEntrySize) { for (; i < array->length(); i += kCloneObjectPolymorphicEntrySize) {
MaybeObject feedback = array->Get(i); MaybeObject feedback_map = array->Get(i);
if (feedback->IsCleared()) break; if (feedback_map->IsCleared()) break;
Handle<Map> cached_map(Map::cast(feedback->GetHeapObject()), isolate); Handle<Map> cached_map(Map::cast(feedback_map->GetHeapObject()),
isolate);
if (cached_map.is_identical_to(source_map) || if (cached_map.is_identical_to(source_map) ||
cached_map->is_deprecated()) cached_map->is_deprecated())
break; break;