Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 665c85e827a015d76d0216f1be3a5c85f2419702..c483faee74ae9f8f58d96597905d85b0fb16090d 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -2786,6 +2786,7 @@ void LCodeGen::EmitReturn(LReturn* instr, bool dynamic_frame_alignment) { |
__ Ret((parameter_count + extra_value_count) * kPointerSize, ecx); |
} else { |
Register reg = ToRegister(instr->parameter_count()); |
+ __ SmiUntag(reg); // it is a smi |
Register return_addr_reg = reg.is(ecx) ? ebx : ecx; |
if (dynamic_frame_alignment && FLAG_debug_code) { |
ASSERT(extra_value_count == 2); |
@@ -4200,11 +4201,20 @@ void LCodeGen::DoCallNewArray(LCallNewArray* instr) { |
ASSERT(ToRegister(instr->result()).is(eax)); |
ASSERT(FLAG_optimize_constructed_arrays); |
- __ mov(ebx, instr->hydrogen()->property_cell()); |
- Handle<Code> array_construct_code = |
- isolate()->builtins()->ArrayConstructCode(); |
__ Set(eax, Immediate(instr->arity())); |
- CallCode(array_construct_code, RelocInfo::CONSTRUCT_CALL, instr); |
+ __ mov(ebx, instr->hydrogen()->property_cell()); |
+ Object* cell_value = instr->hydrogen()->property_cell()->value(); |
+ ElementsKind kind = static_cast<ElementsKind>(Smi::cast(cell_value)->value()); |
+ if (instr->arity() == 0) { |
+ ArrayNoArgumentConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } else if (instr->arity() == 1) { |
+ ArraySingleArgumentConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } else { |
+ ArrayNArgumentsConstructorStub stub(kind); |
+ CallCode(stub.GetCode(isolate()), RelocInfo::CONSTRUCT_CALL, instr); |
+ } |
} |