Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(432)

Side by Side Diff: src/mips64/builtins-mips64.cc

Issue 1133933003: [strong] Function arity check should be based on required parameters (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: git rebase Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #if V8_TARGET_ARCH_MIPS64 9 #if V8_TARGET_ARCH_MIPS64
10 10
(...skipping 1735 matching lines...) Expand 10 before | Expand all | Expand 10 after
1746 __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(a2)); 1746 __ Branch(USE_DELAY_SLOT, &copy, ne, a0, Operand(a2));
1747 __ daddiu(a0, a0, -kPointerSize); // In delay slot. 1747 __ daddiu(a0, a0, -kPointerSize); // In delay slot.
1748 1748
1749 __ jmp(&invoke); 1749 __ jmp(&invoke);
1750 } 1750 }
1751 1751
1752 { // Too few parameters: Actual < expected. 1752 { // Too few parameters: Actual < expected.
1753 __ bind(&too_few); 1753 __ bind(&too_few);
1754 1754
1755 // If the function is strong we need to throw an error. 1755 // If the function is strong we need to throw an error.
1756 Label weak_function; 1756 Label no_strong_error;
1757 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset)); 1757 __ ld(a4, FieldMemOperand(a1, JSFunction::kSharedFunctionInfoOffset));
1758 __ lbu(a4, FieldMemOperand(a4, SharedFunctionInfo::kStrongModeByteOffset)); 1758 __ lbu(a5, FieldMemOperand(a4, SharedFunctionInfo::kStrongModeByteOffset));
1759 __ And(a4, a4, Operand(1 << SharedFunctionInfo::kStrongModeBitWithinByte)); 1759 __ And(a5, a5, Operand(1 << SharedFunctionInfo::kStrongModeBitWithinByte));
1760 __ Branch(&weak_function, eq, a4, Operand(zero_reg)); 1760 __ Branch(&no_strong_error, eq, a5, Operand(zero_reg));
1761
1762 // What we really care about is the required number of arguments.
1763 __ lw(a5, FieldMemOperand(a4, SharedFunctionInfo::kLengthOffset));
1764 __ srl(a5, a5, 1);
paul.l... 2015/05/18 22:04:01 A couple nits that I think are completely unimport
paul.l... 2015/05/18 22:11:47 Actually, if you expected negative numbers, you sh
1765 __ Branch(&no_strong_error, ge, a0, Operand(a5));
1761 1766
1762 { 1767 {
1763 FrameScope frame(masm, StackFrame::MANUAL); 1768 FrameScope frame(masm, StackFrame::MANUAL);
1764 EnterArgumentsAdaptorFrame(masm); 1769 EnterArgumentsAdaptorFrame(masm);
1765 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0); 1770 __ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0);
1766 } 1771 }
1767 1772
1768 __ bind(&weak_function); 1773 __ bind(&no_strong_error);
1769 EnterArgumentsAdaptorFrame(masm); 1774 EnterArgumentsAdaptorFrame(masm);
1770 1775
1771 // Calculate copy start address into a0 and copy end address is fp. 1776 // Calculate copy start address into a0 and copy end address is fp.
1772 // a0: actual number of arguments as a smi 1777 // a0: actual number of arguments as a smi
1773 // a1: function 1778 // a1: function
1774 // a2: expected number of arguments 1779 // a2: expected number of arguments
1775 // a3: code entry to call 1780 // a3: code entry to call
1776 __ SmiScale(a0, a0, kPointerSizeLog2); 1781 __ SmiScale(a0, a0, kPointerSizeLog2);
1777 __ Daddu(a0, fp, a0); 1782 __ Daddu(a0, fp, a0);
1778 // Adjust for return address and receiver. 1783 // Adjust for return address and receiver.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
1839 __ break_(0xCC); 1844 __ break_(0xCC);
1840 } 1845 }
1841 } 1846 }
1842 1847
1843 1848
1844 #undef __ 1849 #undef __
1845 1850
1846 } } // namespace v8::internal 1851 } } // namespace v8::internal
1847 1852
1848 #endif // V8_TARGET_ARCH_MIPS64 1853 #endif // V8_TARGET_ARCH_MIPS64
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698