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