[crankshaft] Pass new.target to direct function calls.
This changes all direct function calls in Crankshaft to pass undefined via the register expected to hold the new.target value. Note that the register is still ignored by all callees for now. This is a preparatory CL to allows us passing new.target in a register instead of via a side-channel through the construct stub frame. R=bmeurer@chromium.org BUG=v8:4544 LOG=n Review URL: https://codereview.chromium.org/1459183002 Cr-Commit-Position: refs/heads/master@{#32125}
This commit is contained in:
parent
89e859fb2b
commit
e2bce9d392
@ -3415,7 +3415,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
__ ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize r0 to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
|
||||||
__ mov(r0, Operand(arity));
|
__ mov(r0, Operand(arity));
|
||||||
|
|
||||||
// Invoke function.
|
// Invoke function.
|
||||||
@ -3797,11 +3798,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(r1));
|
DCHECK(ToRegister(instr->function()).is(r1));
|
||||||
DCHECK(ToRegister(instr->result()).is(r0));
|
DCHECK(ToRegister(instr->result()).is(r0));
|
||||||
|
|
||||||
__ mov(r0, Operand(instr->arity()));
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
|
__ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ mov(r0, Operand(instr->arity()));
|
||||||
|
|
||||||
// Load the code entry address
|
// Load the code entry address
|
||||||
__ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
__ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
|
||||||
__ Call(ip);
|
__ Call(ip);
|
||||||
|
@ -1979,7 +1979,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ Ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
__ Ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize x0 to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(x3, Heap::kUndefinedValueRootIndex);
|
||||||
__ Mov(arity_reg, arity);
|
__ Mov(arity_reg, arity);
|
||||||
|
|
||||||
// Invoke function.
|
// Invoke function.
|
||||||
@ -2047,11 +2048,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(instr->IsMarkedAsCall());
|
DCHECK(instr->IsMarkedAsCall());
|
||||||
DCHECK(ToRegister(instr->function()).is(x1));
|
DCHECK(ToRegister(instr->function()).is(x1));
|
||||||
|
|
||||||
__ Mov(x0, Operand(instr->arity()));
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset));
|
__ Ldr(cp, FieldMemOperand(x1, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(x3, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ Mov(x0, instr->arity());
|
||||||
|
|
||||||
// Load the code entry address
|
// Load the code entry address
|
||||||
__ Ldr(x10, FieldMemOperand(x1, JSFunction::kCodeEntryOffset));
|
__ Ldr(x10, FieldMemOperand(x1, JSFunction::kCodeEntryOffset));
|
||||||
__ Call(x10);
|
__ Call(x10);
|
||||||
|
@ -3291,7 +3291,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
__ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize eax to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ mov(edx, factory()->undefined_value());
|
||||||
__ mov(eax, arity);
|
__ mov(eax, arity);
|
||||||
|
|
||||||
// Invoke function directly.
|
// Invoke function directly.
|
||||||
@ -3354,11 +3355,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(edi));
|
DCHECK(ToRegister(instr->function()).is(edi));
|
||||||
DCHECK(ToRegister(instr->result()).is(eax));
|
DCHECK(ToRegister(instr->result()).is(eax));
|
||||||
|
|
||||||
__ mov(eax, instr->arity());
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ mov(edx, factory()->undefined_value());
|
||||||
|
__ mov(eax, instr->arity());
|
||||||
|
|
||||||
bool is_self_call = false;
|
bool is_self_call = false;
|
||||||
if (instr->hydrogen()->function()->IsConstant()) {
|
if (instr->hydrogen()->function()->IsConstant()) {
|
||||||
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
||||||
|
@ -3364,7 +3364,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
__ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize a0 to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
|
||||||
__ li(a0, Operand(arity));
|
__ li(a0, Operand(arity));
|
||||||
|
|
||||||
// Invoke function.
|
// Invoke function.
|
||||||
@ -3772,11 +3773,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(a1));
|
DCHECK(ToRegister(instr->function()).is(a1));
|
||||||
DCHECK(ToRegister(instr->result()).is(v0));
|
DCHECK(ToRegister(instr->result()).is(v0));
|
||||||
|
|
||||||
__ li(a0, Operand(instr->arity()));
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
__ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ li(a0, Operand(instr->arity()));
|
||||||
|
|
||||||
// Load the code entry address
|
// Load the code entry address
|
||||||
__ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
|
__ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
|
||||||
__ Call(at);
|
__ Call(at);
|
||||||
|
@ -3533,7 +3533,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
__ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize a0 to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
|
||||||
__ li(a0, Operand(arity));
|
__ li(a0, Operand(arity));
|
||||||
|
|
||||||
// Invoke function.
|
// Invoke function.
|
||||||
@ -3960,11 +3961,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(a1));
|
DCHECK(ToRegister(instr->function()).is(a1));
|
||||||
DCHECK(ToRegister(instr->result()).is(v0));
|
DCHECK(ToRegister(instr->result()).is(v0));
|
||||||
|
|
||||||
__ li(a0, Operand(instr->arity()));
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
__ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(a3, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ li(a0, Operand(instr->arity()));
|
||||||
|
|
||||||
// Load the code entry address
|
// Load the code entry address
|
||||||
__ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
|
__ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
|
||||||
__ Call(at);
|
__ Call(at);
|
||||||
|
@ -3589,7 +3589,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ LoadP(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
__ LoadP(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize r3 to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
|
||||||
__ mov(r3, Operand(arity));
|
__ mov(r3, Operand(arity));
|
||||||
|
|
||||||
bool is_self_call = function.is_identical_to(info()->closure());
|
bool is_self_call = function.is_identical_to(info()->closure());
|
||||||
@ -4003,11 +4004,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(r4));
|
DCHECK(ToRegister(instr->function()).is(r4));
|
||||||
DCHECK(ToRegister(instr->result()).is(r3));
|
DCHECK(ToRegister(instr->result()).is(r3));
|
||||||
|
|
||||||
__ mov(r3, Operand(instr->arity()));
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
|
__ LoadP(cp, FieldMemOperand(r4, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ mov(r3, Operand(instr->arity()));
|
||||||
|
|
||||||
bool is_self_call = false;
|
bool is_self_call = false;
|
||||||
if (instr->hydrogen()->function()->IsConstant()) {
|
if (instr->hydrogen()->function()->IsConstant()) {
|
||||||
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
||||||
|
@ -3368,7 +3368,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
__ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize rax to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
|
||||||
__ Set(rax, arity);
|
__ Set(rax, arity);
|
||||||
|
|
||||||
// Invoke function.
|
// Invoke function.
|
||||||
@ -3432,11 +3433,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(rdi));
|
DCHECK(ToRegister(instr->function()).is(rdi));
|
||||||
DCHECK(ToRegister(instr->result()).is(rax));
|
DCHECK(ToRegister(instr->result()).is(rax));
|
||||||
|
|
||||||
__ Set(rax, instr->arity());
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
__ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ LoadRoot(rdx, Heap::kUndefinedValueRootIndex);
|
||||||
|
__ Set(rax, instr->arity());
|
||||||
|
|
||||||
LPointerMap* pointers = instr->pointer_map();
|
LPointerMap* pointers = instr->pointer_map();
|
||||||
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
|
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
|
||||||
|
|
||||||
|
@ -3562,7 +3562,8 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
|
|||||||
// Change context.
|
// Change context.
|
||||||
__ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
__ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
|
||||||
|
|
||||||
// Always initialize eax to the number of actual arguments.
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ mov(edx, factory()->undefined_value());
|
||||||
__ mov(eax, arity);
|
__ mov(eax, arity);
|
||||||
|
|
||||||
// Invoke function directly.
|
// Invoke function directly.
|
||||||
@ -3625,11 +3626,13 @@ void LCodeGen::DoCallJSFunction(LCallJSFunction* instr) {
|
|||||||
DCHECK(ToRegister(instr->function()).is(edi));
|
DCHECK(ToRegister(instr->function()).is(edi));
|
||||||
DCHECK(ToRegister(instr->result()).is(eax));
|
DCHECK(ToRegister(instr->result()).is(eax));
|
||||||
|
|
||||||
__ mov(eax, instr->arity());
|
|
||||||
|
|
||||||
// Change context.
|
// Change context.
|
||||||
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
__ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
|
||||||
|
|
||||||
|
// Always initialize new target and number of actual arguments.
|
||||||
|
__ mov(edx, factory()->undefined_value());
|
||||||
|
__ mov(eax, instr->arity());
|
||||||
|
|
||||||
bool is_self_call = false;
|
bool is_self_call = false;
|
||||||
if (instr->hydrogen()->function()->IsConstant()) {
|
if (instr->hydrogen()->function()->IsConstant()) {
|
||||||
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
HConstant* fun_const = HConstant::cast(instr->hydrogen()->function());
|
||||||
|
Loading…
Reference in New Issue
Block a user