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