// r0: number of arguments
// r1: called object
// r5: object type
- Label do_call;
__ bind(&slow);
- __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
- __ b(ne, &non_function_call);
- __ GetBuiltinFunction(
- r1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinFunction(
- r1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- // Set expected number of arguments to zero (not changing r0).
- __ mov(r2, Operand::Zero());
- __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
- RelocInfo::CODE_TARGET);
+ {
+ __ cmp(r5, Operand(JS_FUNCTION_PROXY_TYPE));
+ __ b(ne, &non_function_call);
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ ldr(r1, FieldMemOperand(r1, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ bind(&non_function_call);
+ {
+ // Determine the delegate for the target (if any).
+ FrameAndConstantPoolScope scope(masm, StackFrame::INTERNAL);
+ __ SmiTag(r0);
+ __ Push(r0, r1);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ mov(r1, r0);
+ __ Pop(r0);
+ __ SmiUntag(r0);
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(r1);
+ __ Jump(masm->isolate()->builtins()->CallFunction(),
+ RelocInfo::CODE_TARGET);
+ }
}
__ Add(cons_stub_code, cons_stub, Code::kHeaderSize - kHeapObjectTag);
__ Br(cons_stub_code);
- Label do_call;
__ Bind(&slow);
- __ Cmp(object_type, JS_FUNCTION_PROXY_TYPE);
- __ B(ne, &non_function_call);
- __ GetBuiltinFunction(
- x1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ B(&do_call);
-
- __ Bind(&non_function_call);
- __ GetBuiltinFunction(
- x1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
-
- __ Bind(&do_call);
- // Set expected number of arguments to zero (not changing x0).
- __ Mov(x2, 0);
- __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(),
- RelocInfo::CODE_TARGET);
+ {
+ __ Cmp(object_type, JS_FUNCTION_PROXY_TYPE);
+ __ B(ne, &non_function_call);
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ Ldr(x1, FieldMemOperand(x1, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ Bind(&non_function_call);
+ {
+ // Determine the delegate for the target (if any).
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ SmiTag(x0);
+ __ Push(x0, x1);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ Mov(x1, x0);
+ __ Pop(x0);
+ __ SmiUntag(x0);
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(x1);
+ __ Jump(masm->isolate()->builtins()->CallFunction(),
+ RelocInfo::CODE_TARGET);
+ }
}
#define NATIVE_CONTEXT_JS_BUILTINS(V) \
V(APPLY_PREPARE_BUILTIN_INDEX, JSFunction, apply_prepare_builtin) \
- V(CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX, JSFunction, \
- call_function_proxy_as_constructor_builtin) \
- V(CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX, JSFunction, \
- call_non_function_as_constructor_builtin) \
V(COMPARE_BUILTIN_INDEX, JSFunction, compare_builtin) \
V(COMPARE_STRONG_BUILTIN_INDEX, JSFunction, compare_strong_builtin) \
V(CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, JSFunction, \
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(r0);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(r0);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- context()->Plug(result_register());
+ context()->DropAndPlug(1, r0);
}
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(x0);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(x0);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- context()->Plug(result_register());
+ context()->DropAndPlug(1, x0);
}
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
context()->Plug(eax);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
context()->Plug(eax);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
- context()->Plug(eax);
+ context()->DropAndPlug(1, eax);
}
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(v0);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(v0);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- context()->Plug(result_register());
+ context()->DropAndPlug(1, result_register());
}
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(v0);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
context()->Plug(v0);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ ld(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
- context()->Plug(result_register());
+ context()->DropAndPlug(1, result_register());
}
CallConstructStub stub(isolate(), RECORD_CONSTRUCTOR_TARGET);
__ Call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
PrepareForBailoutForId(expr->ReturnId(), TOS_REG);
+ // Restore context register.
+ __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
context()->Plug(rax);
}
RecordJSReturnSite(expr);
+ // Restore context register.
+ __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
+
context()->Plug(rax);
}
CallConstructStub stub(isolate(), SUPER_CONSTRUCTOR_CALL);
__ call(stub.GetCode(), RelocInfo::CONSTRUCT_CALL);
- __ Drop(1);
+ // Restore context register.
+ __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
- context()->Plug(result_register());
+ context()->DropAndPlug(1, rax);
}
// eax: number of arguments
// ecx: object map
// esp[0]: original receiver (for IsSuperConstructorCall)
- Label do_call;
__ bind(&slow);
- __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
- __ j(not_equal, &non_function_call);
- __ GetBuiltinEntry(edx,
- Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinEntry(edx,
- Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- if (IsSuperConstructorCall()) {
- __ Drop(1);
+ {
+ __ CmpInstanceType(ecx, JS_FUNCTION_PROXY_TYPE);
+ __ j(not_equal, &non_function_call, Label::kNear);
+ if (IsSuperConstructorCall()) __ Drop(1);
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ mov(edi, FieldOperand(edi, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ bind(&non_function_call);
+ if (IsSuperConstructorCall()) __ Drop(1);
+ {
+ // Determine the delegate for the target (if any).
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ SmiTag(eax);
+ __ Push(eax);
+ __ Push(edi);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ mov(edi, eax);
+ __ Pop(eax);
+ __ SmiUntag(eax);
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(edi);
+ __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
}
- // Set expected number of arguments to zero (not changing eax).
- __ Move(ebx, Immediate(0));
- Handle<Code> arguments_adaptor =
- isolate()->builtins()->ArgumentsAdaptorTrampoline();
- __ jmp(arguments_adaptor, RelocInfo::CODE_TARGET);
}
// a0: number of arguments
// a1: called object
// t1: object type
- Label do_call;
__ bind(&slow);
- __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE));
- __ GetBuiltinFunction(
- a1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinFunction(
- a1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- // Set expected number of arguments to zero (not changing r0).
- __ li(a2, Operand(0, RelocInfo::NONE32));
- __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
- RelocInfo::CODE_TARGET);
+ {
+ __ Branch(&non_function_call, ne, t1, Operand(JS_FUNCTION_PROXY_TYPE));
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ lw(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ bind(&non_function_call);
+ {
+ // Determine the delegate for the target (if any).
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ sll(a0, a0, kSmiTagSize); // Smi tagged.
+ __ Push(a0, a1);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ mov(a1, v0);
+ __ Pop(a0);
+ __ sra(a0, a0, kSmiTagSize); // Un-tag.
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(a1);
+ __ Jump(masm->isolate()->builtins()->CallFunction(),
+ RelocInfo::CODE_TARGET);
+ }
}
// a0: number of arguments
// a1: called object
// a5: object type
- Label do_call;
__ bind(&slow);
- __ Branch(&non_function_call, ne, a5, Operand(JS_FUNCTION_PROXY_TYPE));
- __ GetBuiltinFunction(
- a1, Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinFunction(
- a1, Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- // Set expected number of arguments to zero (not changing r0).
- __ li(a2, Operand(0, RelocInfo::NONE32));
- __ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
- RelocInfo::CODE_TARGET);
+ {
+ __ Branch(&non_function_call, ne, a5, Operand(JS_FUNCTION_PROXY_TYPE));
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ ld(a1, FieldMemOperand(a1, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ bind(&non_function_call);
+ {
+ // Determine the delegate for the target (if any).
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ SmiTag(a0);
+ __ Push(a0, a1);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ mov(a1, v0);
+ __ Pop(a0);
+ __ SmiUntag(a0);
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(a1);
+ __ Jump(masm->isolate()->builtins()->CallFunction(),
+ RelocInfo::CODE_TARGET);
+ }
}
-----------------------------
*/
-function CALL_NON_FUNCTION_AS_CONSTRUCTOR() {
- var delegate = %GetConstructorDelegate(this);
- return %Apply(delegate, this, arguments, 0, %_ArgumentsLength());
-}
-
-
-function CALL_FUNCTION_PROXY_AS_CONSTRUCTOR () {
- var proxy = this;
- var trap = %GetConstructTrap(proxy);
- return %Apply(trap, this, arguments, 0, %_ArgumentsLength());
-}
-
-
function APPLY_PREPARE(args) {
var length;
%InstallToContext([
"apply_prepare_builtin", APPLY_PREPARE,
- "call_function_proxy_as_constructor_builtin", CALL_FUNCTION_PROXY_AS_CONSTRUCTOR,
- "call_non_function_as_constructor_builtin", CALL_NON_FUNCTION_AS_CONSTRUCTOR,
"compare_builtin", COMPARE,
"compare_strong_builtin", COMPARE_STRONG,
"concat_iterable_to_array_builtin", CONCAT_ITERABLE_TO_ARRAY,
// rdi: called object
// rax: number of arguments
// r11: object map
- Label do_call;
__ bind(&slow);
- __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE);
- __ j(not_equal, &non_function_call);
- __ GetBuiltinEntry(rdx,
- Context::CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ jmp(&do_call);
-
- __ bind(&non_function_call);
- __ GetBuiltinEntry(rdx,
- Context::CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX);
- __ bind(&do_call);
- // Set expected number of arguments to zero (not changing rax).
- __ Set(rbx, 0);
- __ Jump(isolate()->builtins()->ArgumentsAdaptorTrampoline(),
- RelocInfo::CODE_TARGET);
+ {
+ __ CmpInstanceType(r11, JS_FUNCTION_PROXY_TYPE);
+ __ j(not_equal, &non_function_call, Label::kNear);
+
+ // TODO(neis): This doesn't match the ES6 spec for [[Construct]] on proxies.
+ __ movp(rdi, FieldOperand(rdi, JSFunctionProxy::kConstructTrapOffset));
+ __ Jump(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
+
+ __ bind(&non_function_call);
+ {
+ // Determine the delegate for the target (if any).
+ FrameScope scope(masm, StackFrame::INTERNAL);
+ __ Integer32ToSmi(rax, rax);
+ __ Push(rax);
+ __ Push(rdi);
+ __ CallRuntime(Runtime::kGetConstructorDelegate, 1);
+ __ movp(rdi, rax);
+ __ Pop(rax);
+ __ SmiToInteger32(rax, rax);
+ }
+ // The delegate is always a regular function.
+ __ AssertFunction(rdi);
+ __ Jump(isolate()->builtins()->CallFunction(), RelocInfo::CODE_TARGET);
+ }
}