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

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

Issue 1289863003: [interpreter]: Changes to interpreter builtins for accumulator and register file registers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@fix_interpreter_initialization
Patch Set: Rename incoming_accumulator Created 5 years, 4 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/arm/macro-assembler-arm.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_ARM 7 #if V8_TARGET_ARCH_ARM
8 8
9 #include "src/codegen.h" 9 #include "src/codegen.h"
10 #include "src/debug/debug.h" 10 #include "src/debug/debug.h"
11 #include "src/deoptimizer.h" 11 #include "src/deoptimizer.h"
12 #include "src/full-codegen/full-codegen.h" 12 #include "src/full-codegen/full-codegen.h"
13 #include "src/interpreter/bytecodes.h"
14 #include "src/runtime/runtime.h" 13 #include "src/runtime/runtime.h"
15 14
16 namespace v8 { 15 namespace v8 {
17 namespace internal { 16 namespace internal {
18 17
19 18
20 #define __ ACCESS_MASM(masm) 19 #define __ ACCESS_MASM(masm)
21 20
22 21
23 void Builtins::Generate_Adaptor(MacroAssembler* masm, 22 void Builtins::Generate_Adaptor(MacroAssembler* masm,
(...skipping 896 matching lines...) Expand 10 before | Expand all | Expand 10 after
920 // Do a stack check to ensure we don't go over the limit. 919 // Do a stack check to ensure we don't go over the limit.
921 Label ok; 920 Label ok;
922 __ sub(r9, sp, Operand(r4)); 921 __ sub(r9, sp, Operand(r4));
923 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex); 922 __ LoadRoot(r2, Heap::kRealStackLimitRootIndex);
924 __ cmp(r9, Operand(r2)); 923 __ cmp(r9, Operand(r2));
925 __ b(hs, &ok); 924 __ b(hs, &ok);
926 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); 925 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION);
927 __ bind(&ok); 926 __ bind(&ok);
928 927
929 // If ok, push undefined as the initial value for all register file entries. 928 // If ok, push undefined as the initial value for all register file entries.
930 // Note: there should always be at least one stack slot for the return
931 // register in the register file.
932 Label loop_header; 929 Label loop_header;
930 Label loop_check;
933 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex); 931 __ LoadRoot(r9, Heap::kUndefinedValueRootIndex);
932 __ b(&loop_check, al);
934 __ bind(&loop_header); 933 __ bind(&loop_header);
935 // TODO(rmcilroy): Consider doing more than one push per loop iteration. 934 // TODO(rmcilroy): Consider doing more than one push per loop iteration.
936 __ push(r9); 935 __ push(r9);
937 // Continue loop if not done. 936 // Continue loop if not done.
937 __ bind(&loop_check);
938 __ sub(r4, r4, Operand(kPointerSize), SetCC); 938 __ sub(r4, r4, Operand(kPointerSize), SetCC);
939 __ b(&loop_header, ne); 939 __ b(&loop_header, ge);
940 } 940 }
941 941
942 // TODO(rmcilroy): List of things not currently dealt with here but done in 942 // TODO(rmcilroy): List of things not currently dealt with here but done in
943 // fullcodegen's prologue: 943 // fullcodegen's prologue:
944 // - Support profiler (specifically profiling_counter). 944 // - Support profiler (specifically profiling_counter).
945 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. 945 // - Call ProfileEntryHookStub when isolate has a function_entry_hook.
946 // - Allow simulator stop operations if FLAG_stop_at is set. 946 // - Allow simulator stop operations if FLAG_stop_at is set.
947 // - Deal with sloppy mode functions which need to replace the 947 // - Deal with sloppy mode functions which need to replace the
948 // receiver with the global proxy when called as functions (without an 948 // receiver with the global proxy when called as functions (without an
949 // explicit receiver object). 949 // explicit receiver object).
(...skipping 13 matching lines...) Expand all
963 // Perform stack guard check. 963 // Perform stack guard check.
964 { 964 {
965 Label ok; 965 Label ok;
966 __ LoadRoot(ip, Heap::kStackLimitRootIndex); 966 __ LoadRoot(ip, Heap::kStackLimitRootIndex);
967 __ cmp(sp, Operand(ip)); 967 __ cmp(sp, Operand(ip));
968 __ b(hs, &ok); 968 __ b(hs, &ok);
969 __ CallRuntime(Runtime::kStackGuard, 0); 969 __ CallRuntime(Runtime::kStackGuard, 0);
970 __ bind(&ok); 970 __ bind(&ok);
971 } 971 }
972 972
973 // Load bytecode offset and dispatch table into registers. 973 // Load accumulator, register file, bytecode offset, dispatch table into
974 // registers.
975 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex);
976 __ sub(kInterpreterRegisterFileRegister, fp,
977 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp));
974 __ mov(kInterpreterBytecodeOffsetRegister, 978 __ mov(kInterpreterBytecodeOffsetRegister,
975 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); 979 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag));
976 __ LoadRoot(kInterpreterDispatchTableRegister, 980 __ LoadRoot(kInterpreterDispatchTableRegister,
977 Heap::kInterpreterTableRootIndex); 981 Heap::kInterpreterTableRootIndex);
978 __ add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, 982 __ add(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister,
979 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); 983 Operand(FixedArray::kHeaderSize - kHeapObjectTag));
980 984
981 // Dispatch to the first bytecode handler for the function. 985 // Dispatch to the first bytecode handler for the function.
982 __ ldrb(r0, MemOperand(kInterpreterBytecodeArrayRegister, 986 __ ldrb(r1, MemOperand(kInterpreterBytecodeArrayRegister,
983 kInterpreterBytecodeOffsetRegister)); 987 kInterpreterBytecodeOffsetRegister));
984 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r0, LSL, 988 __ ldr(ip, MemOperand(kInterpreterDispatchTableRegister, r1, LSL,
985 kPointerSizeLog2)); 989 kPointerSizeLog2));
986 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging 990 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging
987 // and header removal. 991 // and header removal.
988 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag)); 992 __ add(ip, ip, Operand(Code::kHeaderSize - kHeapObjectTag));
989 __ Jump(ip); 993 __ Call(ip);
990 } 994 }
991 995
992 996
993 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { 997 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) {
994 // TODO(rmcilroy): List of things not currently dealt with here but done in 998 // TODO(rmcilroy): List of things not currently dealt with here but done in
995 // fullcodegen's EmitReturnSequence. 999 // fullcodegen's EmitReturnSequence.
996 // - Supporting FLAG_trace for Runtime::TraceExit. 1000 // - Supporting FLAG_trace for Runtime::TraceExit.
997 // - Support profiler (specifically decrementing profiling_counter 1001 // - Support profiler (specifically decrementing profiling_counter
998 // appropriately and calling out to HandleInterrupts if necessary). 1002 // appropriately and calling out to HandleInterrupts if necessary).
999 1003
1000 // Load return value into r0. 1004 // The return value is in accumulator, which is already in r0.
1001 __ ldr(r0, MemOperand(fp, -kPointerSize - 1005
1002 StandardFrameConstants::kFixedFrameSizeFromFp));
1003 // Leave the frame (also dropping the register file). 1006 // Leave the frame (also dropping the register file).
1004 __ LeaveFrame(StackFrame::JAVA_SCRIPT); 1007 __ LeaveFrame(StackFrame::JAVA_SCRIPT);
1005 // Drop receiver + arguments. 1008 // Drop receiver + arguments.
1006 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray. 1009 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray.
1007 __ Jump(lr); 1010 __ Jump(lr);
1008 } 1011 }
1009 1012
1010 1013
1011 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { 1014 void Builtins::Generate_CompileLazy(MacroAssembler* masm) {
1012 CallRuntimePassFunction(masm, Runtime::kCompileLazy); 1015 CallRuntimePassFunction(masm, Runtime::kCompileLazy);
(...skipping 853 matching lines...) Expand 10 before | Expand all | Expand 10 after
1866 } 1869 }
1867 } 1870 }
1868 1871
1869 1872
1870 #undef __ 1873 #undef __
1871 1874
1872 } // namespace internal 1875 } // namespace internal
1873 } // namespace v8 1876 } // namespace v8
1874 1877
1875 #endif // V8_TARGET_ARCH_ARM 1878 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/arm/macro-assembler-arm.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698