Commit 392435bc authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [proxies] throw TypeError if is_callable Map bit is unset

Port 18b9c1ce

Original commit message:
    Per ProxyCreate() (https://tc39.github.io/ecma262/#sec-proxycreate), a Proxy
    is only given a [[Call]] slot if the target has a [[Call]] slot as well. This
    was previously implemented correctly for [[Construct]], but not for [[Call]].

R=caitpotter88@gmail.com, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=v8:4797, v8:4796, v8:1543
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#34465}
parent df269e6e
......@@ -2325,6 +2325,12 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode,
__ cmpi(r8, Operand(JS_BOUND_FUNCTION_TYPE));
__ Jump(masm->isolate()->builtins()->CallBoundFunction(tail_call_mode),
RelocInfo::CODE_TARGET, eq);
// Check if target has a [[Call]] internal method.
__ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset));
__ TestBit(r7, Map::kIsCallable, r0);
__ beq(&non_callable, cr0);
__ cmpi(r8, Operand(JS_PROXY_TYPE));
__ bne(&non_function);
......@@ -2345,10 +2351,6 @@ void Builtins::Generate_Call(MacroAssembler* masm, ConvertReceiverMode mode,
// 2. Call to something else, which might have a [[Call]] internal method (if
// not we raise an exception).
__ bind(&non_function);
// Check if target has a [[Call]] internal method.
__ lbz(r7, FieldMemOperand(r7, Map::kBitFieldOffset));
__ TestBit(r7, Map::kIsCallable, r0);
__ beq(&non_callable, cr0);
// Overwrite the original receiver the (original) target.
__ ShiftLeftImm(r8, r3, Operand(kPointerSizeLog2));
__ StorePX(r4, MemOperand(sp, r8));
......
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