OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 5 #if V8_TARGET_ARCH_PPC |
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 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU | 1083 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU |
1084 __ mtctr(count); | 1084 __ mtctr(count); |
1085 __ bind(&loop); | 1085 __ bind(&loop); |
1086 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); | 1086 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); |
1087 __ push(scratch); | 1087 __ push(scratch); |
1088 __ bdnz(&loop); | 1088 __ bdnz(&loop); |
1089 } | 1089 } |
1090 | 1090 |
1091 | 1091 |
1092 // static | 1092 // static |
1093 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 1093 void Builtins::Generate_InterpreterPushArgsAndCallImpl( |
| 1094 MacroAssembler* masm, TailCallMode tail_call_mode) { |
1094 // ----------- S t a t e ------------- | 1095 // ----------- S t a t e ------------- |
1095 // -- r3 : the number of arguments (not including the receiver) | 1096 // -- r3 : the number of arguments (not including the receiver) |
1096 // -- r5 : the address of the first argument to be pushed. Subsequent | 1097 // -- r5 : the address of the first argument to be pushed. Subsequent |
1097 // arguments should be consecutive above this, in the same order as | 1098 // arguments should be consecutive above this, in the same order as |
1098 // they are to be pushed onto the stack. | 1099 // they are to be pushed onto the stack. |
1099 // -- r4 : the target to call (can be any Object). | 1100 // -- r4 : the target to call (can be any Object). |
1100 // ----------------------------------- | 1101 // ----------------------------------- |
1101 | 1102 |
1102 // Calculate number of arguments (add one for receiver). | 1103 // Calculate number of arguments (add one for receiver). |
1103 __ addi(r6, r3, Operand(1)); | 1104 __ addi(r6, r3, Operand(1)); |
1104 | 1105 |
1105 // Push the arguments. | 1106 // Push the arguments. |
1106 Generate_InterpreterPushArgs(masm, r5, r6, r7); | 1107 Generate_InterpreterPushArgs(masm, r5, r6, r7); |
1107 | 1108 |
1108 // Call the target. | 1109 // Call the target. |
1109 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1110 __ Jump(masm->isolate()->builtins()->Call(ConvertReceiverMode::kAny, |
| 1111 tail_call_mode), |
| 1112 RelocInfo::CODE_TARGET); |
1110 } | 1113 } |
1111 | 1114 |
1112 | 1115 |
1113 // static | 1116 // static |
1114 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1117 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
1115 // ----------- S t a t e ------------- | 1118 // ----------- S t a t e ------------- |
1116 // -- r3 : argument count (not including receiver) | 1119 // -- r3 : argument count (not including receiver) |
1117 // -- r6 : new target | 1120 // -- r6 : new target |
1118 // -- r4 : constructor to call | 1121 // -- r4 : constructor to call |
1119 // -- r5 : address of the first argument | 1122 // -- r5 : address of the first argument |
(...skipping 978 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2098 | 2101 |
2099 // Prepare for tail call only if the debugger is not active. | 2102 // Prepare for tail call only if the debugger is not active. |
2100 Label done; | 2103 Label done; |
2101 ExternalReference debug_is_active = | 2104 ExternalReference debug_is_active = |
2102 ExternalReference::debug_is_active_address(masm->isolate()); | 2105 ExternalReference::debug_is_active_address(masm->isolate()); |
2103 __ mov(scratch1, Operand(debug_is_active)); | 2106 __ mov(scratch1, Operand(debug_is_active)); |
2104 __ lbz(scratch1, MemOperand(scratch1)); | 2107 __ lbz(scratch1, MemOperand(scratch1)); |
2105 __ cmpi(scratch1, Operand::Zero()); | 2108 __ cmpi(scratch1, Operand::Zero()); |
2106 __ bne(&done); | 2109 __ bne(&done); |
2107 | 2110 |
| 2111 // Drop possible interpreter handler/stub frame. |
| 2112 { |
| 2113 Label no_interpreter_frame; |
| 2114 __ LoadP(scratch3, MemOperand(fp, StandardFrameConstants::kMarkerOffset)); |
| 2115 __ CmpSmiLiteral(scratch3, Smi::FromInt(StackFrame::STUB), r0); |
| 2116 __ bne(&no_interpreter_frame); |
| 2117 __ LoadP(fp, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2118 __ bind(&no_interpreter_frame); |
| 2119 } |
| 2120 |
2108 // Check if next frame is an arguments adaptor frame. | 2121 // Check if next frame is an arguments adaptor frame. |
2109 Label no_arguments_adaptor, formal_parameter_count_loaded; | 2122 Label no_arguments_adaptor, formal_parameter_count_loaded; |
2110 __ LoadP(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2123 __ LoadP(scratch2, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2111 __ LoadP(scratch3, | 2124 __ LoadP(scratch3, |
2112 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); | 2125 MemOperand(scratch2, StandardFrameConstants::kContextOffset)); |
2113 __ CmpSmiLiteral(scratch3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); | 2126 __ CmpSmiLiteral(scratch3, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0); |
2114 __ bne(&no_arguments_adaptor); | 2127 __ bne(&no_arguments_adaptor); |
2115 | 2128 |
2116 // Drop arguments adaptor frame and load arguments count. | 2129 // Drop arguments adaptor frame and load arguments count. |
2117 __ mr(fp, scratch2); | 2130 __ mr(fp, scratch2); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2747 __ bkpt(0); | 2760 __ bkpt(0); |
2748 } | 2761 } |
2749 } | 2762 } |
2750 | 2763 |
2751 | 2764 |
2752 #undef __ | 2765 #undef __ |
2753 } // namespace internal | 2766 } // namespace internal |
2754 } // namespace v8 | 2767 } // namespace v8 |
2755 | 2768 |
2756 #endif // V8_TARGET_ARCH_PPC | 2769 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |