MIPS: Reland and fix "Add support for keyed-call on arrays of fast elements”.

Port r17782 (32e3232)

BUG=
R=plind44@gmail.com

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

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@17802 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
plind44@gmail.com 2013-11-15 17:34:34 +00:00
parent c9b41c6995
commit e9bfe9bc72
3 changed files with 62 additions and 5 deletions

View File

@ -134,6 +134,19 @@ void KeyedLoadFieldStub::InitializeInterfaceDescriptor(
}
void KeyedArrayCallStub::InitializeInterfaceDescriptor(
Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) {
static Register registers[] = { a2 };
descriptor->register_param_count_ = 1;
descriptor->register_params_ = registers;
descriptor->continuation_type_ = TAIL_CALL_CONTINUATION;
descriptor->handler_arguments_mode_ = PASS_ARGUMENTS;
descriptor->deoptimization_handler_ =
FUNCTION_ADDR(KeyedCallIC_MissFromStubFailure);
}
void KeyedStoreFastElementStub::InitializeInterfaceDescriptor(
Isolate* isolate,
CodeStubInterfaceDescriptor* descriptor) {
@ -5854,6 +5867,24 @@ void StubFailureTrampolineStub::Generate(MacroAssembler* masm) {
}
void StubFailureTailCallTrampolineStub::Generate(MacroAssembler* masm) {
CEntryStub ces(1, fp_registers_ ? kSaveFPRegs : kDontSaveFPRegs);
__ Call(ces.GetCode(masm->isolate()), RelocInfo::CODE_TARGET);
__ mov(a1, v0);
int parameter_count_offset =
StubFailureTrampolineFrame::kCallerStackParameterCountFrameOffset;
__ lw(a0, MemOperand(fp, parameter_count_offset));
// The parameter count above includes the receiver for the arguments passed to
// the deoptimization handler. Subtract the receiver for the parameter count
// for the call.
__ Subu(a0, a0, 1);
masm->LeaveFrame(StackFrame::STUB_FAILURE_TRAMPOLINE);
ParameterCount argument_count(a0);
__ InvokeFunction(
a1, argument_count, JUMP_FUNCTION, NullCallWrapper(), CALL_AS_METHOD);
}
void ProfileEntryHookStub::MaybeCallEntryHook(MacroAssembler* masm) {
if (masm->isolate()->function_entry_hook() != NULL) {
AllowStubCallsScope allow_stub_calls(masm, true);

View File

@ -488,17 +488,36 @@ Operand LCodeGen::ToOperand(LOperand* op) {
}
static int ArgumentsOffsetWithoutFrame(int index) {
ASSERT(index < 0);
return -(index + 1) * kPointerSize;
}
MemOperand LCodeGen::ToMemOperand(LOperand* op) const {
ASSERT(!op->IsRegister());
ASSERT(!op->IsDoubleRegister());
ASSERT(op->IsStackSlot() || op->IsDoubleStackSlot());
return MemOperand(fp, StackSlotOffset(op->index()));
if (NeedsEagerFrame()) {
return MemOperand(fp, StackSlotOffset(op->index()));
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
return MemOperand(sp, ArgumentsOffsetWithoutFrame(op->index()));
}
}
MemOperand LCodeGen::ToHighMemOperand(LOperand* op) const {
ASSERT(op->IsDoubleStackSlot());
return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
if (NeedsEagerFrame()) {
return MemOperand(fp, StackSlotOffset(op->index()) + kPointerSize);
} else {
// Retrieve parameter without eager stack-frame relative to the
// stack-pointer.
return MemOperand(
sp, ArgumentsOffsetWithoutFrame(op->index()) + kPointerSize);
}
}
@ -4015,7 +4034,12 @@ void LCodeGen::DoCallFunction(LCallFunction* instr) {
int arity = instr->arity();
CallFunctionStub stub(arity, NO_CALL_FUNCTION_FLAGS);
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
if (instr->hydrogen()->IsTailCall()) {
if (NeedsEagerFrame()) __ mov(sp, fp);
__ Jump(stub.GetCode(isolate()), RelocInfo::CODE_TARGET);
} else {
CallCode(stub.GetCode(isolate()), RelocInfo::CODE_TARGET, instr);
}
}

View File

@ -1330,8 +1330,10 @@ LInstruction* LChunkBuilder::DoCallNewArray(HCallNewArray* instr) {
LInstruction* LChunkBuilder::DoCallFunction(HCallFunction* instr) {
LOperand* context = UseFixed(instr->context(), cp);
LOperand* function = UseFixed(instr->function(), a1);
return MarkAsCall(
DefineFixed(new(zone()) LCallFunction(context, function), v0), instr);
LCallFunction* call = new(zone()) LCallFunction(context, function);
LInstruction* result = DefineFixed(call, v0);
if (instr->IsTailCall()) return result;
return MarkAsCall(result, instr);
}