Index: src/mips/lithium-codegen-mips.cc |
diff --git a/src/mips/lithium-codegen-mips.cc b/src/mips/lithium-codegen-mips.cc |
index 2af9d6f3a1c67cb14dd8f9ec875ba469d3350cda..e4de40f0a8c128d76c0aa0cbf81108f354cda763 100644 |
--- a/src/mips/lithium-codegen-mips.cc |
+++ b/src/mips/lithium-codegen-mips.cc |
@@ -4367,6 +4367,14 @@ void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
deferred->entry(), |
TAG_OBJECT); |
+ __ bind(deferred->exit()); |
+ if (FLAG_debug_code) { |
+ Label is_in_new_space; |
+ __ JumpIfInNewSpace(result, scratch, &is_in_new_space); |
+ __ Abort("Allocated object is not in new-space"); |
+ __ bind(&is_in_new_space); |
+ } |
+ |
// Load the initial map. |
Register map = scratch; |
__ LoadHeapObject(map, constructor); |
@@ -4385,14 +4393,14 @@ void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
__ sw(scratch, FieldMemOperand(result, property_offset)); |
} |
} |
- |
- __ bind(deferred->exit()); |
} |
void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
Register result = ToRegister(instr->result()); |
Handle<JSFunction> constructor = instr->hydrogen()->constructor(); |
+ Handle<Map> initial_map(constructor->initial_map()); |
+ int instance_size = initial_map->instance_size(); |
// TODO(3095996): Get rid of this. For now, we need to make the |
// result register contain a valid pointer because it is already |
@@ -4400,9 +4408,9 @@ void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
__ mov(result, zero_reg); |
PushSafepointRegistersScope scope(this, Safepoint::kWithRegisters); |
- __ LoadHeapObject(a0, constructor); |
+ __ li(a0, Operand(Smi::FromInt(instance_size))); |
__ push(a0); |
- CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr); |
+ CallRuntimeFromDeferred(Runtime::kAllocateInNewSpace, 1, instr); |
__ StoreToSafepointRegisterSlot(v0, result); |
} |