From: ishell@chromium.org Date: Tue, 25 Mar 2014 15:33:22 +0000 (+0000) Subject: TransitionElementsKind() and its recursive call chain handlified. X-Git-Tag: upstream/4.7.83~10009 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f306341b46719a1dd2bff85966057a16c158e75f;p=platform%2Fupstream%2Fv8.git TransitionElementsKind() and its recursive call chain handlified. R=verwaest@chromium.org Review URL: https://codereview.chromium.org/207553005 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20253 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/api.cc b/src/api.cc index f5ae10d..f61f190 100644 --- a/src/api.cc +++ b/src/api.cc @@ -3731,7 +3731,7 @@ void PrepareExternalArrayElements(i::Handle object, isolate->factory()->NewExternalArray(length, array_type, data); i::Handle external_array_map = - isolate->factory()->GetElementsTransitionMap( + i::JSObject::GetElementsTransitionMap( object, GetElementsKindFromExternalArrayType(array_type)); diff --git a/src/elements.cc b/src/elements.cc index c8e28c5..3949747 100644 --- a/src/elements.cc +++ b/src/elements.cc @@ -770,30 +770,15 @@ class ElementsAccessorBase : public ElementsAccessor { Handle array, int capacity, int length) V8_FINAL V8_OVERRIDE { - CALL_HEAP_FUNCTION_VOID( - array->GetIsolate(), - ElementsAccessorSubclass::SetFastElementsCapacityAndLength( - *array, - capacity, - length)); + ElementsAccessorSubclass:: + SetFastElementsCapacityAndLength(array, capacity, length); } - MUST_USE_RESULT static MaybeObject* SetFastElementsCapacityAndLength( - JSObject* obj, - int capacity, - int length) { - UNIMPLEMENTED(); - return obj; - } - - // TODO(ishell): Temporary wrapper until handlified. - MUST_USE_RESULT static Handle SetFastElementsCapacityAndLength( + static void SetFastElementsCapacityAndLength( Handle obj, int capacity, int length) { - CALL_HEAP_FUNCTION(obj->GetIsolate(), - SetFastElementsCapacityAndLength(*obj, capacity, length), - Object); + UNIMPLEMENTED(); } MUST_USE_RESULT virtual Handle Delete( @@ -1232,26 +1217,16 @@ class FastSmiOrObjectElementsAccessor } - static MaybeObject* SetFastElementsCapacityAndLength(JSObject* obj, - uint32_t capacity, - uint32_t length) { + static void SetFastElementsCapacityAndLength( + Handle obj, + uint32_t capacity, + uint32_t length) { JSObject::SetFastElementsCapacitySmiMode set_capacity_mode = obj->HasFastSmiElements() ? JSObject::kAllowSmiElements : JSObject::kDontAllowSmiElements; - return obj->SetFastElementsCapacityAndLength(capacity, - length, - set_capacity_mode); - } - - // TODO(ishell): Temporary wrapper until handlified. - static Handle SetFastElementsCapacityAndLength( - Handle obj, - int capacity, - int length) { - CALL_HEAP_FUNCTION(obj->GetIsolate(), - SetFastElementsCapacityAndLength(*obj, capacity, length), - Object); + JSObject::SetFastElementsCapacityAndLength( + obj, capacity, length, set_capacity_mode); } }; @@ -1316,21 +1291,10 @@ class FastDoubleElementsAccessor KindTraits, kDoubleSize>(name) {} - static MaybeObject* SetFastElementsCapacityAndLength(JSObject* obj, - uint32_t capacity, - uint32_t length) { - return obj->SetFastDoubleElementsCapacityAndLength(capacity, - length); - } - - // TODO(ishell): Temporary wrapper until handlified. - static Handle SetFastElementsCapacityAndLength( - Handle obj, - int capacity, - int length) { - CALL_HEAP_FUNCTION(obj->GetIsolate(), - SetFastElementsCapacityAndLength(*obj, capacity, length), - Object); + static void SetFastElementsCapacityAndLength(Handle obj, + uint32_t capacity, + uint32_t length) { + JSObject::SetFastDoubleElementsCapacityAndLength(obj, capacity, length); } protected: diff --git a/src/elements.h b/src/elements.h index 2ee07aa..ea335aa 100644 --- a/src/elements.h +++ b/src/elements.h @@ -167,6 +167,15 @@ class ElementsAccessor { int copy_size, FixedArrayBase* source = NULL) = 0; + void CopyElements( + Handle from_holder, + Handle to, + ElementsKind from_kind, + Handle from = Handle::null()) { + CopyElements(from_holder, 0, from_kind, to, 0, + kCopyToEndAndInitializeToHole, from); + } + MUST_USE_RESULT MaybeObject* CopyElements(JSObject* from_holder, FixedArrayBase* to, ElementsKind from_kind, diff --git a/src/factory.cc b/src/factory.cc index e292455..f6f6525 100644 --- a/src/factory.cc +++ b/src/factory.cc @@ -883,16 +883,6 @@ Handle Factory::CopyMap(Handle src) { } -Handle Factory::GetElementsTransitionMap( - Handle src, - ElementsKind elements_kind) { - Isolate* i = isolate(); - CALL_HEAP_FUNCTION(i, - src->GetElementsTransitionMap(i, elements_kind), - Map); -} - - Handle Factory::CopyFixedArray(Handle array) { CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray); } diff --git a/src/factory.h b/src/factory.h index e57e130..e390052 100644 --- a/src/factory.h +++ b/src/factory.h @@ -288,9 +288,6 @@ class Factory { Handle CopyMap(Handle map, int extra_inobject_props); Handle CopyMap(Handle map); - Handle GetElementsTransitionMap(Handle object, - ElementsKind elements_kind); - Handle CopyFixedArray(Handle array); // This method expects a COW array in new space, and creates a copy diff --git a/src/objects.cc b/src/objects.cc index f56ef57..b5e78d3 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -1532,17 +1532,18 @@ void JSObject::JSObjectShortPrint(StringStream* accumulator) { void JSObject::PrintElementsTransition( - FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, - ElementsKind to_kind, FixedArrayBase* to_elements) { + FILE* file, Handle object, + ElementsKind from_kind, Handle from_elements, + ElementsKind to_kind, Handle to_elements) { if (from_kind != to_kind) { PrintF(file, "elements transition ["); PrintElementsKind(file, from_kind); PrintF(file, " -> "); PrintElementsKind(file, to_kind); PrintF(file, "] in "); - JavaScriptFrame::PrintTop(GetIsolate(), file, false, true); + JavaScriptFrame::PrintTop(object->GetIsolate(), file, false, true); PrintF(file, " for "); - ShortPrint(file); + object->ShortPrint(file); PrintF(file, " from "); from_elements->ShortPrint(file); PrintF(file, " to "); @@ -11139,33 +11140,20 @@ Handle JSObject::SetFastElementsCapacityAndLength( int capacity, int length, SetFastElementsCapacitySmiMode smi_mode) { - CALL_HEAP_FUNCTION( - object->GetIsolate(), - object->SetFastElementsCapacityAndLength(capacity, length, smi_mode), - FixedArray); -} - - -MaybeObject* JSObject::SetFastElementsCapacityAndLength( - int capacity, - int length, - SetFastElementsCapacitySmiMode smi_mode) { - Heap* heap = GetHeap(); // We should never end in here with a pixel or external array. - ASSERT(!HasExternalArrayElements()); + ASSERT(!object->HasExternalArrayElements()); // Allocate a new fast elements backing store. - FixedArray* new_elements; - MaybeObject* maybe = heap->AllocateUninitializedFixedArray(capacity); - if (!maybe->To(&new_elements)) return maybe; + Handle new_elements = + object->GetIsolate()->factory()->NewUninitializedFixedArray(capacity); - ElementsKind elements_kind = GetElementsKind(); + ElementsKind elements_kind = object->GetElementsKind(); ElementsKind new_elements_kind; // The resized array has FAST_*_SMI_ELEMENTS if the capacity mode forces it, // or if it's allowed and the old elements array contained only SMIs. bool has_fast_smi_elements = (smi_mode == kForceSmiElements) || - ((smi_mode == kAllowSmiElements) && HasFastSmiElements()); + ((smi_mode == kAllowSmiElements) && object->HasFastSmiElements()); if (has_fast_smi_elements) { if (IsHoleyElementsKind(elements_kind)) { new_elements_kind = FAST_HOLEY_SMI_ELEMENTS; @@ -11179,37 +11167,31 @@ MaybeObject* JSObject::SetFastElementsCapacityAndLength( new_elements_kind = FAST_ELEMENTS; } } - FixedArrayBase* old_elements = elements(); + Handle old_elements(object->elements()); ElementsAccessor* accessor = ElementsAccessor::ForKind(new_elements_kind); - MaybeObject* maybe_obj = - accessor->CopyElements(this, new_elements, elements_kind); - if (maybe_obj->IsFailure()) return maybe_obj; + accessor->CopyElements(object, new_elements, elements_kind); if (elements_kind != SLOPPY_ARGUMENTS_ELEMENTS) { - Map* new_map = map(); - if (new_elements_kind != elements_kind) { - MaybeObject* maybe = - GetElementsTransitionMap(GetIsolate(), new_elements_kind); - if (!maybe->To(&new_map)) return maybe; - } - ValidateElements(); - set_map_and_elements(new_map, new_elements); + Handle new_map = (new_elements_kind != elements_kind) + ? GetElementsTransitionMap(object, new_elements_kind) + : handle(object->map()); + object->ValidateElements(); + object->set_map_and_elements(*new_map, *new_elements); // Transition through the allocation site as well if present. - maybe_obj = UpdateAllocationSite(new_elements_kind); - if (maybe_obj->IsFailure()) return maybe_obj; + JSObject::UpdateAllocationSite(object, new_elements_kind); } else { - FixedArray* parameter_map = FixedArray::cast(old_elements); - parameter_map->set(1, new_elements); + Handle parameter_map = Handle::cast(old_elements); + parameter_map->set(1, *new_elements); } if (FLAG_trace_elements_transitions) { - PrintElementsTransition(stdout, elements_kind, old_elements, - GetElementsKind(), new_elements); + PrintElementsTransition(stdout, object, elements_kind, old_elements, + object->GetElementsKind(), new_elements); } - if (IsJSArray()) { - JSArray::cast(this)->set_length(Smi::FromInt(length)); + if (object->IsJSArray()) { + Handle::cast(object)->set_length(Smi::FromInt(length)); } return new_elements; } @@ -11218,26 +11200,13 @@ MaybeObject* JSObject::SetFastElementsCapacityAndLength( void JSObject::SetFastDoubleElementsCapacityAndLength(Handle object, int capacity, int length) { - CALL_HEAP_FUNCTION_VOID( - object->GetIsolate(), - object->SetFastDoubleElementsCapacityAndLength(capacity, length)); -} - - -MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( - int capacity, - int length) { - Heap* heap = GetHeap(); // We should never end in here with a pixel or external array. - ASSERT(!HasExternalArrayElements()); + ASSERT(!object->HasExternalArrayElements()); - FixedArrayBase* elems; - { MaybeObject* maybe_obj = - heap->AllocateUninitializedFixedDoubleArray(capacity); - if (!maybe_obj->To(&elems)) return maybe_obj; - } + Handle elems = + object->GetIsolate()->factory()->NewFixedDoubleArray(capacity); - ElementsKind elements_kind = GetElementsKind(); + ElementsKind elements_kind = object->GetElementsKind(); CHECK(elements_kind != SLOPPY_ARGUMENTS_ELEMENTS); ElementsKind new_elements_kind = elements_kind; if (IsHoleyElementsKind(elements_kind)) { @@ -11246,32 +11215,23 @@ MaybeObject* JSObject::SetFastDoubleElementsCapacityAndLength( new_elements_kind = FAST_DOUBLE_ELEMENTS; } - Map* new_map; - { MaybeObject* maybe_obj = - GetElementsTransitionMap(heap->isolate(), new_elements_kind); - if (!maybe_obj->To(&new_map)) return maybe_obj; - } + Handle new_map = GetElementsTransitionMap(object, new_elements_kind); - FixedArrayBase* old_elements = elements(); + Handle old_elements(object->elements()); ElementsAccessor* accessor = ElementsAccessor::ForKind(FAST_DOUBLE_ELEMENTS); - { MaybeObject* maybe_obj = - accessor->CopyElements(this, elems, elements_kind); - if (maybe_obj->IsFailure()) return maybe_obj; - } + accessor->CopyElements(object, elems, elements_kind); - ValidateElements(); - set_map_and_elements(new_map, elems); + object->ValidateElements(); + object->set_map_and_elements(*new_map, *elems); if (FLAG_trace_elements_transitions) { - PrintElementsTransition(stdout, elements_kind, old_elements, - GetElementsKind(), elems); + PrintElementsTransition(stdout, object, elements_kind, old_elements, + object->GetElementsKind(), elems); } - if (IsJSArray()) { - JSArray::cast(this)->set_length(Smi::FromInt(length)); + if (object->IsJSArray()) { + Handle::cast(object)->set_length(Smi::FromInt(length)); } - - return this; } @@ -12663,13 +12623,6 @@ Handle JSObject::SetElementWithoutInterceptor( } -void JSObject::TransitionElementsKind(Handle object, - ElementsKind to_kind) { - CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), - object->TransitionElementsKind(to_kind)); -} - - const double AllocationSite::kPretenureRatio = 0.85; @@ -12701,11 +12654,13 @@ bool AllocationSite::IsNestedSite() { } -MaybeObject* AllocationSite::DigestTransitionFeedback(ElementsKind to_kind) { - Isolate* isolate = GetIsolate(); +void AllocationSite::DigestTransitionFeedback(Handle site, + ElementsKind to_kind) { + Isolate* isolate = site->GetIsolate(); - if (SitePointsToLiteral() && transition_info()->IsJSArray()) { - JSArray* transition_info = JSArray::cast(this->transition_info()); + if (site->SitePointsToLiteral() && site->transition_info()->IsJSArray()) { + Handle transition_info = + handle(JSArray::cast(site->transition_info())); ElementsKind kind = transition_info->GetElementsKind(); // if kind is holey ensure that to_kind is as well. if (IsHoleyElementsKind(kind)) { @@ -12718,22 +12673,21 @@ MaybeObject* AllocationSite::DigestTransitionFeedback(ElementsKind to_kind) { CHECK(transition_info->length()->ToArrayIndex(&length)); if (length <= kMaximumArrayBytesToPretransition) { if (FLAG_trace_track_allocation_sites) { - bool is_nested = IsNestedSite(); + bool is_nested = site->IsNestedSite(); PrintF( "AllocationSite: JSArray %p boilerplate %s updated %s->%s\n", - reinterpret_cast(this), + reinterpret_cast(*site), is_nested ? "(nested)" : "", ElementsKindToString(kind), ElementsKindToString(to_kind)); } - MaybeObject* result = transition_info->TransitionElementsKind(to_kind); - if (result->IsFailure()) return result; - dependent_code()->DeoptimizeDependentCodeGroup( + JSObject::TransitionElementsKind(transition_info, to_kind); + site->dependent_code()->DeoptimizeDependentCodeGroup( isolate, DependentCode::kAllocationSiteTransitionChangedGroup); } } } else { - ElementsKind kind = GetElementsKind(); + ElementsKind kind = site->GetElementsKind(); // if kind is holey ensure that to_kind is as well. if (IsHoleyElementsKind(kind)) { to_kind = GetHoleyElementsKind(to_kind); @@ -12741,16 +12695,15 @@ MaybeObject* AllocationSite::DigestTransitionFeedback(ElementsKind to_kind) { if (IsMoreGeneralElementsKindTransition(kind, to_kind)) { if (FLAG_trace_track_allocation_sites) { PrintF("AllocationSite: JSArray %p site updated %s->%s\n", - reinterpret_cast(this), + reinterpret_cast(*site), ElementsKindToString(kind), ElementsKindToString(to_kind)); } - SetElementsKind(to_kind); - dependent_code()->DeoptimizeDependentCodeGroup( + site->SetElementsKind(to_kind); + site->dependent_code()->DeoptimizeDependentCodeGroup( isolate, DependentCode::kAllocationSiteTransitionChangedGroup); } } - return this; } @@ -12769,64 +12722,62 @@ void AllocationSite::AddDependentCompilationInfo(Handle site, void JSObject::UpdateAllocationSite(Handle object, ElementsKind to_kind) { - CALL_HEAP_FUNCTION_VOID(object->GetIsolate(), - object->UpdateAllocationSite(to_kind)); -} - + if (!object->IsJSArray()) return; -MaybeObject* JSObject::UpdateAllocationSite(ElementsKind to_kind) { - if (!IsJSArray()) return this; + Heap* heap = object->GetHeap(); + if (!heap->InNewSpace(*object)) return; - Heap* heap = GetHeap(); - if (!heap->InNewSpace(this)) return this; - - // Check if there is potentially a memento behind the object. If - // the last word of the momento is on another page we return - // immediatelly. - Address object_address = address(); - Address memento_address = object_address + JSArray::kSize; - Address last_memento_word_address = memento_address + kPointerSize; - if (!NewSpacePage::OnSamePage(object_address, - last_memento_word_address)) { - return this; - } + Handle site; + { + DisallowHeapAllocation no_allocation; + // Check if there is potentially a memento behind the object. If + // the last word of the momento is on another page we return + // immediatelly. + Address object_address = object->address(); + Address memento_address = object_address + JSArray::kSize; + Address last_memento_word_address = memento_address + kPointerSize; + if (!NewSpacePage::OnSamePage(object_address, + last_memento_word_address)) { + return; + } - // Either object is the last object in the new space, or there is another - // object of at least word size (the header map word) following it, so - // suffices to compare ptr and top here. - Address top = heap->NewSpaceTop(); - ASSERT(memento_address == top || - memento_address + HeapObject::kHeaderSize <= top); - if (memento_address == top) return this; + // Either object is the last object in the new space, or there is another + // object of at least word size (the header map word) following it, so + // suffices to compare ptr and top here. + Address top = heap->NewSpaceTop(); + ASSERT(memento_address == top || + memento_address + HeapObject::kHeaderSize <= top); + if (memento_address == top) return; - HeapObject* candidate = HeapObject::FromAddress(memento_address); - if (candidate->map() != heap->allocation_memento_map()) return this; + HeapObject* candidate = HeapObject::FromAddress(memento_address); + if (candidate->map() != heap->allocation_memento_map()) return; - AllocationMemento* memento = AllocationMemento::cast(candidate); - if (!memento->IsValid()) return this; + AllocationMemento* memento = AllocationMemento::cast(candidate); + if (!memento->IsValid()) return; - // Walk through to the Allocation Site - AllocationSite* site = memento->GetAllocationSite(); - return site->DigestTransitionFeedback(to_kind); + // Walk through to the Allocation Site + site = handle(memento->GetAllocationSite()); + } + AllocationSite::DigestTransitionFeedback(site, to_kind); } -MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { - ElementsKind from_kind = map()->elements_kind(); +void JSObject::TransitionElementsKind(Handle object, + ElementsKind to_kind) { + ElementsKind from_kind = object->map()->elements_kind(); if (IsFastHoleyElementsKind(from_kind)) { to_kind = GetHoleyElementsKind(to_kind); } - if (from_kind == to_kind) return this; + if (from_kind == to_kind) return; // Don't update the site if to_kind isn't fast if (IsFastElementsKind(to_kind)) { - MaybeObject* maybe_failure = UpdateAllocationSite(to_kind); - if (maybe_failure->IsFailure()) return maybe_failure; + UpdateAllocationSite(object, to_kind); } - Isolate* isolate = GetIsolate(); - if (elements() == isolate->heap()->empty_fixed_array() || + Isolate* isolate = object->GetIsolate(); + if (object->elements() == isolate->heap()->empty_fixed_array() || (IsFastSmiOrObjectElementsKind(from_kind) && IsFastSmiOrObjectElementsKind(to_kind)) || (from_kind == FAST_DOUBLE_ELEMENTS && @@ -12834,55 +12785,48 @@ MaybeObject* JSObject::TransitionElementsKind(ElementsKind to_kind) { ASSERT(from_kind != TERMINAL_FAST_ELEMENTS_KIND); // No change is needed to the elements() buffer, the transition // only requires a map change. - MaybeObject* maybe_new_map = GetElementsTransitionMap(isolate, to_kind); - Map* new_map; - if (!maybe_new_map->To(&new_map)) return maybe_new_map; - // TODO(verwaest): Replace by MigrateToMap. - set_map(new_map); + Handle new_map = GetElementsTransitionMap(object, to_kind); + MigrateToMap(object, new_map); if (FLAG_trace_elements_transitions) { - FixedArrayBase* elms = FixedArrayBase::cast(elements()); - PrintElementsTransition(stdout, from_kind, elms, to_kind, elms); + Handle elms(object->elements()); + PrintElementsTransition(stdout, object, from_kind, elms, to_kind, elms); } - return this; + return; } - FixedArrayBase* elms = FixedArrayBase::cast(elements()); + Handle elms(object->elements()); uint32_t capacity = static_cast(elms->length()); uint32_t length = capacity; - if (IsJSArray()) { - Object* raw_length = JSArray::cast(this)->length(); + if (object->IsJSArray()) { + Object* raw_length = Handle::cast(object)->length(); if (raw_length->IsUndefined()) { // If length is undefined, then JSArray is being initialized and has no // elements, assume a length of zero. length = 0; } else { - CHECK(JSArray::cast(this)->length()->ToArrayIndex(&length)); + CHECK(raw_length->ToArrayIndex(&length)); } } if (IsFastSmiElementsKind(from_kind) && IsFastDoubleElementsKind(to_kind)) { - MaybeObject* maybe_result = - SetFastDoubleElementsCapacityAndLength(capacity, length); - if (maybe_result->IsFailure()) return maybe_result; - ValidateElements(); - return this; + SetFastDoubleElementsCapacityAndLength(object, capacity, length); + object->ValidateElements(); + return; } if (IsFastDoubleElementsKind(from_kind) && IsFastObjectElementsKind(to_kind)) { - MaybeObject* maybe_result = SetFastElementsCapacityAndLength( - capacity, length, kDontAllowSmiElements); - if (maybe_result->IsFailure()) return maybe_result; - ValidateElements(); - return this; + SetFastElementsCapacityAndLength(object, capacity, length, + kDontAllowSmiElements); + object->ValidateElements(); + return; } // This method should never be called for any other case than the ones // handled above. UNREACHABLE(); - return GetIsolate()->heap()->null_value(); } diff --git a/src/objects.h b/src/objects.h index 762892c..edb7903 100644 --- a/src/objects.h +++ b/src/objects.h @@ -2492,15 +2492,11 @@ class JSObject: public JSReceiver { kDontAllowSmiElements }; - static Handle SetFastElementsCapacityAndLength( - Handle object, - int capacity, - int length, - SetFastElementsCapacitySmiMode smi_mode); // Replace the elements' backing store with fast elements of the given // capacity. Update the length for JSArrays. Returns the new backing // store. - MUST_USE_RESULT MaybeObject* SetFastElementsCapacityAndLength( + static Handle SetFastElementsCapacityAndLength( + Handle object, int capacity, int length, SetFastElementsCapacitySmiMode smi_mode); @@ -2576,8 +2572,6 @@ class JSObject: public JSReceiver { static void TransitionElementsKind(Handle object, ElementsKind to_kind); - MUST_USE_RESULT MaybeObject* TransitionElementsKind(ElementsKind to_kind); - // TODO(mstarzinger): Both public because of ConvertAnsSetLocalProperty(). static void MigrateToMap(Handle object, Handle new_map); static void GeneralizeFieldRepresentation(Handle object, @@ -2669,9 +2663,10 @@ class JSObject: public JSReceiver { void PrintTransitions(FILE* out = stdout); #endif - void PrintElementsTransition( - FILE* file, ElementsKind from_kind, FixedArrayBase* from_elements, - ElementsKind to_kind, FixedArrayBase* to_elements); + static void PrintElementsTransition( + FILE* file, Handle object, + ElementsKind from_kind, Handle from_elements, + ElementsKind to_kind, Handle to_elements); void PrintInstanceMigration(FILE* file, Map* original_map, Map* new_map); @@ -2768,7 +2763,6 @@ class JSObject: public JSReceiver { static void UpdateAllocationSite(Handle object, ElementsKind to_kind); - MUST_USE_RESULT MaybeObject* UpdateAllocationSite(ElementsKind to_kind); // Used from Object::GetProperty(). static Handle GetPropertyWithFailedAccessCheck( @@ -8369,7 +8363,8 @@ class AllocationSite: public Struct { return transition_info()->IsJSArray() || transition_info()->IsJSObject(); } - MaybeObject* DigestTransitionFeedback(ElementsKind to_kind); + static void DigestTransitionFeedback(Handle site, + ElementsKind to_kind); enum Reason { TENURING, diff --git a/src/runtime.cc b/src/runtime.cc index 229eb89..cfa427c 100644 --- a/src/runtime.cc +++ b/src/runtime.cc @@ -10025,11 +10025,9 @@ class ArrayConcatVisitor { isolate_->factory()->NewNumber(static_cast(index_offset_)); Handle map; if (fast_elements_) { - map = isolate_->factory()->GetElementsTransitionMap(array, - FAST_HOLEY_ELEMENTS); + map = JSObject::GetElementsTransitionMap(array, FAST_HOLEY_ELEMENTS); } else { - map = isolate_->factory()->GetElementsTransitionMap(array, - DICTIONARY_ELEMENTS); + map = JSObject::GetElementsTransitionMap(array, DICTIONARY_ELEMENTS); } array->set_map(*map); array->set_length(*length); @@ -10563,7 +10561,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayConcat) { Handle array = isolate->factory()->NewJSArray(0); Smi* length = Smi::FromInt(j); Handle map; - map = isolate->factory()->GetElementsTransitionMap(array, kind); + map = JSObject::GetElementsTransitionMap(array, kind); array->set_map(*map); array->set_length(length); array->set_elements(*double_storage); diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 12f846e..f1cda62 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -16424,7 +16424,7 @@ static void FixedTypedArrayTestHelper( v8::Handle obj = v8::Object::New(CcTest::isolate()); i::Handle jsobj = v8::Utils::OpenHandle(*obj); i::Handle fixed_array_map = - isolate->factory()->GetElementsTransitionMap(jsobj, elements_kind); + i::JSObject::GetElementsTransitionMap(jsobj, elements_kind); jsobj->set_map(*fixed_array_map); jsobj->set_elements(*fixed_array);