void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- R1State r1_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
+ Register function_reg = r1;
+
LPointerMap* pointers = instr->pointer_map();
if (can_invoke_directly) {
- if (r1_state == R1_UNINITIALIZED) {
- __ Move(r1, function);
- }
-
// Change context.
- __ ldr(cp, FieldMemOperand(r1, JSFunction::kContextOffset));
+ __ ldr(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
// Set r0 to arguments count if adaption is not needed. Assumes that r0
// is available to write to at this point.
}
// Invoke function.
- __ ldr(ip, FieldMemOperand(r1, JSFunction::kCodeEntryOffset));
+ __ ldr(ip, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset));
__ Call(ip);
// Set up deoptimization.
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- R1_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
LInstruction* instr,
LOperand* context);
- enum R1State {
- R1_UNINITIALIZED,
- R1_CONTAINS_TARGET
- };
-
// Generate a direct call to a known function. Expects the function
// to be in r1.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- R1State r1_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode);
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- Register function_reg) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
// The function interface relies on the following register assignments.
- DCHECK(function_reg.Is(x1) || function_reg.IsNone());
+ Register function_reg = x1;
Register arity_reg = x0;
LPointerMap* pointers = instr->pointer_map();
- // If necessary, load the function object.
- if (function_reg.IsNone()) {
- function_reg = x1;
- __ LoadObject(function_reg, function);
- }
-
if (FLAG_debug_code) {
Label is_not_smi;
// Try to confirm that function_reg (x1) is a tagged pointer.
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- x1);
+ instr->arity(), instr);
}
after_push_argument_ = false;
}
LInstruction* instr,
LOperand* context);
- // Generate a direct call to a known function.
- // If the function is already loaded into x1 by the caller, function_reg may
- // be set to x1. Otherwise, it must be NoReg, and CallKnownFunction will
- // automatically load it.
+ // Generate a direct call to a known function. Expects the function
+ // to be in x1.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- Register function_reg = NoReg);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
// Support for recording safepoint and position information.
void RecordAndWritePosition(int position) OVERRIDE;
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- EDIState edi_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
- if (can_invoke_directly) {
- if (edi_state == EDI_UNINITIALIZED) {
- __ LoadHeapObject(edi, function);
- }
+ Register function_reg = edi;
+ if (can_invoke_directly) {
// Change context.
- __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
+ __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
// Set eax to arguments count if adaption is not needed. Assumes that eax
// is available to write to at this point.
if (function.is_identical_to(info()->closure())) {
__ CallSelf();
} else {
- __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
+ __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
}
RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
} else {
this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- EDI_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
void LoadContextFromDeferred(LOperand* context);
- enum EDIState {
- EDI_UNINITIALIZED,
- EDI_CONTAINS_TARGET
- };
-
- // Generate a direct call to a known function. Expects the function
+ // Generate a direct call to a known function. Expects the function
// to be in edi.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- EDIState edi_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode);
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- A1State a1_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
+ Register function_reg = a1;
LPointerMap* pointers = instr->pointer_map();
if (can_invoke_directly) {
- if (a1_state == A1_UNINITIALIZED) {
- __ li(a1, function);
- }
-
// Change context.
- __ lw(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
+ __ lw(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
// Set r0 to arguments count if adaption is not needed. Assumes that r0
// is available to write to at this point.
}
// Invoke function.
- __ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
+ __ lw(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset));
__ Call(at);
// Set up deoptimization.
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- A1_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
LInstruction* instr,
LOperand* context);
- enum A1State {
- A1_UNINITIALIZED,
- A1_CONTAINS_TARGET
- };
-
// Generate a direct call to a known function. Expects the function
// to be in a1.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- A1State a1_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode);
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- A1State a1_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
+ Register function_reg = a1;
LPointerMap* pointers = instr->pointer_map();
if (can_invoke_directly) {
- if (a1_state == A1_UNINITIALIZED) {
- __ li(a1, function);
- }
-
// Change context.
- __ ld(cp, FieldMemOperand(a1, JSFunction::kContextOffset));
+ __ ld(cp, FieldMemOperand(function_reg, JSFunction::kContextOffset));
// Set r0 to arguments count if adaption is not needed. Assumes that r0
// is available to write to at this point.
}
// Invoke function.
- __ ld(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
+ __ ld(at, FieldMemOperand(function_reg, JSFunction::kCodeEntryOffset));
__ Call(at);
// Set up deoptimization.
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- A1_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
LInstruction* instr,
LOperand* context);
- enum A1State {
- A1_UNINITIALIZED,
- A1_CONTAINS_TARGET
- };
-
// Generate a direct call to a known function. Expects the function
// to be in a1.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- A1State a1_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode);
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- RDIState rdi_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
+ Register function_reg = rdi;
LPointerMap* pointers = instr->pointer_map();
if (can_invoke_directly) {
- if (rdi_state == RDI_UNINITIALIZED) {
- __ Move(rdi, function);
- }
-
// Change context.
- __ movp(rsi, FieldOperand(rdi, JSFunction::kContextOffset));
+ __ movp(rsi, FieldOperand(function_reg, JSFunction::kContextOffset));
// Set rax to arguments count if adaption is not needed. Assumes that rax
// is available to write to at this point.
if (function.is_identical_to(info()->closure())) {
__ CallSelf();
} else {
- __ Call(FieldOperand(rdi, JSFunction::kCodeEntryOffset));
+ __ Call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
}
// Set up deoptimization.
this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- RDI_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
void LoadContextFromDeferred(LOperand* context);
- enum RDIState {
- RDI_UNINITIALIZED,
- RDI_CONTAINS_TARGET
- };
-
// Generate a direct call to a known function. Expects the function
// to be in rdi.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- RDIState rdi_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode,
void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- EDIState edi_state) {
+ int formal_parameter_count, int arity,
+ LInstruction* instr) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
bool can_invoke_directly =
dont_adapt_arguments || formal_parameter_count == arity;
- if (can_invoke_directly) {
- if (edi_state == EDI_UNINITIALIZED) {
- __ LoadHeapObject(edi, function);
- }
+ Register function_reg = edi;
+ if (can_invoke_directly) {
// Change context.
- __ mov(esi, FieldOperand(edi, JSFunction::kContextOffset));
+ __ mov(esi, FieldOperand(function_reg, JSFunction::kContextOffset));
// Set eax to arguments count if adaption is not needed. Assumes that eax
// is available to write to at this point.
if (function.is_identical_to(info()->closure())) {
__ CallSelf();
} else {
- __ call(FieldOperand(edi, JSFunction::kCodeEntryOffset));
+ __ call(FieldOperand(function_reg, JSFunction::kCodeEntryOffset));
}
RecordSafepointWithLazyDeopt(instr, RECORD_SIMPLE_SAFEPOINT);
} else {
this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
- __ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
+ __ InvokeFunction(function_reg, expected, count, CALL_FUNCTION, generator);
}
}
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
- instr->arity(),
- instr,
- EDI_CONTAINS_TARGET);
+ instr->arity(), instr);
}
}
void LoadContextFromDeferred(LOperand* context);
- enum EDIState {
- EDI_UNINITIALIZED,
- EDI_CONTAINS_TARGET
- };
-
// Generate a direct call to a known function. Expects the function
// to be in edi.
void CallKnownFunction(Handle<JSFunction> function,
- int formal_parameter_count,
- int arity,
- LInstruction* instr,
- EDIState edi_state);
+ int formal_parameter_count, int arity,
+ LInstruction* instr);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
SafepointMode safepoint_mode);