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 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1635 __ incp(r8); | 1635 __ incp(r8); |
1636 __ Push(Operand(rax, 0)); | 1636 __ Push(Operand(rax, 0)); |
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 |
| 1646 // If the function is strong we need to throw an error. |
| 1647 Label weak_function; |
| 1648 __ movp(kScratchRegister, |
| 1649 FieldOperand(rdi, JSFunction::kSharedFunctionInfoOffset)); |
| 1650 __ testb(FieldOperand(kScratchRegister, |
| 1651 SharedFunctionInfo::kStrongModeByteOffset), |
| 1652 Immediate(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); |
| 1653 __ j(equal, &weak_function, Label::kNear); |
| 1654 |
| 1655 { |
| 1656 FrameScope frame(masm, StackFrame::MANUAL); |
| 1657 EnterArgumentsAdaptorFrame(masm); |
| 1658 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
| 1659 } |
| 1660 |
| 1661 __ bind(&weak_function); |
1645 EnterArgumentsAdaptorFrame(masm); | 1662 EnterArgumentsAdaptorFrame(masm); |
1646 | 1663 |
1647 // Copy receiver and all actual arguments. | 1664 // Copy receiver and all actual arguments. |
1648 const int offset = StandardFrameConstants::kCallerSPOffset; | 1665 const int offset = StandardFrameConstants::kCallerSPOffset; |
1649 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); | 1666 __ leap(rdi, Operand(rbp, rax, times_pointer_size, offset)); |
1650 __ Set(r8, -1); // account for receiver | 1667 __ Set(r8, -1); // account for receiver |
1651 | 1668 |
1652 Label copy; | 1669 Label copy; |
1653 __ bind(©); | 1670 __ bind(©); |
1654 __ incp(r8); | 1671 __ incp(r8); |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1748 __ bind(&ok); | 1765 __ bind(&ok); |
1749 __ ret(0); | 1766 __ ret(0); |
1750 } | 1767 } |
1751 | 1768 |
1752 | 1769 |
1753 #undef __ | 1770 #undef __ |
1754 | 1771 |
1755 } } // namespace v8::internal | 1772 } } // namespace v8::internal |
1756 | 1773 |
1757 #endif // V8_TARGET_ARCH_X64 | 1774 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |