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 1266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1277 // Make r2 the space we have left. The stack might already be overflowed | 1277 // Make r2 the space we have left. The stack might already be overflowed |
1278 // here which will cause r2 to become negative. | 1278 // here which will cause r2 to become negative. |
1279 __ sub(r2, sp, r2); | 1279 __ sub(r2, sp, r2); |
1280 // Check if the arguments will overflow the stack. | 1280 // Check if the arguments will overflow the stack. |
1281 __ cmp(r2, Operand::PointerOffsetFromSmiKey(r0)); | 1281 __ cmp(r2, Operand::PointerOffsetFromSmiKey(r0)); |
1282 __ b(gt, &okay); // Signed comparison. | 1282 __ b(gt, &okay); // Signed comparison. |
1283 | 1283 |
1284 // Out of stack space. | 1284 // Out of stack space. |
1285 __ ldr(r1, MemOperand(fp, kFunctionOffset)); | 1285 __ ldr(r1, MemOperand(fp, kFunctionOffset)); |
1286 __ Push(r1, r0); | 1286 __ Push(r1, r0); |
1287 __ InvokeBuiltin(Builtins::APPLY_OVERFLOW, CALL_FUNCTION); | 1287 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); |
1288 // End of stack check. | 1288 // End of stack check. |
1289 | 1289 |
1290 // Push current limit and index. | 1290 // Push current limit and index. |
1291 __ bind(&okay); | 1291 __ bind(&okay); |
1292 __ push(r0); // limit | 1292 __ push(r0); // limit |
1293 __ mov(r1, Operand::Zero()); // initial index | 1293 __ mov(r1, Operand::Zero()); // initial index |
1294 __ push(r1); | 1294 __ push(r1); |
1295 | 1295 |
1296 // Get the receiver. | 1296 // Get the receiver. |
1297 __ ldr(r0, MemOperand(fp, kRecvOffset)); | 1297 __ ldr(r0, MemOperand(fp, kRecvOffset)); |
(...skipping 102 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 | |
Michael Starzinger
2014/04/11 08:33:10
nit: Only two empty newlines here.
ulan
2014/04/11 13:25:57
Done. Landing.
| |
1411 static void ArgumentAdaptorStackCheck(MacroAssembler* masm, | |
1412 Label* stack_overflow) { | |
1413 // ----------- S t a t e ------------- | |
1414 // -- r0 : actual number of arguments | |
1415 // -- r1 : function (passed through to callee) | |
1416 // -- r2 : expected number of arguments | |
1417 // ----------------------------------- | |
1418 // Check the stack for overflow. We are not trying to catch | |
1419 // interruptions (e.g. debug break and preemption) here, so the "real stack | |
1420 // limit" is checked. | |
1421 __ LoadRoot(r5, Heap::kRealStackLimitRootIndex); | |
1422 // Make r5 the space we have left. The stack might already be overflowed | |
1423 // here which will cause r5 to become negative. | |
1424 __ sub(r5, sp, r5); | |
1425 // Check if the arguments will overflow the stack. | |
1426 __ cmp(r5, Operand(r2, LSL, kPointerSizeLog2)); | |
1427 __ b(le, stack_overflow); // Signed comparison. | |
1428 } | |
1429 | |
1430 | |
1410 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { | 1431 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { |
1411 __ SmiTag(r0); | 1432 __ SmiTag(r0); |
1412 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 1433 __ mov(r4, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
1413 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | | 1434 __ stm(db_w, sp, r0.bit() | r1.bit() | r4.bit() | |
1414 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | | 1435 (FLAG_enable_ool_constant_pool ? pp.bit() : 0) | |
1415 fp.bit() | lr.bit()); | 1436 fp.bit() | lr.bit()); |
1416 __ add(fp, sp, | 1437 __ add(fp, sp, |
1417 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); | 1438 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); |
1418 } | 1439 } |
1419 | 1440 |
(...skipping 19 matching lines...) Expand all Loading... | |
1439 } | 1460 } |
1440 | 1461 |
1441 | 1462 |
1442 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1463 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1443 // ----------- S t a t e ------------- | 1464 // ----------- S t a t e ------------- |
1444 // -- r0 : actual number of arguments | 1465 // -- r0 : actual number of arguments |
1445 // -- r1 : function (passed through to callee) | 1466 // -- r1 : function (passed through to callee) |
1446 // -- r2 : expected number of arguments | 1467 // -- r2 : expected number of arguments |
1447 // ----------------------------------- | 1468 // ----------------------------------- |
1448 | 1469 |
1470 Label stack_overflow; | |
1471 ArgumentAdaptorStackCheck(masm, &stack_overflow); | |
1449 Label invoke, dont_adapt_arguments; | 1472 Label invoke, dont_adapt_arguments; |
1450 | 1473 |
1451 Label enough, too_few; | 1474 Label enough, too_few; |
1452 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); | 1475 __ ldr(r3, FieldMemOperand(r1, JSFunction::kCodeEntryOffset)); |
1453 __ cmp(r0, r2); | 1476 __ cmp(r0, r2); |
1454 __ b(lt, &too_few); | 1477 __ b(lt, &too_few); |
1455 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); | 1478 __ cmp(r2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); |
1456 __ b(eq, &dont_adapt_arguments); | 1479 __ b(eq, &dont_adapt_arguments); |
1457 | 1480 |
1458 { // Enough parameters: actual >= expected | 1481 { // Enough parameters: actual >= expected |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1538 // Exit frame and return. | 1561 // Exit frame and return. |
1539 LeaveArgumentsAdaptorFrame(masm); | 1562 LeaveArgumentsAdaptorFrame(masm); |
1540 __ Jump(lr); | 1563 __ Jump(lr); |
1541 | 1564 |
1542 | 1565 |
1543 // ------------------------------------------- | 1566 // ------------------------------------------- |
1544 // Dont adapt arguments. | 1567 // Dont adapt arguments. |
1545 // ------------------------------------------- | 1568 // ------------------------------------------- |
1546 __ bind(&dont_adapt_arguments); | 1569 __ bind(&dont_adapt_arguments); |
1547 __ Jump(r3); | 1570 __ Jump(r3); |
1571 | |
1572 __ bind(&stack_overflow); | |
1573 EnterArgumentsAdaptorFrame(masm); | |
1574 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, JUMP_FUNCTION); | |
1575 __ bkpt(0); | |
1548 } | 1576 } |
1549 | 1577 |
1550 | 1578 |
1551 #undef __ | 1579 #undef __ |
1552 | 1580 |
1553 } } // namespace v8::internal | 1581 } } // namespace v8::internal |
1554 | 1582 |
1555 #endif // V8_TARGET_ARCH_ARM | 1583 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |