Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: src/mips/builtins-mips.cc

Issue 239803004: MIPS: Reland r20692 "Check stack limit in ArgumentAdaptorTrampoline." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(), 1414 __ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
1415 RelocInfo::CODE_TARGET); 1415 RelocInfo::CODE_TARGET);
1416 // Tear down the internal frame and remove function, receiver and args. 1416 // Tear down the internal frame and remove function, receiver and args.
1417 } 1417 }
1418 1418
1419 __ Ret(USE_DELAY_SLOT); 1419 __ Ret(USE_DELAY_SLOT);
1420 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot. 1420 __ Addu(sp, sp, Operand(3 * kPointerSize)); // In delay slot.
1421 } 1421 }
1422 1422
1423 1423
1424 static void ArgumentAdaptorStackCheck(MacroAssembler* masm,
1425 Label* stack_overflow) {
1426 // ----------- S t a t e -------------
1427 // -- a0 : actual number of arguments
1428 // -- a1 : function (passed through to callee)
1429 // -- a2 : expected number of arguments
1430 // -----------------------------------
1431 // Check the stack for overflow. We are not trying to catch
1432 // interruptions (e.g. debug break and preemption) here, so the "real stack
1433 // limit" is checked.
1434 __ LoadRoot(t1, Heap::kRealStackLimitRootIndex);
1435 // Make t1 the space we have left. The stack might already be overflowed
1436 // here which will cause t1 to become negative.
1437 __ subu(t1, sp, t1);
1438 // Check if the arguments will overflow the stack.
1439 __ sll(at, a2, kPointerSizeLog2);
1440 // Signed comparison.
1441 __ Branch(stack_overflow, le, t1, Operand(at));
1442 }
1443
1444
1424 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) { 1445 static void EnterArgumentsAdaptorFrame(MacroAssembler* masm) {
1425 __ sll(a0, a0, kSmiTagSize); 1446 __ sll(a0, a0, kSmiTagSize);
1426 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); 1447 __ li(t0, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR)));
1427 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit()); 1448 __ MultiPush(a0.bit() | a1.bit() | t0.bit() | fp.bit() | ra.bit());
1428 __ Addu(fp, sp, 1449 __ Addu(fp, sp,
1429 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize)); 1450 Operand(StandardFrameConstants::kFixedFrameSizeFromFp + kPointerSize));
1430 } 1451 }
1431 1452
1432 1453
1433 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) { 1454 static void LeaveArgumentsAdaptorFrame(MacroAssembler* masm) {
(...skipping 14 matching lines...) Expand all
1448 1469
1449 1470
1450 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { 1471 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
1451 // State setup as expected by MacroAssembler::InvokePrologue. 1472 // State setup as expected by MacroAssembler::InvokePrologue.
1452 // ----------- S t a t e ------------- 1473 // ----------- S t a t e -------------
1453 // -- a0: actual arguments count 1474 // -- a0: actual arguments count
1454 // -- a1: function (passed through to callee) 1475 // -- a1: function (passed through to callee)
1455 // -- a2: expected arguments count 1476 // -- a2: expected arguments count
1456 // ----------------------------------- 1477 // -----------------------------------
1457 1478
1479 Label stack_overflow;
1480 ArgumentAdaptorStackCheck(masm, &stack_overflow);
1458 Label invoke, dont_adapt_arguments; 1481 Label invoke, dont_adapt_arguments;
1459 1482
1460 Label enough, too_few; 1483 Label enough, too_few;
1461 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset)); 1484 __ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
1462 __ Branch(&dont_adapt_arguments, eq, 1485 __ Branch(&dont_adapt_arguments, eq,
1463 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel)); 1486 a2, Operand(SharedFunctionInfo::kDontAdaptArgumentsSentinel));
1464 // We use Uless as the number of argument should always be greater than 0. 1487 // We use Uless as the number of argument should always be greater than 0.
1465 __ Branch(&too_few, Uless, a0, Operand(a2)); 1488 __ Branch(&too_few, Uless, a0, Operand(a2));
1466 1489
1467 { // Enough parameters: actual >= expected. 1490 { // Enough parameters: actual >= expected.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
1556 // Exit frame and return. 1579 // Exit frame and return.
1557 LeaveArgumentsAdaptorFrame(masm); 1580 LeaveArgumentsAdaptorFrame(masm);
1558 __ Ret(); 1581 __ Ret();
1559 1582
1560 1583
1561 // ------------------------------------------- 1584 // -------------------------------------------
1562 // Don't adapt arguments. 1585 // Don't adapt arguments.
1563 // ------------------------------------------- 1586 // -------------------------------------------
1564 __ bind(&dont_adapt_arguments); 1587 __ bind(&dont_adapt_arguments);
1565 __ Jump(a3); 1588 __ Jump(a3);
1589
1590 __ bind(&stack_overflow);
1591 {
1592 FrameScope frame(masm, StackFrame::MANUAL);
1593 EnterArgumentsAdaptorFrame(masm);
1594 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION);
1595 __ break_(0xCC);
1596 }
1566 } 1597 }
1567 1598
1568 1599
1569 #undef __ 1600 #undef __
1570 1601
1571 } } // namespace v8::internal 1602 } } // namespace v8::internal
1572 1603
1573 #endif // V8_TARGET_ARCH_MIPS 1604 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698