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 566 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 __ mov(argument, r0); | 577 __ mov(argument, r0); |
578 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); | 578 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); |
579 __ b(&argument_is_string); | 579 __ b(&argument_is_string); |
580 | 580 |
581 // Invoke the conversion builtin and put the result into r2. | 581 // Invoke the conversion builtin and put the result into r2. |
582 __ bind(&convert_argument); | 582 __ bind(&convert_argument); |
583 __ push(function); // Preserve the function. | 583 __ push(function); // Preserve the function. |
584 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); | 584 __ IncrementCounter(counters->string_ctor_conversions(), 1, r3, r4); |
585 __ EnterInternalFrame(); | 585 __ EnterInternalFrame(); |
586 __ push(r0); | 586 __ push(r0); |
587 __ InvokeBuiltin(Builtins::TO_STRING, CALL_JS); | 587 __ InvokeBuiltin(Builtins::TO_STRING, CALL_FUNCTION); |
588 __ LeaveInternalFrame(); | 588 __ LeaveInternalFrame(); |
589 __ pop(function); | 589 __ pop(function); |
590 __ mov(argument, r0); | 590 __ mov(argument, r0); |
591 __ b(&argument_is_string); | 591 __ b(&argument_is_string); |
592 | 592 |
593 // Load the empty string into r2, remove the receiver from the | 593 // Load the empty string into r2, remove the receiver from the |
594 // stack, and jump back to the case where the argument is a string. | 594 // stack, and jump back to the case where the argument is a string. |
595 __ bind(&no_arguments); | 595 __ bind(&no_arguments); |
596 __ LoadRoot(argument, Heap::kEmptyStringRootIndex); | 596 __ LoadRoot(argument, Heap::kEmptyStringRootIndex); |
597 __ Drop(1); | 597 __ Drop(1); |
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1263 __ b(lt, &convert_to_object); | 1263 __ b(lt, &convert_to_object); |
1264 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE)); | 1264 __ cmp(r3, Operand(LAST_JS_OBJECT_TYPE)); |
1265 __ b(le, &shift_arguments); | 1265 __ b(le, &shift_arguments); |
1266 | 1266 |
1267 __ bind(&convert_to_object); | 1267 __ bind(&convert_to_object); |
1268 __ EnterInternalFrame(); // In order to preserve argument count. | 1268 __ EnterInternalFrame(); // In order to preserve argument count. |
1269 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. | 1269 __ mov(r0, Operand(r0, LSL, kSmiTagSize)); // Smi-tagged. |
1270 __ push(r0); | 1270 __ push(r0); |
1271 | 1271 |
1272 __ push(r2); | 1272 __ push(r2); |
1273 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_JS); | 1273 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1274 __ mov(r2, r0); | 1274 __ mov(r2, r0); |
1275 | 1275 |
1276 __ pop(r0); | 1276 __ pop(r0); |
1277 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); | 1277 __ mov(r0, Operand(r0, ASR, kSmiTagSize)); |
1278 __ LeaveInternalFrame(); | 1278 __ LeaveInternalFrame(); |
1279 // Restore the function to r1. | 1279 // Restore the function to r1. |
1280 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); | 1280 __ ldr(r1, MemOperand(sp, r0, LSL, kPointerSizeLog2)); |
1281 __ jmp(&patch_receiver); | 1281 __ jmp(&patch_receiver); |
1282 | 1282 |
1283 // Use the global receiver object from the called function as the | 1283 // Use the global receiver object from the called function as the |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 const int kArgsOffset = 2 * kPointerSize; | 1371 const int kArgsOffset = 2 * kPointerSize; |
1372 const int kRecvOffset = 3 * kPointerSize; | 1372 const int kRecvOffset = 3 * kPointerSize; |
1373 const int kFunctionOffset = 4 * kPointerSize; | 1373 const int kFunctionOffset = 4 * kPointerSize; |
1374 | 1374 |
1375 __ EnterInternalFrame(); | 1375 __ EnterInternalFrame(); |
1376 | 1376 |
1377 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function | 1377 __ ldr(r0, MemOperand(fp, kFunctionOffset)); // get the function |
1378 __ push(r0); | 1378 __ push(r0); |
1379 __ ldr(r0, MemOperand(fp, kArgsOffset)); // get the args array | 1379 __ ldr(r0, MemOperand(fp, kArgsOffset)); // get the args array |
1380 __ push(r0); | 1380 __ push(r0); |
1381 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_JS); | 1381 __ InvokeBuiltin(Builtins::APPLY_PREPARE, CALL_FUNCTION); |
1382 | 1382 |
1383 // Check the stack for overflow. We are not trying need to catch | 1383 // Check the stack for overflow. We are not trying need to catch |
1384 // interruptions (e.g. debug break and preemption) here, so the "real stack | 1384 // interruptions (e.g. debug break and preemption) here, so the "real stack |
1385 // limit" is checked. | 1385 // limit" is checked. |
1386 Label okay; | 1386 Label okay; |
1387 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); | 1387 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); |
1388 // Make r2 the space we have left. The stack might already be overflowed | 1388 // Make r2 the space we have left. The stack might already be overflowed |
1389 // here which will cause r2 to become negative. | 1389 // here which will cause r2 to become negative. |
1390 __ sub(r2, sp, r2); | 1390 __ sub(r2, sp, r2); |
1391 // Check if the arguments will overflow the stack. | 1391 // Check if the arguments will overflow the stack. |
1392 __ cmp(r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); | 1392 __ cmp(r2, Operand(r0, LSL, kPointerSizeLog2 - kSmiTagSize)); |
1393 __ b(gt, &okay); // Signed comparison. | 1393 __ b(gt, &okay); // Signed comparison. |
1394 | 1394 |
1395 // Out of stack space. | 1395 // Out of stack space. |
1396 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1396 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
1397 __ push(r1); | 1397 __ push(r1); |
1398 __ push(r0); | 1398 __ push(r0); |
1399 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_JS); | 1399 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); |
1400 // End of stack check. | 1400 // End of stack check. |
1401 | 1401 |
1402 // Push current limit and index. | 1402 // Push current limit and index. |
1403 __ bind(&okay); | 1403 __ bind(&okay); |
1404 __ push(r0); // limit | 1404 __ push(r0); // limit |
1405 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index | 1405 __ mov(r1, Operand(0, RelocInfo::NONE)); // initial index |
1406 __ push(r1); | 1406 __ push(r1); |
1407 | 1407 |
1408 // Change context eagerly to get the right global object if necessary. | 1408 // Change context eagerly to get the right global object if necessary. |
1409 __ ldr(r0, MemOperand(fp, kFunctionOffset)); | 1409 __ ldr(r0, MemOperand(fp, kFunctionOffset)); |
(...skipping 25 matching lines...) Expand all Loading... |
1435 // r0: receiver | 1435 // r0: receiver |
1436 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); | 1436 __ CompareObjectType(r0, r1, r1, FIRST_JS_OBJECT_TYPE); |
1437 __ b(lt, &call_to_object); | 1437 __ b(lt, &call_to_object); |
1438 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); | 1438 __ cmp(r1, Operand(LAST_JS_OBJECT_TYPE)); |
1439 __ b(le, &push_receiver); | 1439 __ b(le, &push_receiver); |
1440 | 1440 |
1441 // Convert the receiver to a regular object. | 1441 // Convert the receiver to a regular object. |
1442 // r0: receiver | 1442 // r0: receiver |
1443 __ bind(&call_to_object); | 1443 __ bind(&call_to_object); |
1444 __ push(r0); | 1444 __ push(r0); |
1445 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_JS); | 1445 __ InvokeBuiltin(Builtins::TO_OBJECT, CALL_FUNCTION); |
1446 __ b(&push_receiver); | 1446 __ b(&push_receiver); |
1447 | 1447 |
1448 // Use the current global receiver object as the receiver. | 1448 // Use the current global receiver object as the receiver. |
1449 __ bind(&use_global_receiver); | 1449 __ bind(&use_global_receiver); |
1450 const int kGlobalOffset = | 1450 const int kGlobalOffset = |
1451 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; | 1451 Context::kHeaderSize + Context::GLOBAL_INDEX * kPointerSize; |
1452 __ ldr(r0, FieldMemOperand(cp, kGlobalOffset)); | 1452 __ ldr(r0, FieldMemOperand(cp, kGlobalOffset)); |
1453 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); | 1453 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalContextOffset)); |
1454 __ ldr(r0, FieldMemOperand(r0, kGlobalOffset)); | 1454 __ ldr(r0, FieldMemOperand(r0, kGlobalOffset)); |
1455 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); | 1455 __ ldr(r0, FieldMemOperand(r0, GlobalObject::kGlobalReceiverOffset)); |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1625 __ bind(&dont_adapt_arguments); | 1625 __ bind(&dont_adapt_arguments); |
1626 __ Jump(r3); | 1626 __ Jump(r3); |
1627 } | 1627 } |
1628 | 1628 |
1629 | 1629 |
1630 #undef __ | 1630 #undef __ |
1631 | 1631 |
1632 } } // namespace v8::internal | 1632 } } // namespace v8::internal |
1633 | 1633 |
1634 #endif // V8_TARGET_ARCH_ARM | 1634 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |