From: mstarzinger@chromium.org Date: Wed, 18 Sep 2013 14:46:30 +0000 (+0000) Subject: Delete obsolete JSArray allocation functions. X-Git-Tag: upstream/4.7.83~12436 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ad69e19d6739b50933ee7f1ad20721879fdf3a2e;p=platform%2Fupstream%2Fv8.git Delete obsolete JSArray allocation functions. R=verwaest@chromium.org Review URL: https://codereview.chromium.org/24202003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16791 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/builtins.cc b/src/builtins.cc index 9290852..454cf46 100644 --- a/src/builtins.cc +++ b/src/builtins.cc @@ -195,79 +195,6 @@ BUILTIN(EmptyFunction) { } -static MaybeObject* ArrayCodeGenericCommon(Arguments* args, - Isolate* isolate, - JSFunction* constructor) { - ASSERT(args->length() >= 1); - Heap* heap = isolate->heap(); - isolate->counters()->array_function_runtime()->Increment(); - - JSArray* array; - if (CalledAsConstructor(isolate)) { - array = JSArray::cast((*args)[0]); - // Initialize elements and length in case later allocations fail so that the - // array object is initialized in a valid state. - MaybeObject* maybe_array = array->Initialize(0); - if (maybe_array->IsFailure()) return maybe_array; - - AllocationMemento* memento = AllocationMemento::FindForJSObject(array); - if (memento != NULL && memento->IsValid()) { - AllocationSite* site = memento->GetAllocationSite(); - ElementsKind to_kind = site->GetElementsKind(); - if (IsMoreGeneralElementsKindTransition(array->GetElementsKind(), - to_kind)) { - // We have advice that we should change the elements kind - if (FLAG_trace_track_allocation_sites) { - PrintF("AllocationSite: pre-transitioning array %p(%s->%s)\n", - reinterpret_cast(array), - ElementsKindToString(array->GetElementsKind()), - ElementsKindToString(to_kind)); - } - - maybe_array = array->TransitionElementsKind(to_kind); - if (maybe_array->IsFailure()) return maybe_array; - } - } - - if (!FLAG_smi_only_arrays) { - Context* native_context = isolate->context()->native_context(); - if (array->GetElementsKind() == GetInitialFastElementsKind() && - !native_context->js_array_maps()->IsUndefined()) { - FixedArray* map_array = - FixedArray::cast(native_context->js_array_maps()); - array->set_map(Map::cast(map_array-> - get(TERMINAL_FAST_ELEMENTS_KIND))); - } - } - } else { - // Allocate the JS Array - MaybeObject* maybe_obj = heap->AllocateJSObject(constructor); - if (!maybe_obj->To(&array)) return maybe_obj; - } - - Arguments adjusted_arguments(args->length() - 1, args->arguments() - 1); - ASSERT(adjusted_arguments.length() < 1 || - adjusted_arguments[0] == (*args)[1]); - return ArrayConstructInitializeElements(array, &adjusted_arguments); -} - - -BUILTIN(InternalArrayCodeGeneric) { - return ArrayCodeGenericCommon( - &args, - isolate, - isolate->context()->native_context()->internal_array_function()); -} - - -BUILTIN(ArrayCodeGeneric) { - return ArrayCodeGenericCommon( - &args, - isolate, - isolate->context()->native_context()->array_function()); -} - - static void MoveDoubleElements(FixedDoubleArray* dst, int dst_index, FixedDoubleArray* src, diff --git a/src/builtins.h b/src/builtins.h index c712f1e..01061b6 100644 --- a/src/builtins.h +++ b/src/builtins.h @@ -63,9 +63,6 @@ enum BuiltinExtraArguments { \ V(EmptyFunction, NO_EXTRA_ARGUMENTS) \ \ - V(InternalArrayCodeGeneric, NO_EXTRA_ARGUMENTS) \ - V(ArrayCodeGeneric, NO_EXTRA_ARGUMENTS) \ - \ V(ArrayPush, NO_EXTRA_ARGUMENTS) \ V(ArrayPop, NO_EXTRA_ARGUMENTS) \ V(ArrayShift, NO_EXTRA_ARGUMENTS) \ diff --git a/src/heap-inl.h b/src/heap-inl.h index 86aff1a..6c33cfc 100644 --- a/src/heap-inl.h +++ b/src/heap-inl.h @@ -532,14 +532,6 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) { } -MaybeObject* Heap::AllocateEmptyJSArrayWithAllocationSite( - ElementsKind elements_kind, - Handle allocation_site) { - return AllocateJSArrayAndStorageWithAllocationSite(elements_kind, 0, 0, - allocation_site, DONT_INITIALIZE_ARRAY_ELEMENTS); -} - - bool Heap::CollectGarbage(AllocationSpace space, const char* gc_reason) { const char* collector_reason = NULL; GarbageCollector collector = SelectGarbageCollector(space, &collector_reason); diff --git a/src/heap.cc b/src/heap.cc index b3e8cd7..23b7c89 100644 --- a/src/heap.cc +++ b/src/heap.cc @@ -4755,20 +4755,6 @@ MaybeObject* Heap::AllocateJSArrayAndStorage( } -MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite( - ElementsKind elements_kind, - int length, - int capacity, - Handle allocation_site, - ArrayStorageAllocationMode mode) { - MaybeObject* maybe_array = AllocateJSArrayWithAllocationSite(elements_kind, - allocation_site); - JSArray* array; - if (!maybe_array->To(&array)) return maybe_array; - return AllocateJSArrayStorage(array, length, capacity, mode); -} - - MaybeObject* Heap::AllocateJSArrayStorage( JSArray* array, int length, @@ -5486,24 +5472,6 @@ MaybeObject* Heap::AllocateJSArray( } -MaybeObject* Heap::AllocateJSArrayWithAllocationSite( - ElementsKind elements_kind, - Handle allocation_site) { - Context* native_context = isolate()->context()->native_context(); - JSFunction* array_function = native_context->array_function(); - Map* map = array_function->initial_map(); - Object* maybe_map_array = native_context->js_array_maps(); - if (!maybe_map_array->IsUndefined()) { - Object* maybe_transitioned_map = - FixedArray::cast(maybe_map_array)->get(elements_kind); - if (!maybe_transitioned_map->IsUndefined()) { - map = Map::cast(maybe_transitioned_map); - } - } - return AllocateJSObjectFromMapWithAllocationSite(map, allocation_site); -} - - MaybeObject* Heap::AllocateEmptyFixedArray() { int size = FixedArray::SizeFor(0); Object* result; diff --git a/src/heap.h b/src/heap.h index 2f91ebc..fd361fc 100644 --- a/src/heap.h +++ b/src/heap.h @@ -635,10 +635,6 @@ class Heap { pretenure); } - inline MUST_USE_RESULT MaybeObject* AllocateEmptyJSArrayWithAllocationSite( - ElementsKind elements_kind, - Handle allocation_site); - // Allocate a JSArray with a specified length but elements that are left // uninitialized. MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorage( @@ -648,13 +644,6 @@ class Heap { ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, PretenureFlag pretenure = NOT_TENURED); - MUST_USE_RESULT MaybeObject* AllocateJSArrayAndStorageWithAllocationSite( - ElementsKind elements_kind, - int length, - int capacity, - Handle allocation_site, - ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS); - MUST_USE_RESULT MaybeObject* AllocateJSArrayStorage( JSArray* array, int length, @@ -2114,10 +2103,6 @@ class Heap { ElementsKind elements_kind, PretenureFlag pretenure = NOT_TENURED); - MUST_USE_RESULT MaybeObject* AllocateJSArrayWithAllocationSite( - ElementsKind elements_kind, - Handle allocation_site); - // Allocate empty fixed array. MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray();