Index: src/mips64/builtins-mips64.cc |
diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc |
index b05222ce74d4140b42b032f6ab8b22b1a394b9e9..6305a79203125435eb88256ddab7039ed127c874 100644 |
--- a/src/mips64/builtins-mips64.cc |
+++ b/src/mips64/builtins-mips64.cc |
@@ -393,7 +393,6 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// Try to allocate the object without transitioning into C code. If any of |
// the preconditions is not met, the code bails out to the runtime call. |
if (FLAG_inline_new) { |
- Label undo_allocation; |
ExternalReference debug_step_in_fp = |
ExternalReference::debug_step_in_fp_address(isolate); |
__ li(a2, Operand(debug_step_in_fp)); |
@@ -485,8 +484,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
// Allocate object with a slack. |
__ lwu(a0, FieldMemOperand(a2, Map::kInstanceSizesOffset)); |
- __ Ext(a0, a0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, |
- kBitsPerByte); |
+ __ Ext(a0, a0, Map::kInObjectPropertiesByte * kBitsPerByte, |
+ kBitsPerByte); |
+ __ lwu(a2, FieldMemOperand(a2, Map::kInstanceAttributesOffset)); |
+ __ Ext(a2, a2, Map::kUnusedPropertyFieldsByte * kBitsPerByte, |
+ kBitsPerByte); |
+ __ dsubu(a0, a0, a2); |
__ dsll(at, a0, kPointerSizeLog2); |
__ daddu(a0, t1, at); |
// a0: offset of first field after pre-allocated fields |
@@ -528,99 +531,12 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm, |
} |
// Add the object tag to make the JSObject real, so that we can continue |
- // and jump into the continuation code at any time from now on. Any |
- // failures need to undo the allocation, so that the heap is in a |
- // consistent state and verifiable. |
+ // and jump into the continuation code at any time from now on. |
__ Daddu(t0, t0, Operand(kHeapObjectTag)); |
- // Check if a non-empty properties array is needed. Continue with |
- // allocated object if not; allocate and initialize a FixedArray if yes. |
- // a1: constructor function |
- // t0: JSObject |
- // t1: start of next object (not tagged) |
- __ lbu(a3, FieldMemOperand(a2, Map::kUnusedPropertyFieldsOffset)); |
- // The field instance sizes contains both pre-allocated property fields |
- // and in-object properties. |
- __ lw(a0, FieldMemOperand(a2, Map::kInstanceSizesOffset)); |
- __ Ext(t2, a0, Map::kPreAllocatedPropertyFieldsByte * kBitsPerByte, |
- kBitsPerByte); |
- __ Daddu(a3, a3, Operand(t2)); |
- __ Ext(t2, a0, Map::kInObjectPropertiesByte * kBitsPerByte, |
- kBitsPerByte); |
- __ dsubu(a3, a3, t2); |
- |
- // Done if no extra properties are to be allocated. |
- __ Branch(&allocated, eq, a3, Operand(zero_reg)); |
- __ Assert(greater_equal, kPropertyAllocationCountFailed, |
- a3, Operand(zero_reg)); |
- |
- // Scale the number of elements by pointer size and add the header for |
- // FixedArrays to the start of the next object calculation from above. |
- // a1: constructor |
- // a3: number of elements in properties array |
- // t0: JSObject |
- // t1: start of next object |
- __ Daddu(a0, a3, Operand(FixedArray::kHeaderSize / kPointerSize)); |
- __ Allocate( |
- a0, |
- t1, |
- t2, |
- a2, |
- &undo_allocation, |
- static_cast<AllocationFlags>(RESULT_CONTAINS_TOP | SIZE_IN_WORDS)); |
- |
- // Initialize the FixedArray. |
- // a1: constructor |
- // a3: number of elements in properties array (untagged) |
- // t0: JSObject |
- // t1: start of FixedArray (untagged) |
- __ LoadRoot(t2, Heap::kFixedArrayMapRootIndex); |
- __ mov(a2, t1); |
- __ sd(t2, MemOperand(a2, JSObject::kMapOffset)); |
- // Tag number of elements. |
- __ dsll32(a0, a3, 0); |
- __ sd(a0, MemOperand(a2, FixedArray::kLengthOffset)); |
- __ Daddu(a2, a2, Operand(2 * kPointerSize)); |
- |
- DCHECK_EQ(0 * kPointerSize, JSObject::kMapOffset); |
- DCHECK_EQ(1 * kPointerSize, FixedArray::kLengthOffset); |
- |
- // Initialize the fields to undefined. |
- // a1: constructor |
- // a2: First element of FixedArray (not tagged) |
- // a3: number of elements in properties array |
- // t0: JSObject |
- // t1: FixedArray (not tagged) |
- __ dsll(a7, a3, kPointerSizeLog2); |
- __ daddu(t2, a2, a7); // End of object. |
- DCHECK_EQ(2 * kPointerSize, FixedArray::kHeaderSize); |
- if (!is_api_function || create_memento) { |
- __ LoadRoot(t3, Heap::kUndefinedValueRootIndex); |
- } else if (FLAG_debug_code) { |
- __ LoadRoot(a6, Heap::kUndefinedValueRootIndex); |
- __ Assert(eq, kUndefinedValueNotLoaded, t3, Operand(a6)); |
- } |
- __ InitializeFieldsWithFiller(a2, t2, t3); |
- |
- // Store the initialized FixedArray into the properties field of |
- // the JSObject. |
- // a1: constructor function |
- // t0: JSObject |
- // t1: FixedArray (not tagged) |
- __ Daddu(t1, t1, Operand(kHeapObjectTag)); // Add the heap tag. |
- __ sd(t1, FieldMemOperand(t0, JSObject::kPropertiesOffset)); |
- |
// Continue with JSObject being successfully allocated. |
- // a1: constructor function |
// a4: JSObject |
__ jmp(&allocated); |
- |
- // Undo the setting of the new top so that the heap is verifiable. For |
- // example, the map's unused properties potentially do not match the |
- // allocated objects unused properties. |
- // t0: JSObject (previous new top) |
- __ bind(&undo_allocation); |
- __ UndoAllocationInNewSpace(t0, t1); |
} |
// Allocate the new receiver object using the runtime call. |