PPC: [Interpreter] Add support for JS calls.

Port e7fb233946

Original commit message:
    Adds support for JS calls to the interpreter. In order to support
    calls from the interpreter, the PushArgsAndCall builtin is added
    which pushes a sequence of arguments onto the stack and calls
    builtin::Call.

    Adds the Call bytecode.

R=rmcilroy@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com, dstence@us.ibm.com
BUG=v8:4280
LOG=N

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

Cr-Commit-Position: refs/heads/master@{#30721}
This commit is contained in:
mbrandy 2015-09-14 16:15:28 -07:00 committed by Commit bot
parent b571b83bcd
commit b6f673987f
2 changed files with 37 additions and 0 deletions

View File

@ -1673,6 +1673,32 @@ void Builtins::Generate_Call(MacroAssembler* masm) {
}
// static
void Builtins::Generate_PushArgsAndCall(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : the number of arguments (not including the receiver)
// -- r5 : the address of the first argument to be pushed. Subsequent
// arguments should be consecutive above this, in the same order as
// they are to be pushed onto the stack.
// -- r4 : the target to call (can be any Object).
// Calculate number of arguments (add one for receiver).
__ addi(r6, r3, Operand(1));
// Push the arguments.
Label loop;
__ addi(r5, r5, Operand(kPointerSize)); // Bias up for LoadPU
__ mtctr(r6);
__ bind(&loop);
__ LoadPU(r6, MemOperand(r5, -kPointerSize));
__ push(r6);
__ bdnz(&loop);
// Call the target.
__ Jump(masm->isolate()->builtins()->Call(), RelocInfo::CODE_TARGET);
}
void Builtins::Generate_ArgumentsAdaptorTrampoline(MacroAssembler* masm) {
// ----------- S t a t e -------------
// -- r3 : actual number of arguments

View File

@ -380,6 +380,17 @@ void MathRoundVariantCallFromOptimizedCodeDescriptor::
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
void PushArgsAndCallDescriptor::InitializePlatformSpecific(
CallInterfaceDescriptorData* data) {
Register registers[] = {
r3, // argument count (including receiver)
r5, // address of first argument
r4 // the target callable to be call
};
data->InitializePlatformSpecific(arraysize(registers), registers);
}
} // namespace internal
} // namespace v8