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_S390 | 5 #if V8_TARGET_ARCH_S390 |
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 939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
950 } | 950 } |
951 | 951 |
952 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { | 952 void Builtins::Generate_JSEntryTrampoline(MacroAssembler* masm) { |
953 Generate_JSEntryTrampolineHelper(masm, false); | 953 Generate_JSEntryTrampolineHelper(masm, false); |
954 } | 954 } |
955 | 955 |
956 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { | 956 void Builtins::Generate_JSConstructEntryTrampoline(MacroAssembler* masm) { |
957 Generate_JSEntryTrampolineHelper(masm, true); | 957 Generate_JSEntryTrampolineHelper(masm, true); |
958 } | 958 } |
959 | 959 |
| 960 static void LeaveInterpreterFrame(MacroAssembler* masm, Register scratch) { |
| 961 Register args_count = scratch; |
| 962 |
| 963 // Get the arguments + receiver count. |
| 964 __ LoadP(args_count, |
| 965 MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); |
| 966 __ LoadlW(args_count, |
| 967 FieldMemOperand(args_count, BytecodeArray::kParameterSizeOffset)); |
| 968 |
| 969 // Leave the frame (also dropping the register file). |
| 970 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
| 971 |
| 972 __ AddP(sp, sp, args_count); |
| 973 } |
| 974 |
960 // Generate code for entering a JS function with the interpreter. | 975 // Generate code for entering a JS function with the interpreter. |
961 // On entry to the function the receiver and arguments have been pushed on the | 976 // On entry to the function the receiver and arguments have been pushed on the |
962 // stack left to right. The actual argument count matches the formal parameter | 977 // stack left to right. The actual argument count matches the formal parameter |
963 // count expected by the function. | 978 // count expected by the function. |
964 // | 979 // |
965 // The live registers are: | 980 // The live registers are: |
966 // o r3: the JS function object being called. | 981 // o r3: the JS function object being called. |
967 // o r5: the new target | 982 // o r5: the new target |
968 // o cp: our context | 983 // o cp: our context |
969 // o pp: the caller's constant pool pointer (if enabled) | 984 // o pp: the caller's constant pool pointer (if enabled) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1060 // Dispatch to the first bytecode handler for the function. | 1075 // Dispatch to the first bytecode handler for the function. |
1061 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, | 1076 __ LoadlB(r3, MemOperand(kInterpreterBytecodeArrayRegister, |
1062 kInterpreterBytecodeOffsetRegister)); | 1077 kInterpreterBytecodeOffsetRegister)); |
1063 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); | 1078 __ ShiftLeftP(ip, r3, Operand(kPointerSizeLog2)); |
1064 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); | 1079 __ LoadP(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); |
1065 __ Call(ip); | 1080 __ Call(ip); |
1066 | 1081 |
1067 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); | 1082 masm->isolate()->heap()->SetInterpreterEntryReturnPCOffset(masm->pc_offset()); |
1068 | 1083 |
1069 // The return value is in r2. | 1084 // The return value is in r2. |
1070 | 1085 LeaveInterpreterFrame(masm, r4); |
1071 // Get the arguments + reciever count. | |
1072 __ LoadP(r4, MemOperand(fp, InterpreterFrameConstants::kBytecodeArrayFromFp)); | |
1073 __ LoadlW(r4, FieldMemOperand(r4, BytecodeArray::kParameterSizeOffset)); | |
1074 | |
1075 // Leave the frame (also dropping the register file). | |
1076 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | |
1077 | |
1078 __ lay(sp, MemOperand(sp, r4)); | |
1079 __ Ret(); | 1086 __ Ret(); |
1080 | 1087 |
1081 // If the bytecode array is no longer present, then the underlying function | 1088 // If the bytecode array is no longer present, then the underlying function |
1082 // has been switched to a different kind of code and we heal the closure by | 1089 // has been switched to a different kind of code and we heal the closure by |
1083 // switching the code entry field over to the new code object as well. | 1090 // switching the code entry field over to the new code object as well. |
1084 __ bind(&bytecode_array_not_present); | 1091 __ bind(&bytecode_array_not_present); |
1085 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1092 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1086 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); | 1093 __ LoadP(r6, FieldMemOperand(r3, JSFunction::kSharedFunctionInfoOffset)); |
1087 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); | 1094 __ LoadP(r6, FieldMemOperand(r6, SharedFunctionInfo::kCodeOffset)); |
1088 __ AddP(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1095 __ AddP(r6, r6, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1089 __ StoreP(r6, FieldMemOperand(r3, JSFunction::kCodeEntryOffset), r0); | 1096 __ StoreP(r6, FieldMemOperand(r3, JSFunction::kCodeEntryOffset), r0); |
1090 __ RecordWriteCodeEntryField(r3, r6, r7); | 1097 __ RecordWriteCodeEntryField(r3, r6, r7); |
1091 __ JumpToJSEntry(r6); | 1098 __ JumpToJSEntry(r6); |
1092 } | 1099 } |
1093 | 1100 |
| 1101 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
| 1102 // Save the function and context for call to CompileBaseline. |
| 1103 __ LoadP(r3, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); |
| 1104 __ LoadP(kContextRegister, |
| 1105 MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 1106 |
| 1107 // Leave the frame before recompiling for baseline so that we don't count as |
| 1108 // an activation on the stack. |
| 1109 LeaveInterpreterFrame(masm, r4); |
| 1110 |
| 1111 { |
| 1112 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
| 1113 // Push return value. |
| 1114 __ push(r2); |
| 1115 |
| 1116 // Push function as argument and compile for baseline. |
| 1117 __ push(r3); |
| 1118 __ CallRuntime(Runtime::kCompileBaseline); |
| 1119 |
| 1120 // Restore return value. |
| 1121 __ pop(r2); |
| 1122 } |
| 1123 __ Ret(); |
| 1124 } |
| 1125 |
1094 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, | 1126 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
1095 Register count, Register scratch) { | 1127 Register count, Register scratch) { |
1096 Label loop; | 1128 Label loop; |
1097 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU | 1129 __ AddP(index, index, Operand(kPointerSize)); // Bias up for LoadPU |
1098 __ LoadRR(r0, count); | 1130 __ LoadRR(r0, count); |
1099 __ bind(&loop); | 1131 __ bind(&loop); |
1100 __ LoadP(scratch, MemOperand(index, -kPointerSize)); | 1132 __ LoadP(scratch, MemOperand(index, -kPointerSize)); |
1101 __ lay(index, MemOperand(index, -kPointerSize)); | 1133 __ lay(index, MemOperand(index, -kPointerSize)); |
1102 __ push(scratch); | 1134 __ push(scratch); |
1103 __ SubP(r0, Operand(1)); | 1135 __ SubP(r0, Operand(1)); |
(...skipping 1685 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2789 __ bkpt(0); | 2821 __ bkpt(0); |
2790 } | 2822 } |
2791 } | 2823 } |
2792 | 2824 |
2793 #undef __ | 2825 #undef __ |
2794 | 2826 |
2795 } // namespace internal | 2827 } // namespace internal |
2796 } // namespace v8 | 2828 } // namespace v8 |
2797 | 2829 |
2798 #endif // V8_TARGET_ARCH_S390 | 2830 #endif // V8_TARGET_ARCH_S390 |
OLD | NEW |