PPC: [strong] Function arity check should be based on required parameters
Port 78f0452d31
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.
R=arv@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=
Review URL: https://codereview.chromium.org/1133093004
Cr-Commit-Position: refs/heads/master@{#28492}
This commit is contained in:
parent
78f0452d31
commit
65141b68ca
@ -1765,17 +1765,28 @@ 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;
|
||||
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
|
||||
__ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ TestBit(r7,
|
||||
__ lwz(r8, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset));
|
||||
__ TestBit(r8,
|
||||
#if V8_TARGET_ARCH_PPC64
|
||||
SharedFunctionInfo::kStrongModeFunction,
|
||||
#else
|
||||
SharedFunctionInfo::kStrongModeFunction + kSmiTagSize,
|
||||
#endif
|
||||
r0);
|
||||
__ beq(&weak_function, cr0);
|
||||
__ beq(&no_strong_error, cr0);
|
||||
|
||||
// What we really care about is the required number of arguments.
|
||||
__ lwa(r7, FieldMemOperand(r7, SharedFunctionInfo::kLengthOffset));
|
||||
#if V8_TARGET_ARCH_PPC64
|
||||
// See commment near kLenghtOffset in src/objects.h
|
||||
__ srawi(r7, r7, kSmiTagSize);
|
||||
#else
|
||||
__ SmiUntag(r7);
|
||||
#endif
|
||||
__ cmp(r3, r7);
|
||||
__ bge(&no_strong_error);
|
||||
|
||||
{
|
||||
FrameScope frame(masm, StackFrame::MANUAL);
|
||||
@ -1783,7 +1794,7 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
|
||||
__ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0);
|
||||
}
|
||||
|
||||
__ bind(&weak_function);
|
||||
__ bind(&no_strong_error);
|
||||
EnterArgumentsAdaptorFrame(masm);
|
||||
|
||||
// Calculate copy start address into r0 and copy end address is fp.
|
||||
|
Loading…
Reference in New Issue
Block a user