Commit a45f50a1 authored by plind44@gmail.com's avatar plind44@gmail.com

MIPS: Remove CALL_AS_FUNCTION and CALL_AS_METHOD.

Port r18590 (566a7fd)

BUG=
R=plind44@gmail.com

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

Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18599 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ca9ee7b5
......@@ -303,11 +303,11 @@ static void CallRuntimePassFunction(
FrameScope scope(masm, StackFrame::INTERNAL);
// Push a copy of the function onto the stack.
// Push call kind information and function as parameter to the runtime call.
__ Push(a1, t1, a1);
__ Push(a1, a1);
__ CallRuntime(function_id, 1);
// Restore call kind information and receiver.
__ Pop(a1, t1);
__ Pop(a1);
}
......@@ -631,11 +631,10 @@ static void Generate_JSConstructStubHelper(MacroAssembler* masm,
masm->isolate()->builtins()->HandleApiCallConstruct();
ParameterCount expected(0);
__ InvokeCode(code, expected, expected,
RelocInfo::CODE_TARGET, CALL_FUNCTION, CALL_AS_METHOD);
RelocInfo::CODE_TARGET, CALL_FUNCTION);
} else {
ParameterCount actual(a0);
__ InvokeFunction(a1, actual, CALL_FUNCTION,
NullCallWrapper(), CALL_AS_METHOD);
__ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper());
}
// Store offset of return address for deoptimizer.
......@@ -768,8 +767,7 @@ static void Generate_JSEntryTrampolineHelper(MacroAssembler* masm,
__ CallStub(&stub);
} else {
ParameterCount actual(a0);
__ InvokeFunction(a1, actual, CALL_FUNCTION,
NullCallWrapper(), CALL_AS_METHOD);
__ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper());
}
// Leave internal frame.
......@@ -795,18 +793,17 @@ void Builtins::Generate_CompileUnoptimized(MacroAssembler* masm) {
}
static void CallCompileOptimized(MacroAssembler* masm,
bool concurrent) {
static void CallCompileOptimized(MacroAssembler* masm, bool concurrent) {
FrameScope scope(masm, StackFrame::INTERNAL);
// Push a copy of the function onto the stack.
// Push call kind information and function as parameter to the runtime call.
__ Push(a1, t1, a1);
// Push function as parameter to the runtime call.
__ Push(a1, a1);
// Whether to compile in a background thread.
__ Push(masm->isolate()->factory()->ToBoolean(concurrent));
__ CallRuntime(Runtime::kCompileOptimized, 2);
// Restore call kind information and receiver.
__ Pop(a1, t1);
// Restore receiver.
__ Pop(a1);
}
......@@ -1177,7 +1174,6 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
__ Branch(&function, eq, t0, Operand(zero_reg));
// Expected number of arguments is 0 for CALL_NON_FUNCTION.
__ mov(a2, zero_reg);
__ SetCallKind(t1, CALL_AS_METHOD);
__ Branch(&non_proxy, ne, t0, Operand(1));
__ push(a1); // Re-add proxy object as additional argument.
......@@ -1203,14 +1199,12 @@ void Builtins::Generate_FunctionCall(MacroAssembler* masm) {
FieldMemOperand(a3, SharedFunctionInfo::kFormalParameterCountOffset));
__ sra(a2, a2, kSmiTagSize);
__ lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
__ SetCallKind(t1, CALL_AS_FUNCTION);
// Check formal and actual parameter counts.
__ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
RelocInfo::CODE_TARGET, ne, a2, Operand(a0));
ParameterCount expected(0);
__ InvokeCode(a3, expected, expected, JUMP_FUNCTION,
NullCallWrapper(), CALL_AS_FUNCTION);
__ InvokeCode(a3, expected, expected, JUMP_FUNCTION, NullCallWrapper());
}
......@@ -1347,8 +1341,7 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
__ GetObjectType(a1, a2, a2);
__ Branch(&call_proxy, ne, a2, Operand(JS_FUNCTION_TYPE));
__ InvokeFunction(a1, actual, CALL_FUNCTION,
NullCallWrapper(), CALL_AS_FUNCTION);
__ InvokeFunction(a1, actual, CALL_FUNCTION, NullCallWrapper());
frame_scope.GenerateLeaveFrame();
__ Ret(USE_DELAY_SLOT);
......@@ -1359,7 +1352,6 @@ void Builtins::Generate_FunctionApply(MacroAssembler* masm) {
__ push(a1); // Add function proxy as last argument.
__ Addu(a0, a0, Operand(1));
__ li(a2, Operand(0, RelocInfo::NONE32));
__ SetCallKind(t1, CALL_AS_FUNCTION);
__ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
__ Call(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
RelocInfo::CODE_TARGET);
......@@ -1404,7 +1396,6 @@ void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// -- a1: function (passed through to callee)
// -- a2: expected arguments count
// -- a3: callee code entry
// -- t1: call kind information
// -----------------------------------
Label invoke, dont_adapt_arguments;
......
......@@ -3344,11 +3344,7 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
// a1: pushed function
ParameterCount actual(argc_);
__ InvokeFunction(a1,
actual,
JUMP_FUNCTION,
NullCallWrapper(),
CALL_AS_FUNCTION);
__ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper());
// Slow-case: Non-function called.
__ bind(&slow);
......@@ -3367,7 +3363,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
__ li(a0, Operand(argc_ + 1, RelocInfo::NONE32));
__ li(a2, Operand(0, RelocInfo::NONE32));
__ GetBuiltinEntry(a3, Builtins::CALL_FUNCTION_PROXY);
__ SetCallKind(t1, CALL_AS_FUNCTION);
{
Handle<Code> adaptor =
masm->isolate()->builtins()->ArgumentsAdaptorTrampoline();
......@@ -3381,7 +3376,6 @@ void CallFunctionStub::Generate(MacroAssembler* masm) {
__ li(a0, Operand(argc_)); // Set up the number of arguments.
__ mov(a2, zero_reg);
__ GetBuiltinEntry(a3, Builtins::CALL_NON_FUNCTION);
__ SetCallKind(t1, CALL_AS_FUNCTION);
__ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
RelocInfo::CODE_TARGET);
}
......@@ -3425,7 +3419,6 @@ void CallConstructStub::Generate(MacroAssembler* masm) {
__ bind(&do_call);
// Set expected number of arguments to zero (not changing r0).
__ li(a2, Operand(0, RelocInfo::NONE32));
__ SetCallKind(t1, CALL_AS_METHOD);
__ Jump(masm->isolate()->builtins()->ArgumentsAdaptorTrampoline(),
RelocInfo::CODE_TARGET);
}
......@@ -5608,8 +5601,7 @@ void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) {
__ Subu(a0, a0, 1);
masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
ParameterCount argument_count(a0);
__ InvokeFunction(
a1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
__ InvokeFunction(a1, argument_count, JUMP_FUNCTION, NullCallWrapper());
}
......
......@@ -157,7 +157,6 @@ void FullCodeGenerator::Generate() {
// object).
if (info->is_classic_mode() && !info->is_native()) {
Label ok;
__ Branch(&ok, eq, t1, Operand(zero_reg));
int receiver_offset = info->scope()->num_parameters() * kPointerSize;
__ lw(at, MemOperand(sp, receiver_offset));
__ LoadRoot(a2, Heap::kUndefinedValueRootIndex);
......@@ -3801,8 +3800,7 @@ void FullCodeGenerator::EmitCallFunction(CallRuntime* expr) {
// InvokeFunction requires the function in a1. Move it in there.
__ mov(a1, result_register());
ParameterCount count(arg_count);
__ InvokeFunction(a1, count, CALL_FUNCTION,
NullCallWrapper(), CALL_AS_FUNCTION);
__ InvokeFunction(a1, count, CALL_FUNCTION, NullCallWrapper());
__ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
__ jmp(&done);
......
......@@ -417,8 +417,7 @@ static void GenerateFunctionTailCall(MacroAssembler* masm,
// Invoke the function.
ParameterCount actual(argc);
__ InvokeFunction(a1, actual, JUMP_FUNCTION,
NullCallWrapper(), CALL_AS_METHOD);
__ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper());
}
......@@ -498,15 +497,8 @@ void CallICBase::GenerateMiss(MacroAssembler* masm,
__ bind(&invoke);
}
// Invoke the function.
CallKind call_kind = CallICBase::Contextual::decode(extra_state)
? CALL_AS_FUNCTION
: CALL_AS_METHOD;
ParameterCount actual(argc);
__ InvokeFunction(a1,
actual,
JUMP_FUNCTION,
NullCallWrapper(),
call_kind);
__ InvokeFunction(a1, actual, JUMP_FUNCTION, NullCallWrapper());
}
......
// Copyright 2012 the V8 project authors. All rights reserved.
// Copyright 2012 the V8 project authors. All rights reserved.7
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
......@@ -153,8 +153,6 @@ bool LCodeGen::GeneratePrologue() {
info_->is_classic_mode() &&
!info_->is_native()) {
Label ok;
__ Branch(&ok, eq, t1, Operand(zero_reg));
int receiver_offset = info_->scope()->num_parameters() * kPointerSize;
__ LoadRoot(at, Heap::kUndefinedValueRootIndex);
__ lw(a2, MemOperand(sp, receiver_offset));
......@@ -3441,8 +3439,7 @@ void LCodeGen::DoApplyArguments(LApplyArguments* instr) {
// The number of arguments is stored in receiver which is a0, as expected
// by InvokeFunction.
ParameterCount actual(receiver);
__ InvokeFunction(function, actual, CALL_FUNCTION,
safepoint_generator, CALL_AS_FUNCTION);
__ InvokeFunction(function, actual, CALL_FUNCTION, safepoint_generator);
}
......@@ -3516,7 +3513,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
int formal_parameter_count,
int arity,
LInstruction* instr,
CallKind call_kind,
A1State a1_state) {
bool dont_adapt_arguments =
formal_parameter_count == SharedFunctionInfo::kDontAdaptArgumentsSentinel;
......@@ -3540,7 +3536,6 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
}
// Invoke function.
__ SetCallKind(t1, call_kind);
__ lw(at, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
__ Call(at);
......@@ -3550,8 +3545,7 @@ void LCodeGen::CallKnownFunction(Handle<JSFunction> function,
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(arity);
ParameterCount expected(formal_parameter_count);
__ InvokeFunction(
function, expected, count, CALL_FUNCTION, generator, call_kind);
__ InvokeFunction(function, expected, count, CALL_FUNCTION, generator);
}
}
......@@ -3563,7 +3557,6 @@ void LCodeGen::DoCallConstantFunction(LCallConstantFunction* instr) {
instr->hydrogen()->formal_parameter_count(),
instr->arity(),
instr,
CALL_AS_FUNCTION,
A1_UNINITIALIZED);
}
......@@ -3886,13 +3879,12 @@ void LCodeGen::DoInvokeFunction(LInvokeFunction* instr) {
LPointerMap* pointers = instr->pointer_map();
SafepointGenerator generator(this, pointers, Safepoint::kLazyDeopt);
ParameterCount count(instr->arity());
__ InvokeFunction(a1, count, CALL_FUNCTION, generator, CALL_AS_FUNCTION);
__ InvokeFunction(a1, count, CALL_FUNCTION, generator);
} else {
CallKnownFunction(known_function,
instr->hydrogen()->formal_parameter_count(),
instr->arity(),
instr,
CALL_AS_FUNCTION,
A1_CONTAINS_TARGET);
}
}
......@@ -3955,7 +3947,6 @@ void LCodeGen::DoCallKnownGlobal(LCallKnownGlobal* instr) {
instr->hydrogen()->formal_parameter_count(),
instr->arity(),
instr,
CALL_AS_FUNCTION,
A1_UNINITIALIZED);
}
......
......@@ -242,7 +242,6 @@ class LCodeGen: public LCodeGenBase {
int formal_parameter_count,
int arity,
LInstruction* instr,
CallKind call_kind,
A1State a1_state);
void RecordSafepointWithLazyDeopt(LInstruction* instr,
......
......@@ -3571,20 +3571,6 @@ void MacroAssembler::MovToFloatParameters(DoubleRegister src1,
}
void MacroAssembler::SetCallKind(Register dst, CallKind call_kind) {
// This macro takes the dst register to make the code more readable
// at the call sites. However, the dst register has to be t1 to
// follow the calling convention which requires the call type to be
// in t1.
ASSERT(dst.is(t1));
if (call_kind == CALL_AS_FUNCTION) {
li(dst, Operand(Smi::FromInt(1)));
} else {
li(dst, Operand(Smi::FromInt(0)));
}
}
// -----------------------------------------------------------------------------
// JavaScript invokes.
......@@ -3595,8 +3581,7 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
Label* done,
bool* definitely_mismatches,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind) {
const CallWrapper& call_wrapper) {
bool definitely_matches = false;
*definitely_mismatches = false;
Label regular_invoke;
......@@ -3650,14 +3635,12 @@ void MacroAssembler::InvokePrologue(const ParameterCount& expected,
isolate()->builtins()->ArgumentsAdaptorTrampoline();
if (flag == CALL_FUNCTION) {
call_wrapper.BeforeCall(CallSize(adaptor));
SetCallKind(t1, call_kind);
Call(adaptor);
call_wrapper.AfterCall();
if (!*definitely_mismatches) {
Branch(done);
}
} else {
SetCallKind(t1, call_kind);
Jump(adaptor, RelocInfo::CODE_TARGET);
}
bind(&regular_invoke);
......@@ -3669,8 +3652,7 @@ void MacroAssembler::InvokeCode(Register code,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind) {
const CallWrapper& call_wrapper) {
// You can't call a function without a valid frame.
ASSERT(flag == JUMP_FUNCTION || has_frame());
......@@ -3679,16 +3661,14 @@ void MacroAssembler::InvokeCode(Register code,
bool definitely_mismatches = false;
InvokePrologue(expected, actual, Handle<Code>::null(), code,
&done, &definitely_mismatches, flag,
call_wrapper, call_kind);
call_wrapper);
if (!definitely_mismatches) {
if (flag == CALL_FUNCTION) {
call_wrapper.BeforeCall(CallSize(code));
SetCallKind(t1, call_kind);
Call(code);
call_wrapper.AfterCall();
} else {
ASSERT(flag == JUMP_FUNCTION);
SetCallKind(t1, call_kind);
Jump(code);
}
// Continue here if InvokePrologue does handle the invocation due to
......@@ -3702,8 +3682,7 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
const ParameterCount& expected,
const ParameterCount& actual,
RelocInfo::Mode rmode,
InvokeFlag flag,
CallKind call_kind) {
InvokeFlag flag) {
// You can't call a function without a valid frame.
ASSERT(flag == JUMP_FUNCTION || has_frame());
......@@ -3712,13 +3691,11 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
bool definitely_mismatches = false;
InvokePrologue(expected, actual, code, no_reg,
&done, &definitely_mismatches, flag,
NullCallWrapper(), call_kind);
NullCallWrapper());
if (!definitely_mismatches) {
if (flag == CALL_FUNCTION) {
SetCallKind(t1, call_kind);
Call(code, rmode);
} else {
SetCallKind(t1, call_kind);
Jump(code, rmode);
}
// Continue here if InvokePrologue does handle the invocation due to
......@@ -3731,8 +3708,7 @@ void MacroAssembler::InvokeCode(Handle<Code> code,
void MacroAssembler::InvokeFunction(Register function,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind) {
const CallWrapper& call_wrapper) {
// You can't call a function without a valid frame.
ASSERT(flag == JUMP_FUNCTION || has_frame());
......@@ -3750,7 +3726,7 @@ void MacroAssembler::InvokeFunction(Register function,
lw(code_reg, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
ParameterCount expected(expected_reg);
InvokeCode(code_reg, expected, actual, flag, call_wrapper, call_kind);
InvokeCode(code_reg, expected, actual, flag, call_wrapper);
}
......@@ -3758,8 +3734,7 @@ void MacroAssembler::InvokeFunction(Register function,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind) {
const CallWrapper& call_wrapper) {
// You can't call a function without a valid frame.
ASSERT(flag == JUMP_FUNCTION || has_frame());
......@@ -3773,7 +3748,7 @@ void MacroAssembler::InvokeFunction(Register function,
// allow recompilation to take effect without changing any of the
// call sites.
lw(a3, FieldMemOperand(a1, JSFunction::kCodeEntryOffset));
InvokeCode(a3, expected, actual, flag, call_wrapper, call_kind);
InvokeCode(a3, expected, actual, flag, call_wrapper);
}
......@@ -3781,10 +3756,9 @@ void MacroAssembler::InvokeFunction(Handle<JSFunction> function,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind) {
const CallWrapper& call_wrapper) {
li(a1, function);
InvokeFunction(a1, expected, actual, flag, call_wrapper, call_kind);
InvokeFunction(a1, expected, actual, flag, call_wrapper);
}
......@@ -4291,12 +4265,10 @@ void MacroAssembler::InvokeBuiltin(Builtins::JavaScript id,
GetBuiltinEntry(t9, id);
if (flag == CALL_FUNCTION) {
call_wrapper.BeforeCall(CallSize(t9));
SetCallKind(t1, CALL_AS_METHOD);
Call(t9);
call_wrapper.AfterCall();
} else {
ASSERT(flag == JUMP_FUNCTION);
SetCallKind(t1, CALL_AS_METHOD);
Jump(t9);
}
}
......
......@@ -894,47 +894,37 @@ class MacroAssembler: public Assembler {
// -------------------------------------------------------------------------
// JavaScript invokes.
// Set up call kind marking in t1. The method takes t1 as an
// explicit first parameter to make the code more readable at the
// call sites.
void SetCallKind(Register dst, CallKind kind);
// Invoke the JavaScript function code by either calling or jumping.
void InvokeCode(Register code,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind);
const CallWrapper& call_wrapper);
void InvokeCode(Handle<Code> code,
const ParameterCount& expected,
const ParameterCount& actual,
RelocInfo::Mode rmode,
InvokeFlag flag,
CallKind call_kind);
InvokeFlag flag);
// Invoke the JavaScript function in the given register. Changes the
// current context to the context in the function before invoking.
void InvokeFunction(Register function,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind);
const CallWrapper& call_wrapper);
void InvokeFunction(Register function,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind);
const CallWrapper& call_wrapper);
void InvokeFunction(Handle<JSFunction> function,
const ParameterCount& expected,
const ParameterCount& actual,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind);
const CallWrapper& call_wrapper);
void IsObjectJSObjectType(Register heap_object,
......@@ -1616,8 +1606,7 @@ const Operand& rt = Operand(zero_reg), BranchDelaySlot bd = PROTECT
Label* done,
bool* definitely_mismatches,
InvokeFlag flag,
const CallWrapper& call_wrapper,
CallKind call_kind);
const CallWrapper& call_wrapper);
// Get the code for the given builtin. Returns if able to resolve
// the function in the 'resolved' flag.
......
......@@ -2443,8 +2443,7 @@ void CallStubCompiler::GenerateJumpFunction(Handle<Object> object,
PatchImplicitReceiver(object);
// Invoke the function.
__ InvokeFunction(a1, arguments(), JUMP_FUNCTION,
NullCallWrapper(), call_kind());
__ InvokeFunction(a1, arguments(), JUMP_FUNCTION, NullCallWrapper());
}
......@@ -2581,7 +2580,7 @@ void StoreStubCompiler::GenerateStoreViaSetter(
ParameterCount actual(1);
ParameterCount expected(setter);
__ InvokeFunction(setter, expected, actual,
CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
......@@ -2713,7 +2712,7 @@ void LoadStubCompiler::GenerateLoadViaGetter(MacroAssembler* masm,
ParameterCount actual(0);
ParameterCount expected(getter);
__ InvokeFunction(getter, expected, actual,
CALL_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
CALL_FUNCTION, NullCallWrapper());
} else {
// If we generate a global code snippet for deoptimization only, remember
// the place to continue after deoptimization.
......
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