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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 | 1069 |
1070 // Drop receiver + arguments and return. | 1070 // Drop receiver + arguments and return. |
1071 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1071 __ lw(at, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1072 BytecodeArray::kParameterSizeOffset)); | 1072 BytecodeArray::kParameterSizeOffset)); |
1073 __ Addu(sp, sp, at); | 1073 __ Addu(sp, sp, at); |
1074 __ Jump(ra); | 1074 __ Jump(ra); |
1075 } | 1075 } |
1076 | 1076 |
1077 | 1077 |
1078 // static | 1078 // static |
1079 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 1079 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 1080 MacroAssembler* masm, TailCallMode tail_call_mode) { |
1080 // ----------- S t a t e ------------- | 1081 // ----------- S t a t e ------------- |
1081 // -- a0 : the number of arguments (not including the receiver) | 1082 // -- a0 : the number of arguments (not including the receiver) |
1082 // -- a2 : the address of the first argument to be pushed. Subsequent | 1083 // -- a2 : the address of the first argument to be pushed. Subsequent |
1083 // arguments should be consecutive above this, in the same order as | 1084 // arguments should be consecutive above this, in the same order as |
1084 // they are to be pushed onto the stack. | 1085 // they are to be pushed onto the stack. |
1085 // -- a1 : the target to call (can be any Object). | 1086 // -- a1 : the target to call (can be any Object). |
1086 // ----------------------------------- | 1087 // ----------------------------------- |
1087 | 1088 |
1088 // Find the address of the last argument. | 1089 // Find the address of the last argument. |
1089 __ Addu(a3, a0, Operand(1)); // Add one for receiver. | 1090 __ Addu(a3, a0, Operand(1)); // Add one for receiver. |
1090 __ sll(a3, a3, kPointerSizeLog2); | 1091 __ sll(a3, a3, kPointerSizeLog2); |
1091 __ Subu(a3, a2, Operand(a3)); | 1092 __ Subu(a3, a2, Operand(a3)); |
1092 | 1093 |
1093 // Push the arguments. | 1094 // Push the arguments. |
1094 Label loop_header, loop_check; | 1095 Label loop_header, loop_check; |
1095 __ Branch(&loop_check); | 1096 __ Branch(&loop_check); |
1096 __ bind(&loop_header); | 1097 __ bind(&loop_header); |
1097 __ lw(t0, MemOperand(a2)); | 1098 __ lw(t0, MemOperand(a2)); |
1098 __ Addu(a2, a2, Operand(-kPointerSize)); | 1099 __ Addu(a2, a2, Operand(-kPointerSize)); |
1099 __ push(t0); | 1100 __ push(t0); |
1100 __ bind(&loop_check); | 1101 __ bind(&loop_check); |
1101 __ Branch(&loop_header, gt, a2, Operand(a3)); | 1102 __ Branch(&loop_header, gt, a2, Operand(a3)); |
1102 | 1103 |
1103 // Call the target. | 1104 // Call the target. |
1104 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1105 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1106 tail_call_mode), |
| 1107 RelocInfo::CODE_TARGET); |
1105 } | 1108 } |
1106 | 1109 |
1107 | 1110 |
1108 // static | 1111 // static |
1109 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1112 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1110 // ----------- S t a t e ------------- | 1113 // ----------- S t a t e ------------- |
1111 // -- a0 : argument count (not including receiver) | 1114 // -- a0 : argument count (not including receiver) |
1112 // -- a3 : new target | 1115 // -- a3 : new target |
1113 // -- a1 : constructor to call | 1116 // -- a1 : constructor to call |
1114 // -- a2 : address of the first argument | 1117 // -- a2 : address of the first argument |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2075 Comment cmnt(masm, "[ PrepareForTailCall"); | 2078 Comment cmnt(masm, "[ PrepareForTailCall"); |
2076 | 2079 |
2077 // Prepare for tail call only if the debugger is not active. | 2080 // Prepare for tail call only if the debugger is not active. |
2078 Label done; | 2081 Label done; |
2079 ExternalReference debug_is_active = | 2082 ExternalReference debug_is_active = |
2080 ExternalReference::debug_is_active_address(masm->isolate()); | 2083 ExternalReference::debug_is_active_address(masm->isolate()); |
2081 __ li(at, Operand(debug_is_active)); | 2084 __ li(at, Operand(debug_is_active)); |
2082 __ lb(scratch1, MemOperand(at)); | 2085 __ lb(scratch1, MemOperand(at)); |
2083 __ Branch(&done, ne, scratch1, Operand(zero_reg)); | 2086 __ Branch(&done, ne, scratch1, Operand(zero_reg)); |
2084 | 2087 |
| 2088 // Drop possible interpreter handler/stub frame. |
| 2089 { |
| 2090 Label no_interpreter_frame; |
| 2091 __ lw(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
| 2092 __ Branch(&no_interpreter_frame, ne, scratch3, |
| 2093 Operand(Smi::FromInt(StackFrame::STUB))); |
| 2094 __ lw(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2095 __ bind(&no_interpreter_frame); |
| 2096 } |
| 2097 |
2085 // Check if next frame is an arguments adaptor frame. | 2098 // Check if next frame is an arguments adaptor frame. |
2086 Label no_arguments_adaptor, formal_parameter_count_loaded; | 2099 Label no_arguments_adaptor, formal_parameter_count_loaded; |
2087 __ lw(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2100 __ lw(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2088 __ lw(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 2101 __ lw(scratch3, MemOperand(scratch2, StandardFrameConstants::kContextOffset)); |
2089 __ Branch(&no_arguments_adaptor, ne, scratch3, | 2102 __ Branch(&no_arguments_adaptor, ne, scratch3, |
2090 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2103 Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2091 | 2104 |
2092 // Drop arguments adaptor frame and load arguments count. | 2105 // Drop arguments adaptor frame and load arguments count. |
2093 __ mov(fp, scratch2); | 2106 __ mov(fp, scratch2); |
2094 __ lw(scratch1, | 2107 __ lw(scratch1, |
(...skipping 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 } | 2769 } |
2757 } | 2770 } |
2758 | 2771 |
2759 | 2772 |
2760 #undef __ | 2773 #undef __ |
2761 | 2774 |
2762 } // namespace internal | 2775 } // namespace internal |
2763 } // namespace v8 | 2776 } // namespace v8 |
2764 | 2777 |
2765 #endif // V8_TARGET_ARCH_MIPS | 2778 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |