| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1231 // 3a. Patch the first argument if necessary when calling a function. | 1231 // 3a. Patch the first argument if necessary when calling a function. |
| 1232 // r0: actual number of arguments | 1232 // r0: actual number of arguments |
| 1233 // r1: function | 1233 // r1: function |
| 1234 Label shift_arguments; | 1234 Label shift_arguments; |
| 1235 { Label convert_to_object, use_global_receiver, patch_receiver; | 1235 { Label convert_to_object, use_global_receiver, patch_receiver; |
| 1236 // Change context eagerly in case we need the global receiver. | 1236 // Change context eagerly in case we need the global receiver. |
| 1237 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); | 1237 __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset)); |
| 1238 | 1238 |
| 1239 // Do not transform the receiver for strict mode functions. | 1239 // Do not transform the receiver for strict mode functions. |
| 1240 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); | 1240 __ ldr(r2, FieldMemOperand(r1, JSFunction::kSharedFunctionInfoOffset)); |
| 1241 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); | 1241 __ ldr(r3, FieldMemOperand(r2, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1242 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1242 __ tst(r3, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1243 kSmiTagSize))); | 1243 kSmiTagSize))); |
| 1244 __ b(ne, &shift_arguments); | 1244 __ b(ne, &shift_arguments); |
| 1245 | 1245 |
| 1246 // Do not transform the receiver for native (shared already in r2). |
| 1247 __ ldr(r2, FieldMemOperand(r2, SharedFunctionInfo::kScriptOffset)); |
| 1248 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); |
| 1249 __ cmp(r2, r3); |
| 1250 __ b(eq, &shift_arguments); |
| 1251 __ ldr(r2, FieldMemOperand(r2, Script::kTypeOffset)); |
| 1252 __ mov(r2, Operand(r2, ASR, kSmiTagSize)); |
| 1253 __ cmp(r2, Operand(Script::TYPE_NATIVE)); |
| 1254 __ b(eq, &shift_arguments); |
| 1255 |
| 1246 // Compute the receiver in non-strict mode. | 1256 // Compute the receiver in non-strict mode. |
| 1247 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); | 1257 __ add(r2, sp, Operand(r0, LSL, kPointerSizeLog2)); |
| 1248 __ ldr(r2, MemOperand(r2, -kPointerSize)); | 1258 __ ldr(r2, MemOperand(r2, -kPointerSize)); |
| 1249 // r0: actual number of arguments | 1259 // r0: actual number of arguments |
| 1250 // r1: function | 1260 // r1: function |
| 1251 // r2: first argument | 1261 // r2: first argument |
| 1252 __ tst(r2, Operand(kSmiTagMask)); | 1262 __ tst(r2, Operand(kSmiTagMask)); |
| 1253 __ b(eq, &convert_to_object); | 1263 __ b(eq, &convert_to_object); |
| 1254 | 1264 |
| 1265 // Heap::kUndefinedValueRootIndex is already in r3. |
| 1266 __ cmp(r2, r3); |
| 1267 __ b(eq, &use_global_receiver); |
| 1255 __ LoadRoot(r3, Heap::kNullValueRootIndex); | 1268 __ LoadRoot(r3, Heap::kNullValueRootIndex); |
| 1256 __ cmp(r2, r3); | 1269 __ cmp(r2, r3); |
| 1257 __ b(eq, &use_global_receiver); | 1270 __ b(eq, &use_global_receiver); |
| 1258 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex); | |
| 1259 __ cmp(r2, r3); | |
| 1260 __ b(eq, &use_global_receiver); | |
| 1261 | 1271 |
| 1262 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); | 1272 __ CompareObjectType(r2, r3, r3, FIRST_JS_OBJECT_TYPE); |
| 1263 __ b(lt, &convert_to_object); | 1273 __ b(lt, &convert_to_object); |
| 1264 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE)); | 1274 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE)); |
| 1265 __ b(le, &shift_arguments); | 1275 __ b(le, &shift_arguments); |
| 1266 | 1276 |
| 1267 __ bind(&convert_to_object); | 1277 __ bind(&convert_to_object); |
| 1268 __ EnterInternalFrame(); // In order to preserve argument count. | 1278 __ EnterInternalFrame(); // In order to preserve argument count. |
| 1269 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. | 1279 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. |
| 1270 __ push(r0); | 1280 __ push(r0); |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 __ ldr(r0, MemOperand(fp, kFunctionOffset)); | 1419 __ ldr(r0, MemOperand(fp, kFunctionOffset)); |
| 1410 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); | 1420 __ ldr(cp, FieldMemOperand(r0, JSFunction::kContextOffset)); |
| 1411 // Load the shared function info while the function is still in r0. | 1421 // Load the shared function info while the function is still in r0. |
| 1412 __ ldr(r1, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); | 1422 __ ldr(r1, FieldMemOperand(r0, JSFunction::kSharedFunctionInfoOffset)); |
| 1413 | 1423 |
| 1414 // Compute the receiver. | 1424 // Compute the receiver. |
| 1415 Label call_to_object, use_global_receiver, push_receiver; | 1425 Label call_to_object, use_global_receiver, push_receiver; |
| 1416 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 1426 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
| 1417 | 1427 |
| 1418 // Do not transform the receiver for strict mode functions. | 1428 // Do not transform the receiver for strict mode functions. |
| 1419 __ ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); | 1429 __ ldr(r2, FieldMemOperand(r1, SharedFunctionInfo::kCompilerHintsOffset)); |
| 1420 __ tst(r1, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + | 1430 __ tst(r2, Operand(1 << (SharedFunctionInfo::kStrictModeFunction + |
| 1421 kSmiTagSize))); | 1431 kSmiTagSize))); |
| 1422 __ b(ne, &push_receiver); | 1432 __ b(ne, &push_receiver); |
| 1423 | 1433 |
| 1434 // Do not transform the receiver for native (shared already in r1). |
| 1435 __ ldr(r1, FieldMemOperand(r1, SharedFunctionInfo::kScriptOffset)); |
| 1436 __ LoadRoot(r2, Heap::kUndefinedValueRootIndex); |
| 1437 __ cmp(r1, r2); |
| 1438 __ b(eq, &push_receiver); |
| 1439 __ ldr(r1, FieldMemOperand(r1, Script::kTypeOffset)); |
| 1440 __ mov(r1, Operand(r1, ASR, kSmiTagSize)); |
| 1441 __ cmp(r1, Operand(Script::TYPE_NATIVE)); |
| 1442 __ b(eq, &push_receiver); |
| 1443 |
| 1424 // Compute the receiver in non-strict mode. | 1444 // Compute the receiver in non-strict mode. |
| 1425 __ tst(r0, Operand(kSmiTagMask)); | 1445 __ tst(r0, Operand(kSmiTagMask)); |
| 1426 __ b(eq, &call_to_object); | 1446 __ b(eq, &call_to_object); |
| 1427 __ LoadRoot(r1, Heap::kNullValueRootIndex); | 1447 __ LoadRoot(r1, Heap::kNullValueRootIndex); |
| 1428 __ cmp(r0, r1); | 1448 __ cmp(r0, r1); |
| 1429 __ b(eq, &use_global_receiver); | 1449 __ b(eq, &use_global_receiver); |
| 1430 __ LoadRoot(r1, Heap::kUndefinedValueRootIndex); | 1450 // Heap::kUndefinedValueRootIndex is already in r2. |
| 1431 __ cmp(r0, r1); | 1451 __ cmp(r0, r2); |
| 1432 __ b(eq, &use_global_receiver); | 1452 __ b(eq, &use_global_receiver); |
| 1433 | 1453 |
| 1434 // Check if the receiver is already a JavaScript object. | 1454 // Check if the receiver is already a JavaScript object. |
| 1435 // r0: receiver | 1455 // r0: receiver |
| 1436 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 1456 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); |
| 1437 __ b(lt, &call_to_object); | 1457 __ b(lt, &call_to_object); |
| 1438 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); | 1458 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); |
| 1439 __ b(le, &push_receiver); | 1459 __ b(le, &push_receiver); |
| 1440 | 1460 |
| 1441 // Convert the receiver to a regular object. | 1461 // Convert the receiver to a regular object. |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1625 __ bind(&dont_adapt_arguments); | 1645 __ bind(&dont_adapt_arguments); |
| 1626 __ Jump(r3); | 1646 __ Jump(r3); |
| 1627 } | 1647 } |
| 1628 | 1648 |
| 1629 | 1649 |
| 1630 #undef __ | 1650 #undef __ |
| 1631 | 1651 |
| 1632 } } // namespace v8::internal | 1652 } } // namespace v8::internal |
| 1633 | 1653 |
| 1634 #endif // V8_TARGET_ARCH_ARM | 1654 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |