OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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_PPC | 7 #if V8_TARGET_ARCH_PPC |
8 | 8 |
9 #include "src/codegen.h" | 9 #include "src/codegen.h" |
10 #include "src/debug.h" | 10 #include "src/debug.h" |
(...skipping 1747 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1758 __ subi(r3, r3, Operand(kPointerSize)); | 1758 __ subi(r3, r3, Operand(kPointerSize)); |
1759 __ bne(©); | 1759 __ bne(©); |
1760 | 1760 |
1761 __ b(&invoke); | 1761 __ b(&invoke); |
1762 } | 1762 } |
1763 | 1763 |
1764 { // Too few parameters: Actual < expected | 1764 { // Too few parameters: Actual < expected |
1765 __ bind(&too_few); | 1765 __ bind(&too_few); |
1766 | 1766 |
1767 // If the function is strong we need to throw an error. | 1767 // If the function is strong we need to throw an error. |
1768 Label weak_function; | 1768 Label no_strong_error; |
1769 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); | 1769 __ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset)); |
1770 __ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset)); | 1770 __ lwz(r8, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset)); |
1771 __ TestBit(r7, | 1771 __ TestBit(r8, |
1772 #if V8_TARGET_ARCH_PPC64 | 1772 #if V8_TARGET_ARCH_PPC64 |
1773 SharedFunctionInfo::kStrongModeFunction, | 1773 SharedFunctionInfo::kStrongModeFunction, |
1774 #else | 1774 #else |
1775 SharedFunctionInfo::kStrongModeFunction + kSmiTagSize, | 1775 SharedFunctionInfo::kStrongModeFunction + kSmiTagSize, |
1776 #endif | 1776 #endif |
1777 r0); | 1777 r0); |
1778 __ beq(&weak_function, cr0); | 1778 __ beq(&no_strong_error, cr0); |
| 1779 |
| 1780 // What we really care about is the required number of arguments. |
| 1781 __ lwa(r7, FieldMemOperand(r7, SharedFunctionInfo::kLengthOffset)); |
| 1782 #if V8_TARGET_ARCH_PPC64 |
| 1783 // See commment near kLenghtOffset in src/objects.h |
| 1784 __ srawi(r7, r7, kSmiTagSize); |
| 1785 #else |
| 1786 __ SmiUntag(r7); |
| 1787 #endif |
| 1788 __ cmp(r3, r7); |
| 1789 __ bge(&no_strong_error); |
1779 | 1790 |
1780 { | 1791 { |
1781 FrameScope frame(masm, StackFrame::MANUAL); | 1792 FrameScope frame(masm, StackFrame::MANUAL); |
1782 EnterArgumentsAdaptorFrame(masm); | 1793 EnterArgumentsAdaptorFrame(masm); |
1783 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); | 1794 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); |
1784 } | 1795 } |
1785 | 1796 |
1786 __ bind(&weak_function); | 1797 __ bind(&no_strong_error); |
1787 EnterArgumentsAdaptorFrame(masm); | 1798 EnterArgumentsAdaptorFrame(masm); |
1788 | 1799 |
1789 // Calculate copy start address into r0 and copy end address is fp. | 1800 // Calculate copy start address into r0 and copy end address is fp. |
1790 // r3: actual number of arguments as a smi | 1801 // r3: actual number of arguments as a smi |
1791 // r4: function | 1802 // r4: function |
1792 // r5: expected number of arguments | 1803 // r5: expected number of arguments |
1793 // ip: code entry to call | 1804 // ip: code entry to call |
1794 __ SmiToPtrArrayOffset(r3, r3); | 1805 __ SmiToPtrArrayOffset(r3, r3); |
1795 __ add(r3, r3, fp); | 1806 __ add(r3, r3, fp); |
1796 | 1807 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1852 __ bkpt(0); | 1863 __ bkpt(0); |
1853 } | 1864 } |
1854 } | 1865 } |
1855 | 1866 |
1856 | 1867 |
1857 #undef __ | 1868 #undef __ |
1858 } | 1869 } |
1859 } // namespace v8::internal | 1870 } // namespace v8::internal |
1860 | 1871 |
1861 #endif // V8_TARGET_ARCH_PPC | 1872 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |