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