Commit a2212066 authored by hpayer@chromium.org's avatar hpayer@chromium.org

Move FillWithHoles FixedArray and FixedDoubleArray functions to the given classes.

BUG=
R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/216873004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20333 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6608110e
......@@ -207,19 +207,6 @@ static void MoveDoubleElements(FixedDoubleArray* dst,
}
static void FillWithHoles(Heap* heap, FixedArray* dst, int from, int to) {
ASSERT(dst->map() != heap->fixed_cow_array_map());
MemsetPointer(dst->data_start() + from, heap->the_hole_value(), to - from);
}
static void FillWithHoles(FixedDoubleArray* dst, int from, int to) {
for (int i = from; i < to; i++) {
dst->set_the_hole(i);
}
}
static FixedArrayBase* LeftTrimFixedArray(Heap* heap,
FixedArrayBase* elms,
int to_trim) {
......@@ -898,12 +885,12 @@ BUILTIN(ArraySplice) {
Handle<FixedDoubleArray> elms =
Handle<FixedDoubleArray>::cast(elms_obj);
MoveDoubleElements(*elms, 0, *elms, delta, len - delta);
FillWithHoles(*elms, len - delta, len);
elms->FillWithHoles(len - delta, len);
} else {
Handle<FixedArray> elms = Handle<FixedArray>::cast(elms_obj);
DisallowHeapAllocation no_gc;
heap->MoveElements(*elms, 0, delta, len - delta);
FillWithHoles(heap, *elms, len - delta, len);
elms->FillWithHoles(len - delta, len);
}
}
elms_changed = true;
......@@ -914,14 +901,14 @@ BUILTIN(ArraySplice) {
MoveDoubleElements(*elms, actual_start + item_count,
*elms, actual_start + actual_delete_count,
(len - actual_delete_count - actual_start));
FillWithHoles(*elms, new_length, len);
elms->FillWithHoles(new_length, len);
} else {
Handle<FixedArray> elms = Handle<FixedArray>::cast(elms_obj);
DisallowHeapAllocation no_gc;
heap->MoveElements(*elms, actual_start + item_count,
actual_start + actual_delete_count,
(len - actual_delete_count - actual_start));
FillWithHoles(heap, *elms, new_length, len);
elms->FillWithHoles(new_length, len);
}
}
} else if (item_count > actual_delete_count) {
......
......@@ -2227,6 +2227,18 @@ bool FixedDoubleArray::is_the_hole(int index) {
}
double* FixedDoubleArray::data_start() {
return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
}
void FixedDoubleArray::FillWithHoles(int from, int to) {
for (int i = from; i < to; i++) {
set_the_hole(i);
}
}
SMI_ACCESSORS(
ConstantPoolArray, first_code_ptr_index, kFirstCodePointerIndexOffset)
SMI_ACCESSORS(
......@@ -2420,8 +2432,10 @@ void FixedArray::set_the_hole(int index) {
}
double* FixedDoubleArray::data_start() {
return reinterpret_cast<double*>(FIELD_ADDR(this, kHeaderSize));
void FixedArray::FillWithHoles(int from, int to) {
for (int i = from; i < to; i++) {
set_the_hole(i);
}
}
......
......@@ -3049,6 +3049,8 @@ class FixedArray: public FixedArrayBase {
// Gives access to raw memory which stores the array's data.
inline Object** data_start();
inline void FillWithHoles(int from, int to);
// Shrink length and insert filler objects.
void Shrink(int length);
......@@ -3159,6 +3161,8 @@ class FixedDoubleArray: public FixedArrayBase {
// Gives access to raw memory which stores the array's data.
inline double* data_start();
inline void FillWithHoles(int from, int to);
// Code Generation support.
static int OffsetOfElementAt(int index) { return SizeFor(index); }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment