| Index: src/mips64/builtins-mips64.cc
|
| diff --git a/src/mips64/builtins-mips64.cc b/src/mips64/builtins-mips64.cc
|
| index da1feaf986514345ebba56108e641dc1d5b67845..581fbe781aaec34d2084ca701d8a697b020b7b2b 100644
|
| --- a/src/mips64/builtins-mips64.cc
|
| +++ b/src/mips64/builtins-mips64.cc
|
| @@ -1655,21 +1655,6 @@
|
|
|
|
|
| // static
|
| -void Builtins::Generate_ConstructProxy(MacroAssembler* masm) {
|
| - // ----------- S t a t e -------------
|
| - // -- a0 : the number of arguments (not including the receiver)
|
| - // -- a1 : the constructor to call (checked to be a JSFunctionProxy)
|
| - // -- a3 : the original constructor (either the same as the constructor or
|
| - // the JSFunction on which new was invoked initially)
|
| - // -----------------------------------
|
| -
|
| - // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
| - __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
|
| - __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| -}
|
| -
|
| -
|
| -// static
|
| void Builtins::Generate_Construct(MacroAssembler* masm) {
|
| // ----------- S t a t e -------------
|
| // -- a0 : the number of arguments (not including the receiver)
|
| @@ -1678,36 +1663,36 @@
|
| // the JSFunction on which new was invoked initially)
|
| // -----------------------------------
|
|
|
| - // Check if target has a [[Construct]] internal method.
|
| - Label non_constructor;
|
| - __ JumpIfSmi(a1, &non_constructor);
|
| - __ ld(t1, FieldMemOperand(t1, HeapObject::kMapOffset));
|
| - __ lbu(t2, FieldMemOperand(t1, Map::kBitFieldOffset));
|
| - __ And(t2, t2, Operand(1 << Map::kIsCallable));
|
| - __ Branch(&non_constructor, eq, t2, Operand(zero_reg));
|
| -
|
| - // Dispatch based on instance type.
|
| - __ lbu(t2, FieldMemOperand(t1, Map::kInstanceTypeOffset));
|
| + Label non_callable, non_function;
|
| + __ JumpIfSmi(a1, &non_callable);
|
| + __ GetObjectType(a1, t1, t2);
|
| __ Jump(masm->isolate()->builtins()->ConstructFunction(),
|
| RelocInfo::CODE_TARGET, eq, t2, Operand(JS_FUNCTION_TYPE));
|
| - __ Jump(masm->isolate()->builtins()->ConstructProxy(), RelocInfo::CODE_TARGET,
|
| - eq, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
| -
|
| - // Called Construct on an exotic Object with a [[Construct]] internal method.
|
| - {
|
| - // Overwrite the original receiver with the (original) target.
|
| - __ dsll(at, a0, kPointerSizeLog2);
|
| - __ daddu(at, sp, at);
|
| - __ sd(a1, MemOperand(at));
|
| - // Let the "call_as_constructor_delegate" take care of the rest.
|
| - __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
|
| - __ Jump(masm->isolate()->builtins()->CallFunction(),
|
| - RelocInfo::CODE_TARGET);
|
| - }
|
| -
|
| - // Called Construct on an Object that doesn't have a [[Construct]] internal
|
| - // method.
|
| - __ bind(&non_constructor);
|
| + __ Branch(&non_function, ne, t2, Operand(JS_FUNCTION_PROXY_TYPE));
|
| +
|
| + // 1. Construct of function proxy.
|
| + // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
|
| + __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
|
| + __ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
|
| +
|
| + // 2. Construct of something that else, which might have a [[Construct]]
|
| + // internal method (if not we raise an exception).
|
| + __ bind(&non_function);
|
| + // Check if target has a [[Call]] internal method.
|
| + // TODO(bmeurer): This shoud use IsConstructor once available.
|
| + __ lbu(t1, FieldMemOperand(t1, Map::kBitFieldOffset));
|
| + __ And(t1, t1, Operand(1 << Map::kIsCallable));
|
| + __ Branch(&non_callable, eq, t1, Operand(zero_reg));
|
| + // Overwrite the original receiver with the (original) target.
|
| + __ dsll(at, a0, kPointerSizeLog2);
|
| + __ daddu(at, sp, at);
|
| + __ sd(a1, MemOperand(at));
|
| + // Let the "call_as_constructor_delegate" take care of the rest.
|
| + __ LoadGlobalFunction(Context::CALL_AS_CONSTRUCTOR_DELEGATE_INDEX, a1);
|
| + __ Jump(masm->isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
|
| +
|
| + // 3. Construct of something that is not callable.
|
| + __ bind(&non_callable);
|
| {
|
| FrameScope scope(masm, StackFrame::INTERNAL);
|
| __ Push(a1);
|
|
|