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 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 | 961 |
962 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 962 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
963 Generate_JSEntryTrampolineHelper(masm, false); | 963 Generate_JSEntryTrampolineHelper(masm, false); |
964 } | 964 } |
965 | 965 |
966 | 966 |
967 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 967 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
968 Generate_JSEntryTrampolineHelper(masm, true); | 968 Generate_JSEntryTrampolineHelper(masm, true); |
969 } | 969 } |
970 | 970 |
| 971 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch) { |
| 972 Register args_count = scratch; |
| 973 |
| 974 // Get the arguments + receiver count. |
| 975 __ LoadP(args_count, |
| 976 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
| 977 __ lwz(args_count, |
| 978 FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset)); |
| 979 |
| 980 // Leave the frame (also dropping the register file). |
| 981 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 982 |
| 983 __ add(sp, sp, args_count); |
| 984 } |
971 | 985 |
972 // Generate code for entering a JS function with the interpreter. | 986 // Generate code for entering a JS function with the interpreter. |
973 // On entry to the function the receiver and arguments have been pushed on the | 987 // On entry to the function the receiver and arguments have been pushed on the |
974 // stack left to right. The actual argument count matches the formal parameter | 988 // stack left to right. The actual argument count matches the formal parameter |
975 // count expected by the function. | 989 // count expected by the function. |
976 // | 990 // |
977 // The live registers are: | 991 // The live registers are: |
978 // o r4: the JS function object being called. | 992 // o r4: the JS function object being called. |
979 // o r6: the new target | 993 // o r6: the new target |
980 // o cp: our context | 994 // o cp: our context |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 // Dispatch to the first bytecode handler for the function. | 1084 // Dispatch to the first bytecode handler for the function. |
1071 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, | 1085 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister, |
1072 kInterpreterBytecodeOffsetRegister)); | 1086 kInterpreterBytecodeOffsetRegister)); |
1073 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); | 1087 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2)); |
1074 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1088 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1075 __ Call(ip); | 1089 __ Call(ip); |
1076 | 1090 |
1077 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 1091 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
1078 | 1092 |
1079 // The return value is in r3. | 1093 // The return value is in r3. |
1080 | 1094 LeaveInterpreterFrame(masm, r5); |
1081 // Get the arguments + reciever count. | |
1082 __ LoadP(r5, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); | |
1083 __ lwz(r5, FieldMemOperand(r5, BytecodeArray::kParameterSizeOffset)); | |
1084 | |
1085 // Leave the frame (also dropping the register file). | |
1086 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | |
1087 | |
1088 __ add(sp, sp, r5); | |
1089 __ blr(); | 1095 __ blr(); |
1090 | 1096 |
1091 // If the bytecode array is no longer present, then the underlying function | 1097 // If the bytecode array is no longer present, then the underlying function |
1092 // has been switched to a different kind of code and we heal the closure by | 1098 // has been switched to a different kind of code and we heal the closure by |
1093 // switching the code entry field over to the new code object as well. | 1099 // switching the code entry field over to the new code object as well. |
1094 __ bind(&bytecode_array_not_present); | 1100 __ bind(&bytecode_array_not_present); |
1095 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1101 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1096 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1102 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
1097 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); | 1103 __ LoadP(r7, FieldMemOperand(r7, SharedFunctionInfo::kCodeOffset)); |
1098 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1104 __ addi(r7, r7, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1099 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); | 1105 __ StoreP(r7, FieldMemOperand(r4, JSFunction::kCodeEntryOffset), r0); |
1100 __ RecordWriteCodeEntryField(r4, r7, r8); | 1106 __ RecordWriteCodeEntryField(r4, r7, r8); |
1101 __ JumpToJSEntry(r7); | 1107 __ JumpToJSEntry(r7); |
1102 } | 1108 } |
1103 | 1109 |
| 1110 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
| 1111 // Save the function and context for call to CompileBaseline. |
| 1112 __ LoadP(r4, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); |
| 1113 __ LoadP(kContextRegister, |
| 1114 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1115 |
| 1116 // Leave the frame before recompiling for baseline so that we don't count as |
| 1117 // an activation on the stack. |
| 1118 LeaveInterpreterFrame(masm, r5); |
| 1119 |
| 1120 { |
| 1121 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
| 1122 // Push return value. |
| 1123 __ push(r3); |
| 1124 |
| 1125 // Push function as argument and compile for baseline. |
| 1126 __ push(r4); |
| 1127 __ CallRuntime(Runtime::kCompileBaseline); |
| 1128 |
| 1129 // Restore return value. |
| 1130 __ pop(r3); |
| 1131 } |
| 1132 __ blr(); |
| 1133 } |
1104 | 1134 |
1105 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, | 1135 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
1106 Register count, Register scratch) { | 1136 Register count, Register scratch) { |
1107 Label loop; | 1137 Label loop; |
1108 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU | 1138 __ addi(index, index, Operand(kPointerSize)); // Bias up for LoadPU |
1109 __ mtctr(count); | 1139 __ mtctr(count); |
1110 __ bind(&loop); | 1140 __ bind(&loop); |
1111 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); | 1141 __ LoadPU(scratch, MemOperand(index, -kPointerSize)); |
1112 __ push(scratch); | 1142 __ push(scratch); |
1113 __ bdnz(&loop); | 1143 __ bdnz(&loop); |
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2826 __ bkpt(0); | 2856 __ bkpt(0); |
2827 } | 2857 } |
2828 } | 2858 } |
2829 | 2859 |
2830 | 2860 |
2831 #undef __ | 2861 #undef __ |
2832 } // namespace internal | 2862 } // namespace internal |
2833 } // namespace v8 | 2863 } // namespace v8 |
2834 | 2864 |
2835 #endif // V8_TARGET_ARCH_PPC | 2865 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |