OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 1389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1400 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), | 1400 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), |
1401 RelocInfo::CODE_TARGET); | 1401 RelocInfo::CODE_TARGET); |
1402 | 1402 |
1403 // Tear down the internal frame and remove function, receiver and args. | 1403 // Tear down the internal frame and remove function, receiver and args. |
1404 } | 1404 } |
1405 __ add(sp, sp, Operand(3 * kPointerSize)); | 1405 __ add(sp, sp, Operand(3 * kPointerSize)); |
1406 __ Jump(lr); | 1406 __ Jump(lr); |
1407 } | 1407 } |
1408 | 1408 |
1409 | 1409 |
| 1410 |
| 1411 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, |
| 1412 Label* stack_overflow) { |
| 1413 // Check the stack for overflow. We are not trying to catch |
| 1414 // interruptions (e.g. debug break and preemption) here, so the "real stack |
| 1415 // limit" is checked. |
| 1416 __ LoadRoot(r5, Heap::kRealStackLimitRootIndex); |
| 1417 // Make r5 the space we have left. The stack might already be overflowed |
| 1418 // here which will cause r5 to become negative. |
| 1419 __ sub(r5, sp, r5); |
| 1420 // Check if the arguments will overflow the stack. |
| 1421 __ cmp(r5, Operand(r2, LSL, kPointerSizeLog2)); |
| 1422 __ b(le, stack_overflow); // Signed comparison. |
| 1423 } |
| 1424 |
| 1425 |
1410 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1426 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
1411 __ SmiTag(r0); | 1427 __ SmiTag(r0); |
1412 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1428 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1413 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | | 1429 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | |
1414 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | 1430 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | |
1415 fp.bit() | lr.bit()); | 1431 fp.bit() | lr.bit()); |
1416 __ add(fp, sp, | 1432 __ add(fp, sp, |
1417 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); | 1433 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); |
1418 } | 1434 } |
1419 | 1435 |
(...skipping 19 matching lines...) Expand all Loading... |
1439 } | 1455 } |
1440 | 1456 |
1441 | 1457 |
1442 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1458 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1443 // ----------- S t a t e ------------- | 1459 // ----------- S t a t e ------------- |
1444 // -- r0 : actual number of arguments | 1460 // -- r0 : actual number of arguments |
1445 // -- r1 : function (passed through to callee) | 1461 // -- r1 : function (passed through to callee) |
1446 // -- r2 : expected number of arguments | 1462 // -- r2 : expected number of arguments |
1447 // ----------------------------------- | 1463 // ----------------------------------- |
1448 | 1464 |
| 1465 Label stack_overflow; |
| 1466 ArgumentAdaptorStackCheck(masm, &stack_overflow); |
1449 Label invoke, dont_adapt_arguments; | 1467 Label invoke, dont_adapt_arguments; |
1450 | 1468 |
1451 Label enough, too_few; | 1469 Label enough, too_few; |
1452 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1470 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1453 __ cmp(r0, r2); | 1471 __ cmp(r0, r2); |
1454 __ b(lt, &too_few); | 1472 __ b(lt, &too_few); |
1455 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1473 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
1456 __ b(eq, &dont_adapt_arguments); | 1474 __ b(eq, &dont_adapt_arguments); |
1457 | 1475 |
1458 { // Enough parameters: actual >= expected | 1476 { // Enough parameters: actual >= expected |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1538 // Exit frame and return. | 1556 // Exit frame and return. |
1539 LeaveArgumentsAdaptorFrame(masm); | 1557 LeaveArgumentsAdaptorFrame(masm); |
1540 __ Jump(lr); | 1558 __ Jump(lr); |
1541 | 1559 |
1542 | 1560 |
1543 // ------------------------------------------- | 1561 // ------------------------------------------- |
1544 // Dont adapt arguments. | 1562 // Dont adapt arguments. |
1545 // ------------------------------------------- | 1563 // ------------------------------------------- |
1546 __ bind(&dont_adapt_arguments); | 1564 __ bind(&dont_adapt_arguments); |
1547 __ Jump(r3); | 1565 __ Jump(r3); |
| 1566 |
| 1567 __ bind(&stack_overflow); |
| 1568 EnterArgumentsAdaptorFrame(masm); |
| 1569 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, JUMP_FUNCTION); |
1548 } | 1570 } |
1549 | 1571 |
1550 | 1572 |
1551 #undef __ | 1573 #undef __ |
1552 | 1574 |
1553 } } // namespace v8::internal | 1575 } } // namespace v8::internal |
1554 | 1576 |
1555 #endif // V8_TARGET_ARCH_ARM | 1577 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |