Index: src/ia32/lithium-codegen-ia32.cc |
diff --git a/src/ia32/lithium-codegen-ia32.cc b/src/ia32/lithium-codegen-ia32.cc |
index 67e2dca56336f10ff1818dc146e82e381750f78a..72f59d09c46ad50bec4d3135dd043fe043866d14 100644 |
--- a/src/ia32/lithium-codegen-ia32.cc |
+++ b/src/ia32/lithium-codegen-ia32.cc |
@@ -4306,6 +4306,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(scratch, constructor); |
@@ -4340,14 +4348,14 @@ void LCodeGen::DoAllocateObject(LAllocateObject* instr) { |
__ mov(FieldOperand(result, property_offset), scratch); |
} |
} |
- |
- __ 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 |
@@ -4355,8 +4363,9 @@ void LCodeGen::DoDeferredAllocateObject(LAllocateObject* instr) { |
__ Set(result, Immediate(0)); |
PushSafepointRegistersScope scope(this); |
- __ PushHeapObject(constructor); |
- CallRuntimeFromDeferred(Runtime::kNewObject, 1, instr, instr->context()); |
+ __ push(Immediate(Smi::FromInt(instance_size))); |
+ CallRuntimeFromDeferred( |
+ Runtime::kAllocateInNewSpace, 1, instr, instr->context()); |
__ StoreToSafepointRegisterSlot(result, eax); |
} |