| OLD | NEW |
| 1 // Copyright 2010 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 |
| (...skipping 1141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1152 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); | 1152 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::EAGER); |
| 1153 } | 1153 } |
| 1154 | 1154 |
| 1155 | 1155 |
| 1156 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { | 1156 void Builtins::Generate_NotifyLazyDeoptimized(MacroAssembler* masm) { |
| 1157 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); | 1157 Generate_NotifyDeoptimizedHelper(masm, Deoptimizer::LAZY); |
| 1158 } | 1158 } |
| 1159 | 1159 |
| 1160 | 1160 |
| 1161 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) { | 1161 void Builtins::Generate_NotifyOSR(MacroAssembler* masm) { |
| 1162 __ stop("builtins-arm.cc: NotifyOSR"); | 1162 // For now, we are relying on the fact that Runtime::NotifyOSR |
| 1163 // doesn't do any garbage collection which allows us to save/restore |
| 1164 // the registers without worrying about which of them contain |
| 1165 // pointers. This seems a bit fragile. |
| 1166 __ stm(db_w, sp, kJSCallerSaved | kCalleeSaved | lr.bit() | fp.bit()); |
| 1167 __ EnterInternalFrame(); |
| 1168 __ CallRuntime(Runtime::kNotifyOSR, 0); |
| 1169 __ LeaveInternalFrame(); |
| 1170 __ ldm(ia_w, sp, kJSCallerSaved | kCalleeSaved | lr.bit() | fp.bit()); |
| 1171 __ Ret(); |
| 1163 } | 1172 } |
| 1164 | 1173 |
| 1165 | 1174 |
| 1166 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { | 1175 void Builtins::Generate_OnStackReplacement(MacroAssembler* masm) { |
| 1167 __ stop("builtins-arm.cc: OnStackReplacement"); | 1176 // Probe the CPU to set the supported features, because this builtin |
| 1177 // may be called before the initialization performs CPU setup. |
| 1178 Isolate::Current()->cpu_features()->Probe(false); |
| 1179 |
| 1180 // Lookup the function in the JavaScript frame and push it as an |
| 1181 // argument to the on-stack replacement function. |
| 1182 __ ldr(r0, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1183 __ EnterInternalFrame(); |
| 1184 __ push(r0); |
| 1185 __ CallRuntime(Runtime::kCompileForOnStackReplacement, 1); |
| 1186 __ LeaveInternalFrame(); |
| 1187 |
| 1188 // If the result was -1 it means that we couldn't optimize the |
| 1189 // function. Just return and continue in the unoptimized version. |
| 1190 Label skip; |
| 1191 __ cmp(r0, Operand(Smi::FromInt(-1))); |
| 1192 __ b(ne, &skip); |
| 1193 __ Ret(); |
| 1194 |
| 1195 __ bind(&skip); |
| 1196 // Untag the AST id and push it on the stack. |
| 1197 __ SmiUntag(r0); |
| 1198 __ push(r0); |
| 1199 |
| 1200 // Generate the code for doing the frame-to-frame translation using |
| 1201 // the deoptimizer infrastructure. |
| 1202 Deoptimizer::EntryGenerator generator(masm, Deoptimizer::OSR); |
| 1203 generator.Generate(); |
| 1168 } | 1204 } |
| 1169 | 1205 |
| 1170 | 1206 |
| 1171 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { | 1207 void Builtins::Generate_FunctionCall(MacroAssembler* masm) { |
| 1172 // 1. Make sure we have at least one argument. | 1208 // 1. Make sure we have at least one argument. |
| 1173 // r0: actual number of arguments | 1209 // r0: actual number of arguments |
| 1174 { Label done; | 1210 { Label done; |
| 1175 __ tst(r0, Operand(r0)); | 1211 __ tst(r0, Operand(r0)); |
| 1176 __ b(ne, &done); | 1212 __ b(ne, &done); |
| 1177 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); | 1213 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1191 __ b(ne, &non_function); | 1227 __ b(ne, &non_function); |
| 1192 | 1228 |
| 1193 // 3a. Patch the first argument if necessary when calling a function. | 1229 // 3a. Patch the first argument if necessary when calling a function. |
| 1194 // r0: actual number of arguments | 1230 // r0: actual number of arguments |
| 1195 // r1: function | 1231 // r1: function |
| 1196 Label shift_arguments; | 1232 Label shift_arguments; |
| 1197 { Label convert_to_object, use_global_receiver, patch_receiver; | 1233 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1198 // Change context eagerly in case we need the global receiver. | 1234 // Change context eagerly in case we need the global receiver. |
| 1199 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1235 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1200 | 1236 |
| 1237 // Do not transform the receiver for strict mode functions. |
| 1238 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1239 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1240 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1241 kSmiTagSize))); |
| 1242 __ b(ne, &shift_arguments); |
| 1243 |
| 1244 // Compute the receiver in non-strict mode. |
| 1201 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1245 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1202 __ ldr(r2, MemOperand(r2, -kPointerSize)); | 1246 __ ldr(r2, MemOperand(r2, -kPointerSize)); |
| 1203 // r0: actual number of arguments | 1247 // r0: actual number of arguments |
| 1204 // r1: function | 1248 // r1: function |
| 1205 // r2: first argument | 1249 // r2: first argument |
| 1206 __ tst(r2, Operand(kSmiTagMask)); | 1250 __ tst(r2, Operand(kSmiTagMask)); |
| 1207 __ b(eq, &convert_to_object); | 1251 __ b(eq, &convert_to_object); |
| 1208 | 1252 |
| 1209 __ LoadRoot(r3, Heap::kNullValueRootIndex); | 1253 __ LoadRoot(r3, Heap::kNullValueRootIndex); |
| 1210 __ cmp(r2, r3); | 1254 __ cmp(r2, r3); |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 | 1398 |
| 1355 // Push current limit and index. | 1399 // Push current limit and index. |
| 1356 __ bind(&okay); | 1400 __ bind(&okay); |
| 1357 __ push(r0); // limit | 1401 __ push(r0); // limit |
| 1358 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index | 1402 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index |
| 1359 __ push(r1); | 1403 __ push(r1); |
| 1360 | 1404 |
| 1361 // Change context eagerly to get the right global object if necessary. | 1405 // Change context eagerly to get the right global object if necessary. |
| 1362 __ ldr(r0, MemOperand(fp, kFunctionOffset)); | 1406 __ ldr(r0, MemOperand(fp, kFunctionOffset)); |
| 1363 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); | 1407 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); |
| 1408 // Load the shared function info while the function is still in r0. |
| 1409 __ ldr(r1, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
| 1364 | 1410 |
| 1365 // Compute the receiver. | 1411 // Compute the receiver. |
| 1366 Label call_to_object, use_global_receiver, push_receiver; | 1412 Label call_to_object, use_global_receiver, push_receiver; |
| 1367 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 1413 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
| 1414 |
| 1415 // Do not transform the receiver for strict mode functions. |
| 1416 __ ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1417 __ tst(r1, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1418 kSmiTagSize))); |
| 1419 __ b(ne, &push_receiver); |
| 1420 |
| 1421 // Compute the receiver in non-strict mode. |
| 1368 __ tst(r0, Operand(kSmiTagMask)); | 1422 __ tst(r0, Operand(kSmiTagMask)); |
| 1369 __ b(eq, &call_to_object); | 1423 __ b(eq, &call_to_object); |
| 1370 __ LoadRoot(r1, Heap::kNullValueRootIndex); | 1424 __ LoadRoot(r1, Heap::kNullValueRootIndex); |
| 1371 __ cmp(r0, r1); | 1425 __ cmp(r0, r1); |
| 1372 __ b(eq, &use_global_receiver); | 1426 __ b(eq, &use_global_receiver); |
| 1373 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 1427 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); |
| 1374 __ cmp(r0, r1); | 1428 __ cmp(r0, r1); |
| 1375 __ b(eq, &use_global_receiver); | 1429 __ b(eq, &use_global_receiver); |
| 1376 | 1430 |
| 1377 // Check if the receiver is already a JavaScript object. | 1431 // Check if the receiver is already a JavaScript object. |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1568 __ bind(&dont_adapt_arguments); | 1622 __ bind(&dont_adapt_arguments); |
| 1569 __ Jump(r3); | 1623 __ Jump(r3); |
| 1570 } | 1624 } |
| 1571 | 1625 |
| 1572 | 1626 |
| 1573 #undef __ | 1627 #undef __ |
| 1574 | 1628 |
| 1575 } } // namespace v8::internal | 1629 } } // namespace v8::internal |
| 1576 | 1630 |
| 1577 #endif // V8_TARGET_ARCH_ARM | 1631 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |