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
This commit is contained in:
parent
8c0c573d96
commit
ad69e19d67
@ -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<void*>(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,
|
||||
|
@ -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) \
|
||||
|
@ -532,14 +532,6 @@ void Heap::ScavengeObject(HeapObject** p, HeapObject* object) {
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* Heap::AllocateEmptyJSArrayWithAllocationSite(
|
||||
ElementsKind elements_kind,
|
||||
Handle<AllocationSite> 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);
|
||||
|
32
src/heap.cc
32
src/heap.cc
@ -4755,20 +4755,6 @@ MaybeObject* Heap::AllocateJSArrayAndStorage(
|
||||
}
|
||||
|
||||
|
||||
MaybeObject* Heap::AllocateJSArrayAndStorageWithAllocationSite(
|
||||
ElementsKind elements_kind,
|
||||
int length,
|
||||
int capacity,
|
||||
Handle<AllocationSite> 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<AllocationSite> 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;
|
||||
|
15
src/heap.h
15
src/heap.h
@ -635,10 +635,6 @@ class Heap {
|
||||
pretenure);
|
||||
}
|
||||
|
||||
inline MUST_USE_RESULT MaybeObject* AllocateEmptyJSArrayWithAllocationSite(
|
||||
ElementsKind elements_kind,
|
||||
Handle<AllocationSite> 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<AllocationSite> 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<AllocationSite> allocation_site);
|
||||
|
||||
// Allocate empty fixed array.
|
||||
MUST_USE_RESULT MaybeObject* AllocateEmptyFixedArray();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user