Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index 748b5313850a7606ad6e4d97127dd46c58af8d1e..cad641738c7a682310eb4b2a752ea35cf98dcdf5 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -2946,19 +2946,21 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ cmp(r4, r1); |
__ b(eq, &done); |
- // If we came here, we need to see if we are the array function. |
- // If we didn't have a matching function, and we didn't find the megamorph |
- // sentinel, then we have in the slot either some other function or an |
- // AllocationSite. Do a map check on the object in ecx. |
- __ ldr(r5, FieldMemOperand(r4, 0)); |
- __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
- __ b(ne, &miss); |
+ if (!FLAG_pretenuring_call_new) { |
+ // If we came here, we need to see if we are the array function. |
+ // If we didn't have a matching function, and we didn't find the megamorph |
+ // sentinel, then we have in the slot either some other function or an |
+ // AllocationSite. Do a map check on the object in ecx. |
+ __ ldr(r5, FieldMemOperand(r4, 0)); |
+ __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
+ __ b(ne, &miss); |
- // Make sure the function is the Array() function |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
- __ cmp(r1, r4); |
- __ b(ne, &megamorphic); |
- __ jmp(&done); |
+ // Make sure the function is the Array() function |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
+ __ cmp(r1, r4); |
+ __ b(ne, &megamorphic); |
+ __ jmp(&done); |
+ } |
__ bind(&miss); |
@@ -2974,32 +2976,35 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
__ jmp(&done); |
- // An uninitialized cache is patched with the function or sentinel to |
- // indicate the ElementsKind if function is the Array constructor. |
+ // An uninitialized cache is patched with the function |
__ bind(&initialize); |
- // Make sure the function is the Array() function |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
- __ cmp(r1, r4); |
- __ b(ne, ¬_array_function); |
- // The target function is the Array constructor, |
- // Create an AllocationSite if we don't already have it, store it in the slot. |
- { |
- FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
+ if (!FLAG_pretenuring_call_new) { |
+ // Make sure the function is the Array() function |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
+ __ cmp(r1, r4); |
+ __ b(ne, ¬_array_function); |
- // Arguments register must be smi-tagged to call out. |
- __ SmiTag(r0); |
- __ Push(r3, r2, r1, r0); |
+ // The target function is the Array constructor, |
+ // Create an AllocationSite if we don't already have it, store it in the |
+ // slot. |
+ { |
+ FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
- CreateAllocationSiteStub create_stub; |
- __ CallStub(&create_stub); |
+ // Arguments register must be smi-tagged to call out. |
+ __ SmiTag(r0); |
+ __ Push(r3, r2, r1, r0); |
- __ Pop(r3, r2, r1, r0); |
- __ SmiUntag(r0); |
- } |
- __ b(&done); |
+ CreateAllocationSiteStub create_stub; |
+ __ CallStub(&create_stub); |
- __ bind(¬_array_function); |
+ __ Pop(r3, r2, r1, r0); |
+ __ SmiUntag(r0); |
+ } |
+ __ b(&done); |
+ |
+ __ bind(¬_array_function); |
+ } |
__ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
__ add(r4, r4, Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
@@ -3138,17 +3143,25 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ b(ne, &slow); |
if (RecordCallTarget()) { |
- Label feedback_register_initialized; |
GenerateRecordCallTarget(masm); |
- // Put the AllocationSite from the feedback vector into r2, or undefined. |
__ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
- __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
- __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); |
- __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
- __ b(eq, &feedback_register_initialized); |
- __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
- __ bind(&feedback_register_initialized); |
+ if (FLAG_pretenuring_call_new) { |
+ // Put the AllocationSite from the feedback vector into r2. |
+ // By adding kPointerSize we encode that we know the AllocationSite |
+ // entry is at the feedback vector slot given by r3 + 1. |
+ __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize + kPointerSize)); |
+ } else { |
+ Label feedback_register_initialized; |
+ // Put the AllocationSite from the feedback vector into r2, or undefined. |
+ __ ldr(r2, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
+ __ ldr(r5, FieldMemOperand(r2, AllocationSite::kMapOffset)); |
+ __ CompareRoot(r5, Heap::kAllocationSiteMapRootIndex); |
+ __ b(eq, &feedback_register_initialized); |
+ __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
+ __ bind(&feedback_register_initialized); |
+ } |
+ |
__ AssertUndefinedOrAllocationSite(r2, r5); |
} |