| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2010 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| 11 // with the distribution. | 11 // with the distribution. |
| (...skipping 12 matching lines...) Expand all Loading... |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include "v8.h" | 28 #include "v8.h" |
| 29 | 29 |
| 30 #if defined(V8_TARGET_ARCH_ARM) | 30 #if defined(V8_TARGET_ARCH_ARM) |
| 31 | 31 |
| 32 #include "codegen-inl.h" | 32 #include "codegen-inl.h" |
| 33 #include "debug.h" | 33 #include "debug.h" |
| 34 #include "deoptimizer.h" |
| 35 #include "full-codegen.h" |
| 34 #include "runtime.h" | 36 #include "runtime.h" |
| 35 | 37 |
| 36 namespace v8 { | 38 namespace v8 { |
| 37 namespace internal { | 39 namespace internal { |
| 38 | 40 |
| 39 | 41 |
| 40 #define __ ACCESS_MASM(masm) | 42 #define __ ACCESS_MASM(masm) |
| 41 | 43 |
| 42 | 44 |
| 43 void Builtins::Generate_Adaptor(MacroAssembler* masm, | 45 void Builtins::Generate_Adaptor(MacroAssembler* masm, |
| (...skipping 1041 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1085 __ pop(r1); | 1087 __ pop(r1); |
| 1086 | 1088 |
| 1087 // Tear down temporary frame. | 1089 // Tear down temporary frame. |
| 1088 __ LeaveInternalFrame(); | 1090 __ LeaveInternalFrame(); |
| 1089 | 1091 |
| 1090 // Do a tail-call of the compiled function. | 1092 // Do a tail-call of the compiled function. |
| 1091 __ Jump(r2); | 1093 __ Jump(r2); |
| 1092 } | 1094 } |
| 1093 | 1095 |
| 1094 | 1096 |
| 1097 void Builtins::Generate_LazyRecompile(MacroAssembler* masm) { |
| 1098 // Enter an internal frame. |
| 1099 __ EnterInternalFrame(); |
| 1100 |
| 1101 // Preserve the function. |
| 1102 __ push(r1); |
| 1103 |
| 1104 // Push the function on the stack as the argument to the runtime function. |
| 1105 __ push(r1); |
| 1106 __ CallRuntime(Runtime::kLazyRecompile, 1); |
| 1107 // Calculate the entry point. |
| 1108 __ add(r2, r0, Operand(Code::kHeaderSize - kHeapObjectTag)); |
| 1109 // Restore saved function. |
| 1110 __ pop(r1); |
| 1111 |
| 1112 // Tear down temporary frame. |
| 1113 __ LeaveInternalFrame(); |
| 1114 |
| 1115 // Do a tail-call of the compiled function. |
| 1116 __ Jump(r2); |
| 1117 } |
| 1118 |
| 1119 |
| 1120 static void Generate_NotifyDeoptimizedHelper(MacroAssembler* masm, |
| 1121 Deoptimizer::BailoutType type) { |
| 1122 __ EnterInternalFrame(); |
| 1123 // Pass the function and deoptimization type to the runtime system. |
| 1124 __ mov(r0, Operand(Smi::FromInt(static_cast<int>(type)))); |
| 1125 __ push(r0); |
| 1126 __ CallRuntime(Runtime::kNotifyDeoptimized, 1); |
| 1127 __ LeaveInternalFrame(); |
| 1128 |
| 1129 // Get the full codegen state from the stack and untag it -> r6. |
| 1130 __ ldr(r6, MemOperand(sp, 0 * kPointerSize)); |
| 1131 __ SmiUntag(r6); |
| 1132 // Switch on the state. |
| 1133 Label with_tos_register, unknown_state; |
| 1134 __ cmp(r6, Operand(FullCodeGenerator::NO_REGISTERS)); |
| 1135 __ b(ne, &with_tos_register); |
| 1136 __ add(sp, sp, Operand(1 * kPointerSize)); // Remove state. |
| 1137 __ Ret(); |
| 1138 |
| 1139 __ bind(&with_tos_register); |
| 1140 __ ldr(r0, MemOperand(sp, 1 * kPointerSize)); |
| 1141 __ cmp(r6, Operand(FullCodeGenerator::TOS_REG)); |
| 1142 __ b(ne, &unknown_state); |
| 1143 __ add(sp, sp, Operand(2 * kPointerSize)); // Remove state. |
| 1144 __ Ret(); |
| 1145 |
| 1146 __ bind(&unknown_state); |
| 1147 __ stop("no cases left"); |
| 1148 } |
| 1149 |
| 1150 |
| 1151 void Builtins::Generate_NotifyDeoptimized(MacroAssembler* masm) { |
| 1152 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1153 } |
| 1154 |
| 1155 |
| 1156 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1157 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1158 } |
| 1159 |
| 1160 |
| 1161 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) { |
| 1162 __ stop("builtins-arm.cc: NotifyOSR"); |
| 1163 } |
| 1164 |
| 1165 |
| 1166 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1167 __ stop("builtins-arm.cc: OnStackReplacement"); |
| 1168 } |
| 1169 |
| 1170 |
| 1095 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 1171 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 1096 // 1. Make sure we have at least one argument. | 1172 // 1. Make sure we have at least one argument. |
| 1097 // r0: actual number of arguments | 1173 // r0: actual number of arguments |
| 1098 { Label done; | 1174 { Label done; |
| 1099 __ tst(r0, Operand(r0)); | 1175 __ tst(r0, Operand(r0)); |
| 1100 __ b(ne, &done); | 1176 __ b(ne, &done); |
| 1101 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 1177 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 1102 __ push(r2); | 1178 __ push(r2); |
| 1103 __ add(r0, r0, Operand(1)); | 1179 __ add(r0, r0, Operand(1)); |
| 1104 __ bind(&done); | 1180 __ bind(&done); |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1492 __ bind(&dont_adapt_arguments); | 1568 __ bind(&dont_adapt_arguments); |
| 1493 __ Jump(r3); | 1569 __ Jump(r3); |
| 1494 } | 1570 } |
| 1495 | 1571 |
| 1496 | 1572 |
| 1497 #undef __ | 1573 #undef __ |
| 1498 | 1574 |
| 1499 } } // namespace v8::internal | 1575 } } // namespace v8::internal |
| 1500 | 1576 |
| 1501 #endif // V8_TARGET_ARCH_ARM | 1577 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |