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 | 5 |
6 | 6 |
7 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS | 9 #if V8_TARGET_ARCH_MIPS |
10 | 10 |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
910 | 910 |
911 // Do a stack check to ensure we don't go over the limit. | 911 // Do a stack check to ensure we don't go over the limit. |
912 Label ok; | 912 Label ok; |
913 __ Subu(t1, sp, Operand(t0)); | 913 __ Subu(t1, sp, Operand(t0)); |
914 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 914 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
915 __ Branch(&ok, hs, t1, Operand(a2)); | 915 __ Branch(&ok, hs, t1, Operand(a2)); |
916 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); | 916 __ InvokeBuiltin(Builtins::STACK_OVERFLOW, CALL_FUNCTION); |
917 __ bind(&ok); | 917 __ bind(&ok); |
918 | 918 |
919 // If ok, push undefined as the initial value for all register file entries. | 919 // If ok, push undefined as the initial value for all register file entries. |
920 // Note: there should always be at least one stack slot for the return | |
921 // register in the register file. | |
922 Label loop_header; | 920 Label loop_header; |
| 921 Label loop_check; |
923 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); | 922 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); |
| 923 __ Branch(&loop_check); |
924 __ bind(&loop_header); | 924 __ bind(&loop_header); |
925 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 925 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
926 __ push(t1); | 926 __ push(t1); |
927 // Continue loop if not done. | 927 // Continue loop if not done. |
| 928 __ bind(&loop_check); |
928 __ Subu(t0, t0, Operand(kPointerSize)); | 929 __ Subu(t0, t0, Operand(kPointerSize)); |
929 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); | 930 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); |
930 } | 931 } |
931 | 932 |
932 // TODO(rmcilroy): List of things not currently dealt with here but done in | 933 // TODO(rmcilroy): List of things not currently dealt with here but done in |
933 // fullcodegen's prologue: | 934 // fullcodegen's prologue: |
934 // - Support profiler (specifically profiling_counter). | 935 // - Support profiler (specifically profiling_counter). |
935 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. | 936 // - Call ProfileEntryHookStub when isolate has a function_entry_hook. |
936 // - Allow simulator stop operations if FLAG_stop_at is set. | 937 // - Allow simulator stop operations if FLAG_stop_at is set. |
937 // - Deal with sloppy mode functions which need to replace the | 938 // - Deal with sloppy mode functions which need to replace the |
(...skipping 15 matching lines...) Expand all Loading... |
953 // Perform stack guard check. | 954 // Perform stack guard check. |
954 { | 955 { |
955 Label ok; | 956 Label ok; |
956 __ LoadRoot(at, Heap::kStackLimitRootIndex); | 957 __ LoadRoot(at, Heap::kStackLimitRootIndex); |
957 __ Branch(&ok, hs, sp, Operand(at)); | 958 __ Branch(&ok, hs, sp, Operand(at)); |
958 __ CallRuntime(Runtime::kStackGuard, 0); | 959 __ CallRuntime(Runtime::kStackGuard, 0); |
959 __ bind(&ok); | 960 __ bind(&ok); |
960 } | 961 } |
961 | 962 |
962 // Load bytecode offset and dispatch table into registers. | 963 // Load bytecode offset and dispatch table into registers. |
| 964 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
| 965 __ Subu( |
| 966 kInterpreterRegisterFileRegister, fp, |
| 967 Operand(kPointerSize + StandardFrameConstants::kFixedFrameSizeFromFp)); |
963 __ li(kInterpreterBytecodeOffsetRegister, | 968 __ li(kInterpreterBytecodeOffsetRegister, |
964 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | 969 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
965 __ LoadRoot(kInterpreterDispatchTableRegister, | 970 __ LoadRoot(kInterpreterDispatchTableRegister, |
966 Heap::kInterpreterTableRootIndex); | 971 Heap::kInterpreterTableRootIndex); |
967 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, | 972 __ Addu(kInterpreterDispatchTableRegister, kInterpreterDispatchTableRegister, |
968 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); | 973 Operand(FixedArray::kHeaderSize - kHeapObjectTag)); |
969 | 974 |
970 // Dispatch to the first bytecode handler for the function. | 975 // Dispatch to the first bytecode handler for the function. |
971 __ Addu(a0, kInterpreterBytecodeArrayRegister, | 976 __ Addu(a0, kInterpreterBytecodeArrayRegister, |
972 kInterpreterBytecodeOffsetRegister); | 977 kInterpreterBytecodeOffsetRegister); |
973 __ lbu(a0, MemOperand(a0)); | 978 __ lbu(a0, MemOperand(a0)); |
974 __ sll(at, a0, kPointerSizeLog2); | 979 __ sll(at, a0, kPointerSizeLog2); |
975 __ Addu(at, kInterpreterDispatchTableRegister, at); | 980 __ Addu(at, kInterpreterDispatchTableRegister, at); |
976 __ lw(at, MemOperand(at)); | 981 __ lw(at, MemOperand(at)); |
977 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging | 982 // TODO(rmcilroy): Make dispatch table point to code entrys to avoid untagging |
978 // and header removal. | 983 // and header removal. |
979 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); | 984 __ Addu(at, at, Operand(Code::kHeaderSize - kHeapObjectTag)); |
980 __ Jump(at); | 985 __ Call(at); |
981 } | 986 } |
982 | 987 |
983 | 988 |
984 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { | 989 void Builtins::Generate_InterpreterExitTrampoline(MacroAssembler* masm) { |
985 // TODO(rmcilroy): List of things not currently dealt with here but done in | 990 // TODO(rmcilroy): List of things not currently dealt with here but done in |
986 // fullcodegen's EmitReturnSequence. | 991 // fullcodegen's EmitReturnSequence. |
987 // - Supporting FLAG_trace for Runtime::TraceExit. | 992 // - Supporting FLAG_trace for Runtime::TraceExit. |
988 // - Support profiler (specifically decrementing profiling_counter | 993 // - Support profiler (specifically decrementing profiling_counter |
989 // appropriately and calling out to HandleInterrupts if necessary). | 994 // appropriately and calling out to HandleInterrupts if necessary). |
990 | 995 |
991 // Load return value into v0. | 996 // The return value is in accumulator, which is already in v0. |
992 __ lw(v0, MemOperand(fp, -kPointerSize - | 997 |
993 StandardFrameConstants::kFixedFrameSizeFromFp)); | |
994 // Leave the frame (also dropping the register file). | 998 // Leave the frame (also dropping the register file). |
995 __ LeaveFrame(StackFrame::JAVA_SCRIPT); | 999 __ LeaveFrame(StackFrame::JAVA_SCRIPT); |
996 // Drop receiver + arguments. | 1000 // Drop receiver + arguments. |
997 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray. | 1001 __ Drop(1); // TODO(rmcilroy): Get number of arguments from BytecodeArray. |
998 __ Jump(ra); | 1002 __ Jump(ra); |
999 } | 1003 } |
1000 | 1004 |
1001 | 1005 |
1002 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { | 1006 void Builtins::Generate_CompileLazy(MacroAssembler* masm) { |
1003 CallRuntimePassFunction(masm, Runtime::kCompileLazy); | 1007 CallRuntimePassFunction(masm, Runtime::kCompileLazy); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1873 } | 1877 } |
1874 } | 1878 } |
1875 | 1879 |
1876 | 1880 |
1877 #undef __ | 1881 #undef __ |
1878 | 1882 |
1879 } // namespace internal | 1883 } // namespace internal |
1880 } // namespace v8 | 1884 } // namespace v8 |
1881 | 1885 |
1882 #endif // V8_TARGET_ARCH_MIPS | 1886 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |