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 #if V8_TARGET_ARCH_MIPS | 5 #if V8_TARGET_ARCH_MIPS |
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" |
(...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
995 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present); | 995 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present); |
996 if (FLAG_debug_code) { | 996 if (FLAG_debug_code) { |
997 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); | 997 __ SmiTst(kInterpreterBytecodeArrayRegister, t0); |
998 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, | 998 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, |
999 Operand(zero_reg)); | 999 Operand(zero_reg)); |
1000 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0); | 1000 __ GetObjectType(kInterpreterBytecodeArrayRegister, t0, t0); |
1001 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, | 1001 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, t0, |
1002 Operand(BYTECODE_ARRAY_TYPE)); | 1002 Operand(BYTECODE_ARRAY_TYPE)); |
1003 } | 1003 } |
1004 | 1004 |
1005 // Push new.target, bytecode array and zero for bytecode array offset. | 1005 // Load initial bytecode offset. |
1006 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg); | 1006 __ li(kInterpreterBytecodeOffsetRegister, |
| 1007 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 1008 |
| 1009 // Push new.target, bytecode array and Smi tagged bytecode array offset. |
| 1010 __ SmiTag(t0, kInterpreterBytecodeOffsetRegister); |
| 1011 __ Push(a3, kInterpreterBytecodeArrayRegister, t0); |
1007 | 1012 |
1008 // Allocate the local and temporary register file on the stack. | 1013 // Allocate the local and temporary register file on the stack. |
1009 { | 1014 { |
1010 // Load frame size from the BytecodeArray object. | 1015 // Load frame size from the BytecodeArray object. |
1011 __ lw(t0, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1016 __ lw(t0, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1012 BytecodeArray::kFrameSizeOffset)); | 1017 BytecodeArray::kFrameSizeOffset)); |
1013 | 1018 |
1014 // Do a stack check to ensure we don't go over the limit. | 1019 // Do a stack check to ensure we don't go over the limit. |
1015 Label ok; | 1020 Label ok; |
1016 __ Subu(t1, sp, Operand(t0)); | 1021 __ Subu(t1, sp, Operand(t0)); |
1017 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 1022 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
1018 __ Branch(&ok, hs, t1, Operand(a2)); | 1023 __ Branch(&ok, hs, t1, Operand(a2)); |
1019 __ CallRuntime(Runtime::kThrowStackOverflow); | 1024 __ CallRuntime(Runtime::kThrowStackOverflow); |
1020 __ bind(&ok); | 1025 __ bind(&ok); |
1021 | 1026 |
1022 // If ok, push undefined as the initial value for all register file entries. | 1027 // If ok, push undefined as the initial value for all register file entries. |
1023 Label loop_header; | 1028 Label loop_header; |
1024 Label loop_check; | 1029 Label loop_check; |
1025 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); | 1030 __ LoadRoot(t1, Heap::kUndefinedValueRootIndex); |
1026 __ Branch(&loop_check); | 1031 __ Branch(&loop_check); |
1027 __ bind(&loop_header); | 1032 __ bind(&loop_header); |
1028 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 1033 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
1029 __ push(t1); | 1034 __ push(t1); |
1030 // Continue loop if not done. | 1035 // Continue loop if not done. |
1031 __ bind(&loop_check); | 1036 __ bind(&loop_check); |
1032 __ Subu(t0, t0, Operand(kPointerSize)); | 1037 __ Subu(t0, t0, Operand(kPointerSize)); |
1033 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); | 1038 __ Branch(&loop_header, ge, t0, Operand(zero_reg)); |
1034 } | 1039 } |
1035 | 1040 |
1036 // Load bytecode offset and dispatch table into registers. | 1041 // Load accumulator and dispatch table into registers. |
1037 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1042 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1038 __ Addu(t3, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); | |
1039 __ li(kInterpreterBytecodeOffsetRegister, | |
1040 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | |
1041 __ li(kInterpreterDispatchTableRegister, | 1043 __ li(kInterpreterDispatchTableRegister, |
1042 Operand(ExternalReference::interpreter_dispatch_table_address( | 1044 Operand(ExternalReference::interpreter_dispatch_table_address( |
1043 masm->isolate()))); | 1045 masm->isolate()))); |
1044 | 1046 |
1045 // Dispatch to the first bytecode handler for the function. | 1047 // Dispatch to the first bytecode handler for the function. |
1046 __ Addu(a0, kInterpreterBytecodeArrayRegister, | 1048 __ Addu(a0, kInterpreterBytecodeArrayRegister, |
1047 kInterpreterBytecodeOffsetRegister); | 1049 kInterpreterBytecodeOffsetRegister); |
1048 __ lbu(a0, MemOperand(a0)); | 1050 __ lbu(a0, MemOperand(a0)); |
1049 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); | 1051 __ Lsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); |
1050 __ lw(at, MemOperand(at)); | 1052 __ lw(at, MemOperand(at)); |
(...skipping 1851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2902 } | 2904 } |
2903 } | 2905 } |
2904 | 2906 |
2905 | 2907 |
2906 #undef __ | 2908 #undef __ |
2907 | 2909 |
2908 } // namespace internal | 2910 } // namespace internal |
2909 } // namespace v8 | 2911 } // namespace v8 |
2910 | 2912 |
2911 #endif // V8_TARGET_ARCH_MIPS | 2913 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |