Reviewers: dstence, joransiu, john.yan, rmcilroy,
Description:
PPC: [interpreter]: Changes to interpreter builtins for accumulator and
register
file registers.
Port 00df60d1c6943a10fb5ca84fce2c017dcd2001f5
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.
[email protected], [email protected], [email protected],
[email protected]
BUG=v8:4280
LOG=N
Please review this at https://codereview.chromium.org/1309113003/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+23, -19 lines):
M src/ppc/builtins-ppc.cc
M src/ppc/macro-assembler-ppc.h
Index: src/ppc/builtins-ppc.cc
diff --git a/src/ppc/builtins-ppc.cc b/src/ppc/builtins-ppc.cc
index
f50060443bbfd7b4569a4e91cfc6099f8fce95bc..e002df89ec6fb0dfca8f026e86410ca8336e46d2
100644
--- a/src/ppc/builtins-ppc.cc
+++ b/src/ppc/builtins-ppc.cc
@@ -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(Builtins::STACK_OVERFLOW, 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.
Index: src/ppc/macro-assembler-ppc.h
diff --git a/src/ppc/macro-assembler-ppc.h b/src/ppc/macro-assembler-ppc.h
index
5d6275103bddceacb9a9a68d02325dced36c2962..64396bb3a478c73201beff2d810c721caa50eb2c
100644
--- a/src/ppc/macro-assembler-ppc.h
+++ b/src/ppc/macro-assembler-ppc.h
@@ -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};
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.