An attempt to fix the tests.
TBR=sgjesse@chromium.org Review URL: http://codereview.chromium.org/669162 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4042 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
bdee05b3ce
commit
1bc04768a9
@ -665,8 +665,6 @@ BUILTIN(ArraySplice) {
|
||||
// we should never hit this case.
|
||||
ASSERT((item_count - actual_delete_count) <= (Smi::kMaxValue - len));
|
||||
|
||||
FixedArray* source_elms = elms;
|
||||
|
||||
// Check if array need to grow.
|
||||
if (new_length > elms->length()) {
|
||||
// New backing storage is needed.
|
||||
@ -678,18 +676,21 @@ BUILTIN(ArraySplice) {
|
||||
AssertNoAllocation no_gc;
|
||||
// Copy the part before actual_start as is.
|
||||
CopyElements(&no_gc, new_elms, 0, elms, 0, actual_start);
|
||||
CopyElements(&no_gc,
|
||||
new_elms, actual_start + item_count,
|
||||
elms, actual_start + actual_delete_count,
|
||||
(len - actual_delete_count - actual_start));
|
||||
FillWithHoles(new_elms, new_length, capacity);
|
||||
|
||||
source_elms = elms;
|
||||
elms = new_elms;
|
||||
array->set_elements(elms);
|
||||
} else {
|
||||
AssertNoAllocation no_gc;
|
||||
MoveElements(&no_gc,
|
||||
elms, actual_start + item_count,
|
||||
elms, actual_start + actual_delete_count,
|
||||
(len - actual_delete_count - actual_start));
|
||||
}
|
||||
|
||||
AssertNoAllocation no_gc;
|
||||
MoveElements(&no_gc,
|
||||
elms, actual_start + item_count,
|
||||
source_elms, actual_start + actual_delete_count,
|
||||
(len - actual_delete_count - actual_start));
|
||||
}
|
||||
|
||||
AssertNoAllocation no_gc;
|
||||
|
@ -31,13 +31,13 @@
|
||||
var array = new Array(10);
|
||||
var spliced = array.splice(1, 1, 'one', 'two');
|
||||
assertEquals(1, spliced.length);
|
||||
assertFalse(0 in spliced, "0 in spliced");
|
||||
assertFalse(0 in spliced, "0 in spliced: " + spliced);
|
||||
|
||||
assertEquals(11, array.length);
|
||||
assertFalse(0 in array, "0 in array");
|
||||
assertFalse(0 in array, "0 in array: " + array);
|
||||
assertTrue(1 in array);
|
||||
assertTrue(2 in array);
|
||||
assertFalse(3 in array, "3 in array");
|
||||
assertFalse(3 in array, "3 in array: " + array);
|
||||
}
|
||||
})();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user