| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 #if V8_TARGET_ARCH_MIPS |     5 #if V8_TARGET_ARCH_MIPS | 
|     6  |     6  | 
|     7 #include "src/codegen.h" |     7 #include "src/codegen.h" | 
|     8 #include "src/debug/debug.h" |     8 #include "src/debug/debug.h" | 
|     9 #include "src/deoptimizer.h" |     9 #include "src/deoptimizer.h" | 
|    10 #include "src/full-codegen/full-codegen.h" |    10 #include "src/full-codegen/full-codegen.h" | 
| (...skipping 930 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   941   // Leave the frame (also dropping the register file). |   941   // Leave the frame (also dropping the register file). | 
|   942   __ LeaveFrame(StackFrame::JAVA_SCRIPT); |   942   __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 
|   943  |   943  | 
|   944   // Drop receiver + arguments and return. |   944   // Drop receiver + arguments and return. | 
|   945   __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, |   945   __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 
|   946                             BytecodeArray::kParameterSizeOffset)); |   946                             BytecodeArray::kParameterSizeOffset)); | 
|   947   __ Addu(sp, sp, at); |   947   __ Addu(sp, sp, at); | 
|   948   __ Jump(ra); |   948   __ Jump(ra); | 
|   949 } |   949 } | 
|   950  |   950  | 
|   951 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |  | 
|   952                                          Register limit, Register scratch) { |  | 
|   953   Label loop_header, loop_check; |  | 
|   954   __ Branch(&loop_check); |  | 
|   955   __ bind(&loop_header); |  | 
|   956   __ lw(scratch, MemOperand(index)); |  | 
|   957   __ Addu(index, index, Operand(-kPointerSize)); |  | 
|   958   __ push(scratch); |  | 
|   959   __ bind(&loop_check); |  | 
|   960   __ Branch(&loop_header, gt, index, Operand(limit)); |  | 
|   961 } |  | 
|   962  |  | 
|   963 static void Generate_InterpreterComputeLastArgumentAddress( |  | 
|   964     MacroAssembler* masm, Register num_args, Register start_address, |  | 
|   965     Register output_reg) { |  | 
|   966   __ Addu(output_reg, num_args, Operand(1));  // Add one for receiver. |  | 
|   967   __ sll(output_reg, output_reg, kPointerSizeLog2); |  | 
|   968   __ Subu(output_reg, start_address, output_reg); |  | 
|   969 } |  | 
|   970  |  | 
|   971 // static |  | 
|   972 void Builtins::Generate_InterpreterPushArgsAndCallICImpl( |  | 
|   973     MacroAssembler* masm, TailCallMode tail_call_mode) { |  | 
|   974   // ----------- S t a t e ------------- |  | 
|   975   //  -- a0 : the number of arguments (not including the receiver) |  | 
|   976   //  -- t0 : the address of the first argument to be pushed. Subsequent |  | 
|   977   //          arguments should be consecutive above this, in the same order as |  | 
|   978   //          they are to be pushed onto the stack. |  | 
|   979   //  -- a1 : the target to call (can be any Object). |  | 
|   980   //  -- a3 : feedback vector slot id |  | 
|   981   //  -- a2 : type feedback vector |  | 
|   982   // ----------------------------------- |  | 
|   983  |  | 
|   984   { |  | 
|   985     FrameScope scope(masm, StackFrame::INTERNAL); |  | 
|   986  |  | 
|   987     // Computes the address of last argument in t1. |  | 
|   988     Generate_InterpreterComputeLastArgumentAddress(masm, a0, t0, t1); |  | 
|   989  |  | 
|   990     // Push the arguments. |  | 
|   991     Generate_InterpreterPushArgs(masm, t0, t1, at); |  | 
|   992  |  | 
|   993     // Call via the CallIC stub. |  | 
|   994     CallICState call_ic_state(0, ConvertReceiverMode::kAny, tail_call_mode, |  | 
|   995                               true); |  | 
|   996     CallICStub stub(masm->isolate(), call_ic_state); |  | 
|   997     // TODO(mythria): This should be replaced by a TailCallStub, when we |  | 
|   998     // update the code to find the target IC from jump instructions. |  | 
|   999     __ CallStub(&stub); |  | 
|  1000   } |  | 
|  1001   __ Ret(); |  | 
|  1002 } |  | 
|  1003  |   951  | 
|  1004 // static |   952 // static | 
|  1005 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |   953 void Builtins::Generate_InterpreterPushArgsAndCallImpl( | 
|  1006     MacroAssembler* masm, TailCallMode tail_call_mode) { |   954     MacroAssembler* masm, TailCallMode tail_call_mode) { | 
|  1007   // ----------- S t a t e ------------- |   955   // ----------- S t a t e ------------- | 
|  1008   //  -- a0 : the number of arguments (not including the receiver) |   956   //  -- a0 : the number of arguments (not including the receiver) | 
|  1009   //  -- a2 : the address of the first argument to be pushed. Subsequent |   957   //  -- a2 : the address of the first argument to be pushed. Subsequent | 
|  1010   //          arguments should be consecutive above this, in the same order as |   958   //          arguments should be consecutive above this, in the same order as | 
|  1011   //          they are to be pushed onto the stack. |   959   //          they are to be pushed onto the stack. | 
|  1012   //  -- a1 : the target to call (can be any Object). |   960   //  -- a1 : the target to call (can be any Object). | 
|  1013   // ----------------------------------- |   961   // ----------------------------------- | 
|  1014  |   962  | 
|  1015   // Computes the address of last argument in a3. |   963   // Find the address of the last argument. | 
|  1016   Generate_InterpreterComputeLastArgumentAddress(masm, a0, a2, a3); |   964   __ Addu(a3, a0, Operand(1));  // Add one for receiver. | 
 |   965   __ sll(a3, a3, kPointerSizeLog2); | 
 |   966   __ Subu(a3, a2, Operand(a3)); | 
|  1017  |   967  | 
|  1018   // Push the arguments. |   968   // Push the arguments. | 
|  1019   Generate_InterpreterPushArgs(masm, a2, a3, at); |   969   Label loop_header, loop_check; | 
 |   970   __ Branch(&loop_check); | 
 |   971   __ bind(&loop_header); | 
 |   972   __ lw(t0, MemOperand(a2)); | 
 |   973   __ Addu(a2, a2, Operand(-kPointerSize)); | 
 |   974   __ push(t0); | 
 |   975   __ bind(&loop_check); | 
 |   976   __ Branch(&loop_header, gt, a2, Operand(a3)); | 
|  1020  |   977  | 
|  1021   // Call the target. |   978   // Call the target. | 
|  1022   __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |   979   __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, | 
|  1023                                             tail_call_mode), |   980                                             tail_call_mode), | 
|  1024           RelocInfo::CODE_TARGET); |   981           RelocInfo::CODE_TARGET); | 
|  1025 } |   982 } | 
|  1026  |   983  | 
 |   984  | 
|  1027 // static |   985 // static | 
|  1028 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |   986 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 
|  1029   // ----------- S t a t e ------------- |   987   // ----------- S t a t e ------------- | 
|  1030   // -- a0 : argument count (not including receiver) |   988   // -- a0 : argument count (not including receiver) | 
|  1031   // -- a3 : new target |   989   // -- a3 : new target | 
|  1032   // -- a1 : constructor to call |   990   // -- a1 : constructor to call | 
|  1033   // -- a2 : address of the first argument |   991   // -- a2 : address of the first argument | 
|  1034   // ----------------------------------- |   992   // ----------------------------------- | 
|  1035  |   993  | 
|  1036   // Find the address of the last argument. |   994   // Find the address of the last argument. | 
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1991   Comment cmnt(masm, "[ PrepareForTailCall"); |  1949   Comment cmnt(masm, "[ PrepareForTailCall"); | 
|  1992  |  1950  | 
|  1993   // Prepare for tail call only if the debugger is not active. |  1951   // Prepare for tail call only if the debugger is not active. | 
|  1994   Label done; |  1952   Label done; | 
|  1995   ExternalReference debug_is_active = |  1953   ExternalReference debug_is_active = | 
|  1996       ExternalReference::debug_is_active_address(masm->isolate()); |  1954       ExternalReference::debug_is_active_address(masm->isolate()); | 
|  1997   __ li(at, Operand(debug_is_active)); |  1955   __ li(at, Operand(debug_is_active)); | 
|  1998   __ lb(scratch1, MemOperand(at)); |  1956   __ lb(scratch1, MemOperand(at)); | 
|  1999   __ Branch(&done, ne, scratch1, Operand(zero_reg)); |  1957   __ Branch(&done, ne, scratch1, Operand(zero_reg)); | 
|  2000  |  1958  | 
|  2001   // Drop possible internal frame pushed for calling CallICStub. |  | 
|  2002   // TODO(mythria): when we tail call the CallICStub, remove this. |  | 
|  2003   { |  | 
|  2004     Label no_internal_callic_frame; |  | 
|  2005     __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |  | 
|  2006     __ Branch(&no_internal_callic_frame, ne, scratch3, |  | 
|  2007               Operand(Smi::FromInt(StackFrame::INTERNAL))); |  | 
|  2008     __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |  | 
|  2009     __ bind(&no_internal_callic_frame); |  | 
|  2010   } |  | 
|  2011  |  | 
|  2012   // Drop possible interpreter handler/stub frame. |  1959   // Drop possible interpreter handler/stub frame. | 
|  2013   { |  1960   { | 
|  2014     Label no_interpreter_frame; |  1961     Label no_interpreter_frame; | 
|  2015     __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |  1962     __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); | 
|  2016     __ Branch(&no_interpreter_frame, ne, scratch3, |  1963     __ Branch(&no_interpreter_frame, ne, scratch3, | 
|  2017               Operand(Smi::FromInt(StackFrame::STUB))); |  1964               Operand(Smi::FromInt(StackFrame::STUB))); | 
|  2018     __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |  1965     __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 
|  2019     __ bind(&no_interpreter_frame); |  1966     __ bind(&no_interpreter_frame); | 
|  2020   } |  1967   } | 
|  2021  |  1968  | 
| (...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2693   } |  2640   } | 
|  2694 } |  2641 } | 
|  2695  |  2642  | 
|  2696  |  2643  | 
|  2697 #undef __ |  2644 #undef __ | 
|  2698  |  2645  | 
|  2699 }  // namespace internal |  2646 }  // namespace internal | 
|  2700 }  // namespace v8 |  2647 }  // namespace v8 | 
|  2701  |  2648  | 
|  2702 #endif  // V8_TARGET_ARCH_MIPS |  2649 #endif  // V8_TARGET_ARCH_MIPS | 
| OLD | NEW |