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 #include "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
(...skipping 1626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 __ subp(rax, Immediate(kPointerSize)); | 1637 __ subp(rax, Immediate(kPointerSize)); |
1638 __ cmpp(r8, rbx); | 1638 __ cmpp(r8, rbx); |
1639 __ j(less, ©); | 1639 __ j(less, ©); |
1640 __ jmp(&invoke); | 1640 __ jmp(&invoke); |
1641 } | 1641 } |
1642 | 1642 |
1643 { // Too few parameters: Actual < expected. | 1643 { // Too few parameters: Actual < expected. |
1644 __ bind(&too_few); | 1644 __ bind(&too_few); |
1645 | 1645 |
1646 // If the function is strong we need to throw an error. | 1646 // If the function is strong we need to throw an error. |
1647 Label weak_function; | 1647 Label no_strong_error; |
1648 __ movp(kScratchRegister, | 1648 __ movp(kScratchRegister, |
1649 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | 1649 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
1650 __ testb(FieldOperand(kScratchRegister, | 1650 __ testb(FieldOperand(kScratchRegister, |
1651 SharedFunctionInfo::kStrongModeByteOffset), | 1651 SharedFunctionInfo::kStrongModeByteOffset), |
1652 Immediate(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); | 1652 Immediate(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); |
1653 __ j(equal, &weak_function, Label::kNear); | 1653 __ j(equal, &no_strong_error, Label::kNear); |
| 1654 |
| 1655 // What we really care about is the required number of arguments. |
| 1656 |
| 1657 if (kPointerSize == kInt32Size) { |
| 1658 __ movp( |
| 1659 kScratchRegister, |
| 1660 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); |
| 1661 __ SmiToInteger32(kScratchRegister, kScratchRegister); |
| 1662 } else { |
| 1663 // See comment near kLengthOffset in src/objects.h |
| 1664 __ movsxlq( |
| 1665 kScratchRegister, |
| 1666 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); |
| 1667 __ shrq(kScratchRegister, Immediate(1)); |
| 1668 } |
| 1669 |
| 1670 __ cmpp(rax, kScratchRegister); |
| 1671 __ j(greater_equal, &no_strong_error, Label::kNear); |
1654 | 1672 |
1655 { | 1673 { |
1656 FrameScope frame(masm, StackFrame::MANUAL); | 1674 FrameScope frame(masm, StackFrame::MANUAL); |
1657 EnterArgumentsAdaptorFrame(masm); | 1675 EnterArgumentsAdaptorFrame(masm); |
1658 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); | 1676 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
1659 } | 1677 } |
1660 | 1678 |
1661 __ bind(&weak_function); | 1679 __ bind(&no_strong_error); |
1662 EnterArgumentsAdaptorFrame(masm); | 1680 EnterArgumentsAdaptorFrame(masm); |
1663 | 1681 |
1664 // Copy receiver and all actual arguments. | 1682 // Copy receiver and all actual arguments. |
1665 const int offset = StandardFrameConstants::kCallerSPOffset; | 1683 const int offset = StandardFrameConstants::kCallerSPOffset; |
1666 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); | 1684 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); |
1667 __ Set(r8, -1); // account for receiver | 1685 __ Set(r8, -1); // account for receiver |
1668 | 1686 |
1669 Label copy; | 1687 Label copy; |
1670 __ bind(©); | 1688 __ bind(©); |
1671 __ incp(r8); | 1689 __ incp(r8); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1765 __ bind(&ok); | 1783 __ bind(&ok); |
1766 __ ret(0); | 1784 __ ret(0); |
1767 } | 1785 } |
1768 | 1786 |
1769 | 1787 |
1770 #undef __ | 1788 #undef __ |
1771 | 1789 |
1772 } } // namespace v8::internal | 1790 } } // namespace v8::internal |
1773 | 1791 |
1774 #endif // V8_TARGET_ARCH_X64 | 1792 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |