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

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

Issue 1311013005: Version 4.6.85.7 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.6
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 | « src/ic/ppc/stub-cache-ppc.cc ('k') | src/ppc/code-stubs-ppc.cc » ('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 870 matching lines...) Expand 10 before | Expand all | Expand 10 after
892 // Check function data field is actually a BytecodeArray object. 891 // Check function data field is actually a BytecodeArray object.
893 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0); 892 __ TestIfSmi(kInterpreterBytecodeArrayRegister, r0);
894 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 893 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
895 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg, 894 __ CompareObjectType(kInterpreterBytecodeArrayRegister, r3, no_reg,
896 BYTECODE_ARRAY_TYPE); 895 BYTECODE_ARRAY_TYPE);
897 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry); 896 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry);
898 } 897 }
899 898
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 from the BytecodeArray object. 901 // Load frame size (word) from the BytecodeArray object.
903 __ LoadP(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);
922 __ bind(&loop_header); 919 __ beq(&no_args, cr0);
920 __ mtctr(r5);
921 __ bind(&loop);
923 __ push(r6); 922 __ push(r6);
924 __ bdnz(&loop_header); 923 __ bdnz(&loop);
924 __ bind(&no_args);
925 } 925 }
926 926
927 // 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
928 // fullcodegen's prologue: 928 // fullcodegen's prologue:
929 // - Support profiler (specifically profiling_counter). 929 // - Support profiler (specifically profiling_counter).
930 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 930 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
931 // - Allow simulator stop operations if FLAG_stop_at is set. 931 // - Allow simulator stop operations if FLAG_stop_at is set.
932 // - Deal with sloppy mode functions which need to replace the 932 // - Deal with sloppy mode functions which need to replace the
933 // receiver with the global proxy when called as functions (without an 933 // receiver with the global proxy when called as functions (without an
934 // explicit receiver object). 934 // explicit receiver object).
(...skipping 13 matching lines...) Expand all
948 // Perform stack guard check. 948 // Perform stack guard check.
949 { 949 {
950 Label ok; 950 Label ok;
951 __ LoadRoot(r0, Heap::kStackLimitRootIndex); 951 __ LoadRoot(r0, Heap::kStackLimitRootIndex);
952 __ cmp(sp, r0); 952 __ cmp(sp, r0);
953 __ bge(&ok); 953 __ bge(&ok);
954 __ CallRuntime(Runtime::kStackGuard, 0); 954 __ CallRuntime(Runtime::kStackGuard, 0);
955 __ bind(&ok); 955 __ bind(&ok);
956 } 956 }
957 957
958 // 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));
959 __ mov(kInterpreterBytecodeOffsetRegister, 964 __ mov(kInterpreterBytecodeOffsetRegister,
960 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 965 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
961 __ LoadRoot(kInterpreterDispatchTableRegister, 966 __ LoadRoot(kInterpreterDispatchTableRegister,
962 Heap::kInterpreterTableRootIndex); 967 Heap::kInterpreterTableRootIndex);
963 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, 968 __ addi(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister,
964 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 969 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
965 970
966 // Dispatch to the first bytecode handler for the function. 971 // Dispatch to the first bytecode handler for the function.
967 __ lbzx(r3, MemOperand(kInterpreterBytecodeArrayRegister, 972 __ lbzx(r4, MemOperand(kInterpreterBytecodeArrayRegister,
968 kInterpreterBytecodeOffsetRegister)); 973 kInterpreterBytecodeOffsetRegister));
969 __ ShiftLeftImm(ip, r3, Operand(kPointerSizeLog2)); 974 __ ShiftLeftImm(ip, r4, Operand(kPointerSizeLog2));
970 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip)); 975 __ LoadPX(ip, MemOperand(kInterpreterDispatchTableRegister, ip));
971 // 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
972 // and header removal. 977 // and header removal.
973 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 978 __ addi(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
974 __ Jump(ip); 979 __ Call(ip);
975 } 980 }
976 981
977 982
978 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 983 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
979 // 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
980 // fullcodegen's EmitReturnSequence. 985 // fullcodegen's EmitReturnSequence.
981 // - Supporting FLAG_trace for Runtime::TraceExit. 986 // - Supporting FLAG_trace for Runtime::TraceExit.
982 // - Support profiler (specifically decrementing profiling_counter 987 // - Support profiler (specifically decrementing profiling_counter
983 // appropriately and calling out to HandleInterrupts if necessary). 988 // appropriately and calling out to HandleInterrupts if necessary).
984 989
985 // Load return value into r3. 990 // The return value is in accumulator, which is already in r3.
986 __ LoadP(r3, 991
987 MemOperand(fp, -kPointerSize -
988 StandardFrameConstants::kFixedFrameSizeFromFp));
989 // Leave the frame (also dropping the register file). 992 // Leave the frame (also dropping the register file).
990 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 993 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
991 // Drop receiver + arguments. 994 // Drop receiver + arguments.
992 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray. 995 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray.
993 __ blr(); 996 __ blr();
994 } 997 }
995 998
996 999
997 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1000 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
998 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1001 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
1920 __ bkpt(0); 1923 __ bkpt(0);
1921 } 1924 }
1922 } 1925 }
1923 1926
1924 1927
1925 #undef __ 1928 #undef __
1926 } // namespace internal 1929 } // namespace internal
1927 } // namespace v8 1930 } // namespace v8
1928 1931
1929 #endif // V8_TARGET_ARCH_PPC 1932 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ic/ppc/stub-cache-ppc.cc ('k') | src/ppc/code-stubs-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698