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