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