Commit f481316b authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [interpreter]: Changes to interpreter builtins for accumulator and register file registers.

Port 00df60d1

Original commit message:
    Makes the following modifications to the interpreter builtins and
    InterpreterAssembler:
     - Adds an accumulator register and initializes it to undefined()
     - Adds a register file pointer register and use it instead of FramePointer to
       access registers
     - Modifies builtin to support functions with 0 regiters in the register file
     - Modifies builtin to Call rather than TailCall to first bytecode handler.

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

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

Cr-Commit-Position: refs/heads/master@{#30414}
parent bcc9df92
......@@ -8,7 +8,6 @@
#include "src/debug/debug.h"
#include "src/deoptimizer.h"
#include "src/full-codegen/full-codegen.h"
#include "src/interpreter/bytecodes.h"
#include "src/runtime/runtime.h"
namespace v8 {
......@@ -907,22 +906,22 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
Label ok;
__ sub(r6, sp, r5);
__ LoadRoot(r0, Heap::kRealStackLimitRootIndex);
__ cmp(r6, r0);
__ cmpl(r6, r0);
__ bge(&ok);
__ InvokeBuiltin(Context::STACK_OVERFLOW_BUILTIN_INDEX, CALL_FUNCTION);
__ bind(&ok);
// If ok, push undefined as the initial value for all register file entries.
// Note: there should always be at least one stack slot for the return
// register in the register file.
// TODO(rmcilroy): Consider doing more than one push per loop iteration.
Label loop_header;
Label loop, no_args;
__ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
__ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2));
__ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC);
__ beq(&no_args, cr0);
__ mtctr(r5);
__ bind(&loop_header);
__ bind(&loop);
__ push(r6);
__ bdnz(&loop_header);
__ bdnz(&loop);
__ bind(&no_args);
}
// TODO(rmcilroy): List of things not currently dealt with here but done in
......@@ -956,7 +955,12 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
__ bind(&ok);
}
// Load bytecode offset and dispatch table into registers.
// Load accumulator, register file, bytecode offset, dispatch table into
// registers.
__ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
__ subi(
kInterpreterRegisterFileRegister, fp,
Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp));
__ mov(kInterpreterBytecodeOffsetRegister,
Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
__ LoadRoot(kInterpreterDispatchTableRegister,
......@@ -965,14 +969,14 @@ void Builtins::Generate_InterpreterEntryTrampoline(MacroAssembler* masm) {
Operand(FixedArray::kHeaderSize - kHeapObjectTag));
// Dispatch to the first bytecode handler for the function.
__ lbzx(r3, MemOperand(kInterpreterBytecodeArrayRegister,
__ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister,
kInterpreterBytecodeOffsetRegister));
__ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2));
__ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2));
__ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip));
// TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
// and header removal.
__ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
__ Jump(ip);
__ Call(ip);
}
......@@ -983,10 +987,8 @@ void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
// - Support profiler (specifically decrementing profiling_counter
// appropriately and calling out to HandleInterrupts if necessary).
// Load return value into r3.
__ LoadP(r3,
MemOperand(fp, -kPointerSize -
StandardFrameConstants::kFixedFrameSizeFromFp));
// The return value is in accumulator, which is already in r3.
// Leave the frame (also dropping the register file).
__ LeaveFrame(StackFrame::JAVA_SCRIPT);
// Drop receiver + arguments.
......
......@@ -18,9 +18,11 @@ const Register kReturnRegister0 = {kRegister_r3_Code};
const Register kReturnRegister1 = {kRegister_r4_Code};
const Register kJSFunctionRegister = {kRegister_r4_Code};
const Register kContextRegister = {kRegister_r30_Code};
const Register kInterpreterBytecodeOffsetRegister = {kRegister_r14_Code};
const Register kInterpreterBytecodeArrayRegister = {kRegister_r15_Code};
const Register kInterpreterDispatchTableRegister = {kRegister_r16_Code};
const Register kInterpreterAccumulatorRegister = {kRegister_r3_Code};
const Register kInterpreterRegisterFileRegister = {kRegister_r14_Code};
const Register kInterpreterBytecodeOffsetRegister = {kRegister_r15_Code};
const Register kInterpreterBytecodeArrayRegister = {kRegister_r16_Code};
const Register kInterpreterDispatchTableRegister = {kRegister_r17_Code};
const Register kRuntimeCallFunctionRegister = {kRegister_r4_Code};
const Register kRuntimeCallArgCountRegister = {kRegister_r3_Code};
......
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