OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
6 | 6 |
7 #include "src/code-factory.h" | 7 #include "src/code-factory.h" |
8 #include "src/codegen.h" | 8 #include "src/codegen.h" |
9 #include "src/deoptimizer.h" | 9 #include "src/deoptimizer.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 __ mov(edi, eax); | 1570 __ mov(edi, eax); |
1571 __ Pop(eax); | 1571 __ Pop(eax); |
1572 __ SmiUntag(eax); | 1572 __ SmiUntag(eax); |
1573 } | 1573 } |
1574 // The delegate is always a regular function. | 1574 // The delegate is always a regular function. |
1575 __ AssertFunction(edi); | 1575 __ AssertFunction(edi); |
1576 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); | 1576 __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET); |
1577 } | 1577 } |
1578 | 1578 |
1579 | 1579 |
| 1580 // static |
| 1581 void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) { |
| 1582 // ----------- S t a t e ------------- |
| 1583 // -- eax : the number of arguments (not including the receiver) |
| 1584 // -- ebx : the address of the first argument to be pushed. Subsequent |
| 1585 // arguments should be consecutive above this, in the same order as |
| 1586 // they are to be pushed onto the stack. |
| 1587 // -- edi : the target to call (can be any Object). |
| 1588 |
| 1589 // Pop return address to allow tail-call after pushing arguments. |
| 1590 __ Pop(edx); |
| 1591 |
| 1592 // Find the address of the last argument. |
| 1593 __ mov(ecx, eax); |
| 1594 __ add(ecx, Immediate(1)); // Add one for receiver. |
| 1595 __ shl(ecx, kPointerSizeLog2); |
| 1596 __ neg(ecx); |
| 1597 __ add(ecx, ebx); |
| 1598 |
| 1599 // Push the arguments. |
| 1600 Label loop_header, loop_check; |
| 1601 __ jmp(&loop_check); |
| 1602 __ bind(&loop_header); |
| 1603 __ Push(Operand(ebx, 0)); |
| 1604 __ sub(ebx, Immediate(kPointerSize)); |
| 1605 __ bind(&loop_check); |
| 1606 __ cmp(ebx, ecx); |
| 1607 __ j(greater, &loop_header, Label::kNear); |
| 1608 |
| 1609 // Call the target. |
| 1610 __ Push(edx); // Re-push return address. |
| 1611 __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
| 1612 } |
| 1613 |
| 1614 |
1580 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { | 1615 void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) { |
1581 // ----------- S t a t e ------------- | 1616 // ----------- S t a t e ------------- |
1582 // -- eax : actual number of arguments | 1617 // -- eax : actual number of arguments |
1583 // -- ebx : expected number of arguments | 1618 // -- ebx : expected number of arguments |
1584 // -- edi : function (passed through to callee) | 1619 // -- edi : function (passed through to callee) |
1585 // ----------------------------------- | 1620 // ----------------------------------- |
1586 | 1621 |
1587 Label invoke, dont_adapt_arguments; | 1622 Label invoke, dont_adapt_arguments; |
1588 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); | 1623 __ IncrementCounter(masm->isolate()->counters()->arguments_adaptors(), 1); |
1589 | 1624 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 | 1793 |
1759 __ bind(&ok); | 1794 __ bind(&ok); |
1760 __ ret(0); | 1795 __ ret(0); |
1761 } | 1796 } |
1762 | 1797 |
1763 #undef __ | 1798 #undef __ |
1764 } // namespace internal | 1799 } // namespace internal |
1765 } // namespace v8 | 1800 } // namespace v8 |
1766 | 1801 |
1767 #endif // V8_TARGET_ARCH_IA32 | 1802 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |