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_X64 | 5 #if V8_TARGET_ARCH_X64 |
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 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1802 __ Push(Operand(rax, 0)); | 1802 __ Push(Operand(rax, 0)); |
1803 __ subp(rax, Immediate(kPointerSize)); | 1803 __ subp(rax, Immediate(kPointerSize)); |
1804 __ cmpp(r8, rbx); | 1804 __ cmpp(r8, rbx); |
1805 __ j(less, ©); | 1805 __ j(less, ©); |
1806 __ jmp(&invoke); | 1806 __ jmp(&invoke); |
1807 } | 1807 } |
1808 | 1808 |
1809 { // Too few parameters: Actual < expected. | 1809 { // Too few parameters: Actual < expected. |
1810 __ bind(&too_few); | 1810 __ bind(&too_few); |
1811 | 1811 |
1812 // If the function is strong we need to throw an error. | |
1813 Label no_strong_error; | |
1814 __ movp(kScratchRegister, | |
1815 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); | |
1816 __ testb(FieldOperand(kScratchRegister, | |
1817 SharedFunctionInfo::kStrongModeByteOffset), | |
1818 Immediate(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); | |
1819 __ j(equal, &no_strong_error, Label::kNear); | |
1820 | |
1821 // What we really care about is the required number of arguments. | |
1822 | |
1823 if (kPointerSize == kInt32Size) { | |
1824 __ movp( | |
1825 kScratchRegister, | |
1826 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); | |
1827 __ SmiToInteger32(kScratchRegister, kScratchRegister); | |
1828 } else { | |
1829 // See comment near kLengthOffset in src/objects.h | |
1830 __ movsxlq( | |
1831 kScratchRegister, | |
1832 FieldOperand(kScratchRegister, SharedFunctionInfo::kLengthOffset)); | |
1833 __ shrq(kScratchRegister, Immediate(1)); | |
1834 } | |
1835 | |
1836 __ cmpp(rax, kScratchRegister); | |
1837 __ j(greater_equal, &no_strong_error, Label::kNear); | |
1838 | |
1839 { | |
1840 FrameScope frame(masm, StackFrame::MANUAL); | |
1841 EnterArgumentsAdaptorFrame(masm); | |
1842 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments); | |
1843 } | |
1844 | |
1845 __ bind(&no_strong_error); | |
1846 EnterArgumentsAdaptorFrame(masm); | 1812 EnterArgumentsAdaptorFrame(masm); |
1847 ArgumentsAdaptorStackCheck(masm, &stack_overflow); | 1813 ArgumentsAdaptorStackCheck(masm, &stack_overflow); |
1848 | 1814 |
1849 // Copy receiver and all actual arguments. | 1815 // Copy receiver and all actual arguments. |
1850 const int offset = StandardFrameConstants::kCallerSPOffset; | 1816 const int offset = StandardFrameConstants::kCallerSPOffset; |
1851 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); | 1817 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); |
1852 __ Set(r8, -1); // account for receiver | 1818 __ Set(r8, -1); // account for receiver |
1853 | 1819 |
1854 Label copy; | 1820 Label copy; |
1855 __ bind(©); | 1821 __ bind(©); |
(...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2686 __ ret(0); | 2652 __ ret(0); |
2687 } | 2653 } |
2688 | 2654 |
2689 | 2655 |
2690 #undef __ | 2656 #undef __ |
2691 | 2657 |
2692 } // namespace internal | 2658 } // namespace internal |
2693 } // namespace v8 | 2659 } // namespace v8 |
2694 | 2660 |
2695 #endif // V8_TARGET_ARCH_X64 | 2661 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |