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_ARM | 5 #if V8_TARGET_ARCH_ARM |
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 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1070 __ bind(&bytecode_array_not_present); | 1070 __ bind(&bytecode_array_not_present); |
1071 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1071 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1072 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1072 __ ldr(r4, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
1073 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCodeOffset)); | 1073 __ ldr(r4, FieldMemOperand(r4, SharedFunctionInfo::kCodeOffset)); |
1074 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); | 1074 __ add(r4, r4, Operand(Code::kHeaderSize - kHeapObjectTag)); |
1075 __ str(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1075 __ str(r4, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1076 __ RecordWriteCodeEntryField(r1, r4, r5); | 1076 __ RecordWriteCodeEntryField(r1, r4, r5); |
1077 __ Jump(r4); | 1077 __ Jump(r4); |
1078 } | 1078 } |
1079 | 1079 |
1080 | |
1081 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 1080 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
1082 // The return value is in accumulator, which is already in r0. | 1081 // The return value is in accumulator, which is already in r0. |
1083 | 1082 |
1084 // Leave the frame (also dropping the register file). | 1083 // Save the interpreter frame's function and callee pc to check if it has |
| 1084 // been marked for baseline compilation on return. |
| 1085 __ ldr(r2, MemOperand(sp, -kPointerSize)); |
| 1086 __ ldr(r1, MemOperand(fp, StandardFrameConstants::kFunctionOffset)); |
| 1087 |
| 1088 // Leave the frame (also dropping the register file). Do this before checking |
| 1089 // for baseline compile so that we don't count as an activation on the stack. |
1085 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 1090 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
1086 | 1091 |
| 1092 // Check if the function has been marked for baseline compilation on return. |
| 1093 Label not_marked_for_baseline; |
| 1094 __ mov(r3, Operand(ExternalReference( |
| 1095 Builtins::kInterpreterMarkBaselineOnReturn, masm->isolate()))); |
| 1096 __ ldr(r3, MemOperand(r3)); |
| 1097 __ add(r3, r3, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1098 __ cmp(r2, Operand(r3)); |
| 1099 __ b(ne, ¬_marked_for_baseline); |
| 1100 |
| 1101 { |
| 1102 FrameScope frame_scope(masm, StackFrame::INTERNAL); |
| 1103 // Push bytecode array and r0 for return. |
| 1104 __ push(kInterpreterBytecodeArrayRegister); |
| 1105 __ push(r0); |
| 1106 |
| 1107 // Push function as argument and compile for baseline. |
| 1108 __ push(r1); |
| 1109 __ CallRuntime(Runtime::kCompileBaseline); |
| 1110 |
| 1111 // Restore bytecode array and r0. |
| 1112 __ pop(r0); |
| 1113 __ pop(kInterpreterBytecodeArrayRegister); |
| 1114 } |
| 1115 |
| 1116 __ bind(¬_marked_for_baseline); |
| 1117 |
1087 // Drop receiver + arguments and return. | 1118 // Drop receiver + arguments and return. |
1088 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1119 __ ldr(ip, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1089 BytecodeArray::kParameterSizeOffset)); | 1120 BytecodeArray::kParameterSizeOffset)); |
1090 __ add(sp, sp, ip, LeaveCC); | 1121 __ add(sp, sp, ip, LeaveCC); |
1091 __ Jump(lr); | 1122 __ Jump(lr); |
1092 } | 1123 } |
1093 | 1124 |
| 1125 void Builtins::Generate_InterpreterMarkBaselineOnReturn(MacroAssembler* masm) { |
| 1126 // This builtin is only used as a marker to be checked in |
| 1127 // InterpreterExitTrampoline and should never be called itself. |
| 1128 __ Abort(kUnexpectedCallToMarkBaselineOnReturn); |
| 1129 } |
1094 | 1130 |
1095 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, | 1131 static void Generate_InterpreterPushArgs(MacroAssembler* masm, Register index, |
1096 Register limit, Register scratch) { | 1132 Register limit, Register scratch) { |
1097 Label loop_header, loop_check; | 1133 Label loop_header, loop_check; |
1098 __ b(al, &loop_check); | 1134 __ b(al, &loop_check); |
1099 __ bind(&loop_header); | 1135 __ bind(&loop_header); |
1100 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); | 1136 __ ldr(scratch, MemOperand(index, -kPointerSize, PostIndex)); |
1101 __ push(scratch); | 1137 __ push(scratch); |
1102 __ bind(&loop_check); | 1138 __ bind(&loop_check); |
1103 __ cmp(index, limit); | 1139 __ cmp(index, limit); |
(...skipping 1716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2820 } | 2856 } |
2821 } | 2857 } |
2822 | 2858 |
2823 | 2859 |
2824 #undef __ | 2860 #undef __ |
2825 | 2861 |
2826 } // namespace internal | 2862 } // namespace internal |
2827 } // namespace v8 | 2863 } // namespace v8 |
2828 | 2864 |
2829 #endif // V8_TARGET_ARCH_ARM | 2865 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |