Index: src/mips/code-stubs-mips.cc |
diff --git a/src/mips/code-stubs-mips.cc b/src/mips/code-stubs-mips.cc |
index 91e10f5dd6b09d88457ea8b2edf101619180119a..7bdfcd92ad7aff11fd4c912df80eb68a85a31240 100644 |
--- a/src/mips/code-stubs-mips.cc |
+++ b/src/mips/code-stubs-mips.cc |
@@ -2515,16 +2515,19 @@ void RegExpExecStub::Generate(MacroAssembler* masm) { |
} |
-static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
+static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub, |
+ bool is_super) { |
// a0 : number of arguments to the construct function |
- // a2 : Feedback vector |
+ // a2 : feedback vector |
// a3 : slot in feedback vector (Smi) |
// a1 : the function to call |
+ // t0 : original constructor (for IsSuperConstructorCall) |
FrameScope scope(masm, StackFrame::INTERNAL); |
- const RegList kSavedRegs = 1 << 4 | // a0 |
- 1 << 5 | // a1 |
- 1 << 6 | // a2 |
- 1 << 7; // a3 |
+ const RegList kSavedRegs = 1 << 4 | // a0 |
+ 1 << 5 | // a1 |
+ 1 << 6 | // a2 |
+ 1 << 7 | // a3 |
+ BoolToInt(is_super) << 8; // t0 |
// Number-of-arguments register must be smi-tagged to call out. |
__ SmiTag(a0); |
@@ -2537,14 +2540,15 @@ static void CallStubInRecordCallTarget(MacroAssembler* masm, CodeStub* stub) { |
} |
-static void GenerateRecordCallTarget(MacroAssembler* masm) { |
+static void GenerateRecordCallTarget(MacroAssembler* masm, bool is_super) { |
// Cache the called function in a feedback vector slot. Cache states |
// are uninitialized, monomorphic (indicated by a JSFunction), and |
// megamorphic. |
// a0 : number of arguments to the construct function |
// a1 : the function to call |
- // a2 : Feedback vector |
+ // a2 : feedback vector |
// a3 : slot in feedback vector (Smi) |
+ // t0 : original constructor (for IsSuperConstructorCall) |
Label initialize, done, miss, megamorphic, not_array_function; |
DCHECK_EQ(*TypeFeedbackVector::MegamorphicSentinel(masm->isolate()), |
@@ -2552,23 +2556,23 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
DCHECK_EQ(*TypeFeedbackVector::UninitializedSentinel(masm->isolate()), |
masm->isolate()->heap()->uninitialized_symbol()); |
- // Load the cache state into t0. |
- __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
- __ Addu(t0, a2, Operand(t0)); |
- __ lw(t0, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
+ // Load the cache state into t2. |
+ __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); |
+ __ Addu(t2, a2, Operand(t2)); |
+ __ lw(t2, FieldMemOperand(t2, FixedArray::kHeaderSize)); |
// A monomorphic cache hit or an already megamorphic state: invoke the |
// function without changing the state. |
- // We don't know if t0 is a WeakCell or a Symbol, but it's harmless to read at |
+ // We don't know if t2 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 = t1; |
Register weak_value = t4; |
- __ lw(weak_value, FieldMemOperand(t0, WeakCell::kValueOffset)); |
+ __ lw(weak_value, FieldMemOperand(t2, WeakCell::kValueOffset)); |
__ Branch(&done, eq, a1, Operand(weak_value)); |
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
- __ Branch(&done, eq, t0, Operand(at)); |
- __ lw(feedback_map, FieldMemOperand(t0, HeapObject::kMapOffset)); |
+ __ Branch(&done, eq, t2, Operand(at)); |
+ __ lw(feedback_map, FieldMemOperand(t2, HeapObject::kMapOffset)); |
__ LoadRoot(at, Heap::kWeakCellMapRootIndex); |
__ Branch(FLAG_pretenuring_call_new ? &miss : &check_allocation_site, ne, |
feedback_map, Operand(at)); |
@@ -2587,8 +2591,8 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
__ Branch(&miss, ne, feedback_map, Operand(at)); |
// Make sure the function is the Array() function |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); |
- __ Branch(&megamorphic, ne, a1, Operand(t0)); |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); |
+ __ Branch(&megamorphic, ne, a1, Operand(t2)); |
__ jmp(&done); |
} |
@@ -2597,35 +2601,35 @@ static void GenerateRecordCallTarget(MacroAssembler* masm) { |
// A monomorphic miss (i.e, here the cache is not uninitialized) goes |
// megamorphic. |
__ LoadRoot(at, Heap::kuninitialized_symbolRootIndex); |
- __ Branch(&initialize, eq, t0, Operand(at)); |
+ __ Branch(&initialize, eq, t2, Operand(at)); |
// MegamorphicSentinel is an immortal immovable object (undefined) so no |
// write-barrier is needed. |
__ bind(&megamorphic); |
- __ sll(t0, a3, kPointerSizeLog2 - kSmiTagSize); |
- __ Addu(t0, a2, Operand(t0)); |
+ __ sll(t2, a3, kPointerSizeLog2 - kSmiTagSize); |
+ __ Addu(t2, a2, Operand(t2)); |
__ LoadRoot(at, Heap::kmegamorphic_symbolRootIndex); |
- __ sw(at, FieldMemOperand(t0, FixedArray::kHeaderSize)); |
+ __ sw(at, FieldMemOperand(t2, FixedArray::kHeaderSize)); |
__ jmp(&done); |
// An uninitialized cache is patched with the function. |
__ bind(&initialize); |
if (!FLAG_pretenuring_call_new) { |
// Make sure the function is the Array() function. |
- __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t0); |
- __ Branch(¬_array_function, ne, a1, Operand(t0)); |
+ __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, t2); |
+ __ Branch(¬_array_function, ne, a1, Operand(t2)); |
// The target function is the Array constructor, |
// Create an AllocationSite if we don't already have it, store it in the |
// slot. |
CreateAllocationSiteStub create_stub(masm->isolate()); |
- CallStubInRecordCallTarget(masm, &create_stub); |
+ CallStubInRecordCallTarget(masm, &create_stub, is_super); |
__ Branch(&done); |
__ bind(¬_array_function); |
} |
CreateWeakCellStub create_stub(masm->isolate()); |
- CallStubInRecordCallTarget(masm, &create_stub); |
+ CallStubInRecordCallTarget(masm, &create_stub, is_super); |
__ bind(&done); |
} |
@@ -2758,13 +2762,7 @@ void CallConstructStub::Generate(MacroAssembler* masm) { |
__ Branch(&slow, ne, t1, Operand(JS_FUNCTION_TYPE)); |
if (RecordCallTarget()) { |
- if (IsSuperConstructorCall()) { |
- __ push(t0); |
- } |
- GenerateRecordCallTarget(masm); |
- if (IsSuperConstructorCall()) { |
- __ pop(t0); |
- } |
+ GenerateRecordCallTarget(masm, IsSuperConstructorCall()); |
__ sll(at, a3, kPointerSizeLog2 - kSmiTagSize); |
__ Addu(t1, a2, at); |