Commit 2ed2fde8 authored by palfia@homejinni.com's avatar palfia@homejinni.com

MIPS: Fix for bug 245480. Calling new Array(a) with a single argument could...

MIPS: Fix for bug 245480. Calling new Array(a) with a single argument could result in creating a holey array with a packed elements kind.

Port r15095 (4a97e1e4)

BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15104 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent f5461d3c
...@@ -3903,8 +3903,25 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { ...@@ -3903,8 +3903,25 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) {
ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites); ArrayNoArgumentConstructorStub stub(kind, disable_allocation_sites);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
} else if (instr->arity() == 1) { } else if (instr->arity() == 1) {
Label done;
if (IsFastPackedElementsKind(kind)) {
Label packed_case;
// We might need a change here,
// look at the first argument.
__ lw(t1, MemOperand(sp, 0));
__ Branch(&packed_case, eq, t1, Operand(zero_reg));
ElementsKind holey_kind = GetHoleyElementsKind(kind);
ArraySingleArgumentConstructorStub stub(holey_kind,
disable_allocation_sites);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
__ jmp(&done);
__ bind(&packed_case);
}
ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites); ArraySingleArgumentConstructorStub stub(kind, disable_allocation_sites);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
__ bind(&done);
} else { } else {
ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites); ArrayNArgumentsConstructorStub stub(kind, disable_allocation_sites);
CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr);
......
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