Index: src/x64/stub-cache-x64.cc |
diff --git a/src/x64/stub-cache-x64.cc b/src/x64/stub-cache-x64.cc |
index cd71086eecf7a5a41733064d244df1e5815bdb46..b120efb376b6c5def906887d3dbf8f29ae53ecb0 100644 |
--- a/src/x64/stub-cache-x64.cc |
+++ b/src/x64/stub-cache-x64.cc |
@@ -3240,6 +3240,7 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub( |
#endif |
// Load the initial map and verify that it is in fact a map. |
+ // rdi: constructor |
__ movq(rbx, FieldOperand(rdi, JSFunction::kPrototypeOrInitialMapOffset)); |
// Will both indicate a NULL and a Smi. |
STATIC_ASSERT(kSmiTag == 0); |
@@ -3249,18 +3250,22 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub( |
#ifdef DEBUG |
// Cannot construct functions this way. |
- // rdi: constructor |
// rbx: initial map |
__ CmpInstanceType(rbx, JS_FUNCTION_TYPE); |
- __ Assert(not_equal, "Function constructed by construct stub."); |
+ __ Check(not_equal, "Function constructed by construct stub."); |
#endif |
// Now allocate the JSObject in new space. |
- // rdi: constructor |
// rbx: initial map |
+ ASSERT(function->has_initial_map()); |
+ int instance_size = function->initial_map()->instance_size(); |
+#ifdef DEBUG |
__ movzxbq(rcx, FieldOperand(rbx, Map::kInstanceSizeOffset)); |
__ shl(rcx, Immediate(kPointerSizeLog2)); |
- __ AllocateInNewSpace(rcx, rdx, rcx, no_reg, |
+ __ cmpq(rcx, Immediate(instance_size)); |
+ __ Check(equal, "Instance size of initial map changed."); |
+#endif |
+ __ AllocateInNewSpace(instance_size, rdx, rcx, no_reg, |
&generic_stub_call, NO_ALLOCATION_FLAGS); |
// Allocated the JSObject, now initialize the fields and add the heap tag. |
@@ -3306,7 +3311,6 @@ Handle<Code> ConstructStubCompiler::CompileConstructStub( |
} |
// Fill the unused in-object property fields with undefined. |
- ASSERT(function->has_initial_map()); |
for (int i = shared->this_property_assignments_count(); |
i < function->initial_map()->inobject_properties(); |
i++) { |