Reviewers: Weiliang,
Message:
PTAL.
Description:
X87: [strong] Function arity check should be based on required parameters
port 78f0452d310221ac74b6221140d376d8302c4579 (r28491)
original commit message:
Also check whether the arguments count is smaller than the number of
required parameters which is the same as the SharedFunctionInfo length.
BUG=
Please review this at https://codereview.chromium.org/1146103003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+9, -3 lines):
M src/x87/builtins-x87.cc
Index: src/x87/builtins-x87.cc
diff --git a/src/x87/builtins-x87.cc b/src/x87/builtins-x87.cc
index
f45f1f0599b957e779108acf3f7e9db7500d7652..e5ad7e509e59d231b4d8519e5d35df73c025285b
100644
--- a/src/x87/builtins-x87.cc
+++ b/src/x87/builtins-x87.cc
@@ -1579,11 +1579,17 @@ void
Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ bind(&too_few);
// If the function is strong we need to throw an error.
- Label weak_function;
+ Label no_strong_error;
__ mov(ecx, FieldOperand(edi, JSFunction::kSharedFunctionInfoOffset));
__ test_b(FieldOperand(ecx, SharedFunctionInfo::kStrongModeByteOffset),
1 << SharedFunctionInfo::kStrongModeBitWithinByte);
- __ j(equal, &weak_function, Label::kNear);
+ __ j(equal, &no_strong_error, Label::kNear);
+
+ // What we really care about is the required number of arguments.
+ __ mov(ecx, FieldOperand(ecx, SharedFunctionInfo::kLengthOffset));
+ __ SmiUntag(ecx);
+ __ cmp(eax, ecx);
+ __ j(greater_equal, &no_strong_error, Label::kNear);
{
FrameScope frame(masm, StackFrame::MANUAL);
@@ -1591,7 +1597,7 @@ void
Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
__ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0);
}
- __ bind(&weak_function);
+ __ bind(&no_strong_error);
EnterArgumentsAdaptorFrame(masm);
// Copy receiver and all actual arguments.
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.