| 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 957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 968 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 968 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 969 | 969 |
| 970 // Drop receiver + arguments and return. | 970 // Drop receiver + arguments and return. |
| 971 __ lwz(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 971 __ lwz(r0, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
| 972 BytecodeArray::kParameterSizeOffset)); | 972 BytecodeArray::kParameterSizeOffset)); |
| 973 __ add(sp, sp, r0); | 973 __ add(sp, sp, r0); |
| 974 __ blr(); | 974 __ blr(); |
| 975 } | 975 } |
| 976 | 976 |
| 977 | 977 |
| 978 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
| 979 Register count, Register scratch) { |
| 980 Label loop; |
| 981 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU |
| 982 __ mtctr(count); |
| 983 __ bind(&loop); |
| 984 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); |
| 985 __ push(scratch); |
| 986 __ bdnz(&loop); |
| 987 } |
| 988 |
| 989 |
| 978 // static | 990 // static |
| 979 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { | 991 void Builtins::Generate_InterpreterPushArgsAndCall(MacroAssembler* masm) { |
| 980 // ----------- S t a t e ------------- | 992 // ----------- S t a t e ------------- |
| 981 // -- r3 : the number of arguments (not including the receiver) | 993 // -- r3 : the number of arguments (not including the receiver) |
| 982 // -- r5 : the address of the first argument to be pushed. Subsequent | 994 // -- r5 : the address of the first argument to be pushed. Subsequent |
| 983 // arguments should be consecutive above this, in the same order as | 995 // arguments should be consecutive above this, in the same order as |
| 984 // they are to be pushed onto the stack. | 996 // they are to be pushed onto the stack. |
| 985 // -- r4 : the target to call (can be any Object). | 997 // -- r4 : the target to call (can be any Object). |
| 986 // ----------------------------------- | 998 // ----------------------------------- |
| 987 | 999 |
| 988 // Calculate number of arguments (add one for receiver). | 1000 // Calculate number of arguments (add one for receiver). |
| 989 __ addi(r6, r3, Operand(1)); | 1001 __ addi(r6, r3, Operand(1)); |
| 990 | 1002 |
| 991 // Push the arguments. | 1003 // Push the arguments. |
| 992 Label loop; | 1004 Generate_InterpreterPushArgs(masm, r5, r6, r7); |
| 993 __ addi(r5, r5, Operand(kPointerSize)); // Bias up for LoadPU | |
| 994 __ mtctr(r6); | |
| 995 __ bind(&loop); | |
| 996 __ LoadPU(r6, MemOperand(r5, -kPointerSize)); | |
| 997 __ push(r6); | |
| 998 __ bdnz(&loop); | |
| 999 | 1005 |
| 1000 // Call the target. | 1006 // Call the target. |
| 1001 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 1007 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1002 } | 1008 } |
| 1003 | 1009 |
| 1004 | 1010 |
| 1005 // static | 1011 // static |
| 1006 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { | 1012 void Builtins::Generate_InterpreterPushArgsAndConstruct(MacroAssembler* masm) { |
| 1007 // ----------- S t a t e ------------- | 1013 // ----------- S t a t e ------------- |
| 1008 // -- r3 : argument count (not including receiver) | 1014 // -- r3 : argument count (not including receiver) |
| 1009 // -- r6 : original constructor | 1015 // -- r6 : original constructor |
| 1010 // -- r4 : constructor to call | 1016 // -- r4 : constructor to call |
| 1011 // -- r5 : address of the first argument | 1017 // -- r5 : address of the first argument |
| 1012 // ----------------------------------- | 1018 // ----------------------------------- |
| 1013 | 1019 |
| 1014 // Calculate number of arguments. | 1020 // Push a slot for the receiver to be constructed. |
| 1015 __ mr(r7, r3); | |
| 1016 | |
| 1017 // Push a slot for the receiver. | |
| 1018 __ push(r3); | 1021 __ push(r3); |
| 1019 | 1022 |
| 1020 // Skip pushing arguments if none. | 1023 // Push the arguments (skip if none). |
| 1021 Label loop_end; | 1024 Label skip; |
| 1022 __ cmpi(r7, Operand(0)); | 1025 __ cmpi(r3, Operand::Zero()); |
| 1023 __ beq(&loop_end); | 1026 __ beq(&skip); |
| 1024 | 1027 Generate_InterpreterPushArgs(masm, r5, r3, r7); |
| 1025 // Push the arguments | 1028 __ bind(&skip); |
| 1026 Label loop; | |
| 1027 __ addi(r5, r5, Operand(kPointerSize)); // Bias up for LoadPU | |
| 1028 __ mtctr(r7); | |
| 1029 __ bind(&loop); | |
| 1030 __ LoadPU(r7, MemOperand(r5, -kPointerSize)); | |
| 1031 __ push(r7); | |
| 1032 __ bdnz(&loop); | |
| 1033 __ bind(&loop_end); | |
| 1034 | 1029 |
| 1035 // Call the constructor with r3, r4, and r6 unmodified. | 1030 // Call the constructor with r3, r4, and r6 unmodified. |
| 1036 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); | 1031 __ Jump(masm->isolate()->builtins()->Construct(), RelocInfo::CONSTRUCT_CALL); |
| 1037 } | 1032 } |
| 1038 | 1033 |
| 1039 | 1034 |
| 1040 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1035 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
| 1041 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1036 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
| 1042 GenerateTailCallToReturnedCode(masm); | 1037 GenerateTailCallToReturnedCode(masm); |
| 1043 } | 1038 } |
| (...skipping 913 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1957 __ bkpt(0); | 1952 __ bkpt(0); |
| 1958 } | 1953 } |
| 1959 } | 1954 } |
| 1960 | 1955 |
| 1961 | 1956 |
| 1962 #undef __ | 1957 #undef __ |
| 1963 } // namespace internal | 1958 } // namespace internal |
| 1964 } // namespace v8 | 1959 } // namespace v8 |
| 1965 | 1960 |
| 1966 #endif // V8_TARGET_ARCH_PPC | 1961 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |