Commit 08d83d65 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [strong] Check arity of functions

Port 3226e980

Original commit message:
In strong mode it is an error to call a function with too few
arguments.

This is enforced inside the ArgumentsAdaptorTrampoline.

This does not yet handle rest parameters

R=arv@chromium.org, dstence@us.ibm.com, michael_dawson@ca.ibm.com
BUG=

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

Cr-Commit-Position: refs/heads/master@{#28348}
parent bc7cadd5
......@@ -1763,6 +1763,27 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
{ // Too few parameters: Actual < expected
__ bind(&too_few);
// If the function is strong we need to throw an error.
Label weak_function;
__ LoadP(r7, FieldMemOperand(r4, JSFunction::kSharedFunctionInfoOffset));
__ lwz(r7, FieldMemOperand(r7, SharedFunctionInfo::kCompilerHintsOffset));
__ TestBit(r7,
#if V8_TARGET_ARCH_PPC64
SharedFunctionInfo::kStrongModeFunction,
#else
SharedFunctionInfo::kStrongModeFunction + kSmiTagSize,
#endif
r0);
__ beq(&weak_function, cr0);
{
FrameScope frame(masm, StackFrame::MANUAL);
EnterArgumentsAdaptorFrame(masm);
__ CallRuntime(Runtime::kThrowStrongModeTooFewArguments, 0);
}
__ bind(&weak_function);
EnterArgumentsAdaptorFrame(masm);
// Calculate copy start address into r0 and copy end address is fp.
......
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