Commit 5299d177 authored by chunyang.dai's avatar chunyang.dai Committed by Commit bot

X87: [strong] Function arity check should be based on required parameters

port 78f0452d (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=

Review URL: https://codereview.chromium.org/1146103003

Cr-Commit-Position: refs/heads/master@{#28531}
parent d14a189c
......@@ -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.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment