MIPS: Undo allocation of half-formed array during elements transition

Port r10320 (bb429e82)

BUG=
TEST=

Review URL: http://codereview.chromium.org/9082001
Patch from Gergely Kis <gergely@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10327 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
danno@chromium.org 2012-01-04 09:40:47 +00:00
parent b6e11b5bcc
commit 0f8be1f92f

View File

@ -324,7 +324,8 @@ static void AllocateJSArray(MacroAssembler* masm,
static void ArrayNativeCode(MacroAssembler* masm, static void ArrayNativeCode(MacroAssembler* masm,
Label* call_generic_code) { Label* call_generic_code) {
Counters* counters = masm->isolate()->counters(); Counters* counters = masm->isolate()->counters();
Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array; Label argc_one_or_more, argc_two_or_more, not_empty_array, empty_array,
has_non_smi_element;
// Check for array construction with zero arguments or one. // Check for array construction with zero arguments or one.
__ Branch(&argc_one_or_more, ne, a0, Operand(zero_reg)); __ Branch(&argc_one_or_more, ne, a0, Operand(zero_reg));
@ -422,7 +423,7 @@ static void ArrayNativeCode(MacroAssembler* masm,
__ lw(a2, MemOperand(t3)); __ lw(a2, MemOperand(t3));
__ Addu(t3, t3, kPointerSize); __ Addu(t3, t3, kPointerSize);
if (FLAG_smi_only_arrays) { if (FLAG_smi_only_arrays) {
__ JumpIfNotSmi(a2, call_generic_code); __ JumpIfNotSmi(a2, &has_non_smi_element);
} }
__ Addu(t1, t1, -kPointerSize); __ Addu(t1, t1, -kPointerSize);
__ sw(a2, MemOperand(t1)); __ sw(a2, MemOperand(t1));
@ -438,6 +439,10 @@ static void ArrayNativeCode(MacroAssembler* masm,
__ Addu(sp, sp, Operand(kPointerSize)); __ Addu(sp, sp, Operand(kPointerSize));
__ mov(v0, a3); __ mov(v0, a3);
__ Ret(); __ Ret();
__ bind(&has_non_smi_element);
__ UndoAllocationInNewSpace(a3, t0);
__ b(call_generic_code);
} }