Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1630)

Side by Side Diff: src/ppc/builtins-ppc.cc

Issue 1309113003: PPC: [interpreter]: Changes to interpreter builtins for accumulator and register file registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/ppc/macro-assembler-ppc.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #if V8_TARGET_ARCH_PPC 5 #if V8_TARGET_ARCH_PPC
6 6
7 #include "src/codegen.h" 7 #include "src/codegen.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/deoptimizer.h" 9 #include "src/deoptimizer.h"
10 #include "src/full-codegen/full-codegen.h" 10 #include "src/full-codegen/full-codegen.h"
11 #include "src/interpreter/bytecodes.h"
12 #include "src/runtime/runtime.h" 11 #include "src/runtime/runtime.h"
13 12
14 namespace v8 { 13 namespace v8 {
15 namespace internal { 14 namespace internal {
16 15
17 16
18 #define __ ACCESS_MASM(masm) 17 #define __ ACCESS_MASM(masm)
19 18
20 19
21 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id, 20 void Builtins::Generate_Adaptor(MacroAssembler* masm, CFunctionId id,
(...skipping 878 matching lines...) Expand 10 before | Expand all | Expand 10 after
900 // Allocate the local and temporary register file on the stack. 899 // Allocate the local and temporary register file on the stack.
901 { 900 {
902 // Load frame size (word) from the BytecodeArray object. 901 // Load frame size (word) from the BytecodeArray object.
903 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister, 902 __ lwz(r5, FieldMemOperand(kInterpreterBytecodeArrayRegister,
904 BytecodeArray::kFrameSizeOffset)); 903 BytecodeArray::kFrameSizeOffset));
905 904
906 // Do a stack check to ensure we don't go over the limit. 905 // Do a stack check to ensure we don't go over the limit.
907 Label ok; 906 Label ok;
908 __ sub(r6, sp, r5); 907 __ sub(r6, sp, r5);
909 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex); 908 __ LoadRoot(r0, Heap::kRealStackLimitRootIndex);
910 __ cmp(r6, r0); 909 __ cmpl(r6, r0);
911 __ bge(&ok); 910 __ bge(&ok);
912 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); 911 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION);
913 __ bind(&ok); 912 __ bind(&ok);
914 913
915 // If ok, push undefined as the initial value for all register file entries. 914 // If ok, push undefined as the initial value for all register file entries.
916 // Note: there should always be at least one stack slot for the return
917 // register in the register file.
918 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 915 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
919 Label loop_header; 916 Label loop, no_args;
920 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex); 917 __ LoadRoot(r6, Heap::kUndefinedValueRootIndex);
921 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2)); 918 __ ShiftRightImm(r5, r5, Operand(kPointerSizeLog2), SetRC);
919 __ beq(&no_args, cr0);
922 __ mtctr(r5); 920 __ mtctr(r5);
923 __ bind(&loop_header); 921 __ bind(&loop);
924 __ push(r6); 922 __ push(r6);
925 __ bdnz(&loop_header); 923 __ bdnz(&loop);
924 __ bind(&no_args);
926 } 925 }
927 926
928 // TODO(rmcilroy): List of things not currently dealt with here but done in 927 // TODO(rmcilroy): List of things not currently dealt with here but done in
929 // fullcodegen's prologue: 928 // fullcodegen's prologue:
930 // - Support profiler (specifically profiling_counter). 929 // - Support profiler (specifically profiling_counter).
931 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 930 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
932 // - Allow simulator stop operations if FLAG_stop_at is set. 931 // - Allow simulator stop operations if FLAG_stop_at is set.
933 // - Deal with sloppy mode functions which need to replace the 932 // - Deal with sloppy mode functions which need to replace the
934 // receiver with the global proxy when called as functions (without an 933 // receiver with the global proxy when called as functions (without an
935 // explicit receiver object). 934 // explicit receiver object).
(...skipping 13 matching lines...) Expand all
949 // Perform stack guard check. 948 // Perform stack guard check.
950 { 949 {
951 Label ok; 950 Label ok;
952 __ LoadRoot(r0, Heap::kStackLimitRootIndex); 951 __ LoadRoot(r0, Heap::kStackLimitRootIndex);
953 __ cmp(sp, r0); 952 __ cmp(sp, r0);
954 __ bge(&ok); 953 __ bge(&ok);
955 __ CallRuntime(Runtime::kStackGuard, 0); 954 __ CallRuntime(Runtime::kStackGuard, 0);
956 __ bind(&ok); 955 __ bind(&ok);
957 } 956 }
958 957
959 // Load bytecode offset and dispatch table into registers. 958 // Load accumulator, register file, bytecode offset, dispatch table into
959 // registers.
960 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
961 __ subi(
962 kInterpreterRegisterFileRegister, fp,
963 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp));
960 __ mov(kInterpreterBytecodeOffsetRegister, 964 __ mov(kInterpreterBytecodeOffsetRegister,
961 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 965 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
962 __ LoadRoot(kInterpreterDispatchTableRegister, 966 __ LoadRoot(kInterpreterDispatchTableRegister,
963 Heap::kInterpreterTableRootIndex); 967 Heap::kInterpreterTableRootIndex);
964 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, 968 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister,
965 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 969 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
966 970
967 // Dispatch to the first bytecode handler for the function. 971 // Dispatch to the first bytecode handler for the function.
968 __ lbzx(r3, MemOperand(kInterpreterBytecodeArrayRegister, 972 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister,
969 kInterpreterBytecodeOffsetRegister)); 973 kInterpreterBytecodeOffsetRegister));
970 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); 974 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2));
971 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); 975 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip));
972 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 976 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
973 // and header removal. 977 // and header removal.
974 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 978 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
975 __ Jump(ip); 979 __ Call(ip);
976 } 980 }
977 981
978 982
979 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 983 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
980 // TODO(rmcilroy): List of things not currently dealt with here but done in 984 // TODO(rmcilroy): List of things not currently dealt with here but done in
981 // fullcodegen's EmitReturnSequence. 985 // fullcodegen's EmitReturnSequence.
982 // - Supporting FLAG_trace for Runtime::TraceExit. 986 // - Supporting FLAG_trace for Runtime::TraceExit.
983 // - Support profiler (specifically decrementing profiling_counter 987 // - Support profiler (specifically decrementing profiling_counter
984 // appropriately and calling out to HandleInterrupts if necessary). 988 // appropriately and calling out to HandleInterrupts if necessary).
985 989
986 // Load return value into r3. 990 // The return value is in accumulator, which is already in r3.
987 __ LoadP(r3, 991
988 MemOperand(fp, -kPointerSize -
989 StandardFrameConstants::kFixedFrameSizeFromFp));
990 // Leave the frame (also dropping the register file). 992 // Leave the frame (also dropping the register file).
991 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 993 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
992 // Drop receiver + arguments. 994 // Drop receiver + arguments.
993 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray. 995 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray.
994 __ blr(); 996 __ blr();
995 } 997 }
996 998
997 999
998 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1000 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
999 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1001 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1921 __ bkpt(0); 1923 __ bkpt(0);
1922 } 1924 }
1923 } 1925 }
1924 1926
1925 1927
1926 #undef __ 1928 #undef __
1927 } // namespace internal 1929 } // namespace internal
1928 } // namespace v8 1930 } // namespace v8
1929 1931
1930 #endif // V8_TARGET_ARCH_PPC 1932 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « no previous file | src/ppc/macro-assembler-ppc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698