diff options
Diffstat (limited to 'deps/v8/src/mips/ic-mips.cc')
-rw-r--r-- | deps/v8/src/mips/ic-mips.cc | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/deps/v8/src/mips/ic-mips.cc b/deps/v8/src/mips/ic-mips.cc index 605616626a..8c9092124c 100644 --- a/deps/v8/src/mips/ic-mips.cc +++ b/deps/v8/src/mips/ic-mips.cc @@ -74,6 +74,47 @@ void CallIC::GenerateNormal(MacroAssembler* masm, int argc) { void CallIC::GenerateMiss(MacroAssembler* masm, int argc) { UNIMPLEMENTED_MIPS(); + // Registers: + // a2: name + // ra: return address + + // Get the receiver of the function from the stack. + __ lw(a3, MemOperand(sp, argc*kPointerSize)); + + __ EnterInternalFrame(); + + // Push the receiver and the name of the function. + __ MultiPush(a2.bit() | a3.bit()); + + // Call the entry. + __ li(a0, Operand(2)); + __ li(a1, Operand(ExternalReference(IC_Utility(kCallIC_Miss)))); + + CEntryStub stub(1); + __ CallStub(&stub); + + // Move result to r1 and leave the internal frame. + __ mov(a1, v0); + __ LeaveInternalFrame(); + + // Check if the receiver is a global object of some sort. + Label invoke, global; + __ lw(a2, MemOperand(sp, argc * kPointerSize)); + __ andi(t0, a2, kSmiTagMask); + __ Branch(eq, &invoke, t0, Operand(zero_reg)); + __ GetObjectType(a2, a3, a3); + __ Branch(eq, &global, a3, Operand(JS_GLOBAL_OBJECT_TYPE)); + __ Branch(ne, &invoke, a3, Operand(JS_BUILTINS_OBJECT_TYPE)); + + // Patch the receiver on the stack. + __ bind(&global); + __ lw(a2, FieldMemOperand(a2, GlobalObject::kGlobalReceiverOffset)); + __ sw(a2, MemOperand(sp, argc * kPointerSize)); + + // Invoke the function. + ParameterCount actual(argc); + __ bind(&invoke); + __ InvokeFunction(a1, actual, JUMP_FUNCTION); } // Defined in ic.cc. |