Index: src/arm/code-stubs-arm.cc |
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc |
index dff0250fc55d763189677a75460267c3f9295732..bbcc3ecc7d589cd0501a5486de607550991d2f3e 100644 |
--- a/src/arm/code-stubs-arm.cc |
+++ b/src/arm/code-stubs-arm.cc |
@@ -2386,17 +2386,20 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
// r0 : number of arguments to the construct function |
- // r2 : Feedback vector |
- // r3 : slot in feedback vector (Smi) |
// r1 : the function to call |
+ // r2 : feedback vector |
+ // r3 : slot in feedback vector (Smi) |
+ // r4 : original constructor |
FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL); |
// Number-of-arguments register must be smi-tagged to call out. |
__ SmiTag(r0); |
__ Push(r3, r2, r1, r0); |
+ __ Push(r4); |
Michael Starzinger
2015/07/21 13:22:26
Please don't make me implement the Push() variant
jbramley
2015/07/21 13:28:02
It doesn't matter quite as much for ARM anyway, si
|
__ CallStub(stub); |
+ __ Pop(r4); |
__ Pop(r3, r2, r1, r0); |
__ SmiUntag(r0); |
} |
@@ -2408,8 +2411,9 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// megamorphic. |
// r0 : number of arguments to the construct function |
// r1 : the function to call |
- // r2 : Feedback vector |
+ // r2 : feedback vector |
// r3 : slot in feedback vector (Smi) |
+ // r4 : original constructor |
Label initialize, done, miss, megamorphic, not_array_function; |
DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
@@ -2417,23 +2421,23 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
masm->isolate()->heap()->uninitialized_symbol()); |
- // Load the cache state into r4. |
- __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
- __ ldr(r4, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
+ // Load the cache state into r5. |
+ __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ ldr(r5, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
// A monomorphic cache hit or an already megamorphic state: invoke the |
// function without changing the state. |
- // We don't know if r4 is a WeakCell or a Symbol, but it's harmless to read at |
+ // We don't know if r5 is a WeakCell or a Symbol, but it's harmless to read at |
// this position in a symbol (see static asserts in type-feedback-vector.h). |
Label check_allocation_site; |
- Register feedback_map = r5; |
- Register weak_value = r6; |
- __ ldr(weak_value, FieldMemOperand(r4, WeakCell::kValueOffset)); |
+ Register feedback_map = r6; |
+ Register weak_value = r9; |
+ __ ldr(weak_value, FieldMemOperand(r5, WeakCell::kValueOffset)); |
__ cmp(r1, weak_value); |
__ b(eq, &done); |
- __ CompareRoot(r4, Heap::kmegamorphic_symbolRootIndex); |
+ __ CompareRoot(r5, Heap::kmegamorphic_symbolRootIndex); |
__ b(eq, &done); |
- __ ldr(feedback_map, FieldMemOperand(r4, HeapObject::kMapOffset)); |
+ __ ldr(feedback_map, FieldMemOperand(r5, HeapObject::kMapOffset)); |
__ CompareRoot(feedback_map, Heap::kWeakCellMapRootIndex); |
__ b(ne, FLAG_pretenuring_call_new ? &miss : &check_allocation_site); |
@@ -2451,8 +2455,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ b(ne, &miss); |
// Make sure the function is the Array() function |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
- __ cmp(r1, r4); |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); |
+ __ cmp(r1, r5); |
__ b(ne, &megamorphic); |
__ jmp(&done); |
} |
@@ -2461,14 +2465,14 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// A monomorphic miss (i.e, here the cache is not uninitialized) goes |
// megamorphic. |
- __ CompareRoot(r4, Heap::kuninitialized_symbolRootIndex); |
+ __ CompareRoot(r5, Heap::kuninitialized_symbolRootIndex); |
__ b(eq, &initialize); |
// MegamorphicSentinel is an immortal immovable object (undefined) so no |
// write-barrier is needed. |
__ bind(&megamorphic); |
- __ add(r4, r2, Operand::PointerOffsetFromSmiKey(r3)); |
+ __ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
__ LoadRoot(ip, Heap::kmegamorphic_symbolRootIndex); |
- __ str(ip, FieldMemOperand(r4, FixedArray::kHeaderSize)); |
+ __ str(ip, FieldMemOperand(r5, FixedArray::kHeaderSize)); |
__ jmp(&done); |
// An uninitialized cache is patched with the function |
@@ -2476,8 +2480,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
if (!FLAG_pretenuring_call_new) { |
// Make sure the function is the Array() function |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r4); |
- __ cmp(r1, r4); |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, r5); |
+ __ cmp(r1, r5); |
__ b(ne, ¬_array_function); |
// The target function is the Array constructor, |
@@ -2624,14 +2628,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ b(ne, &slow); |
if (RecordCallTarget()) { |
- if (IsSuperConstructorCall()) { |
- __ push(r4); |
- } |
- // TODO(mstarzinger): Consider tweaking target recording to avoid push/pop. |
GenerateRecordCallTarget(masm); |
- if (IsSuperConstructorCall()) { |
- __ pop(r4); |
- } |
__ add(r5, r2, Operand::PointerOffsetFromSmiKey(r3)); |
if (FLAG_pretenuring_call_new) { |