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_MIPS64 | 5 #if V8_TARGET_ARCH_MIPS64 |
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 973 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present); | 984 Heap::kUndefinedValueRootIndex, &bytecode_array_not_present); |
985 if (FLAG_debug_code) { | 985 if (FLAG_debug_code) { |
986 __ SmiTst(kInterpreterBytecodeArrayRegister, a4); | 986 __ SmiTst(kInterpreterBytecodeArrayRegister, a4); |
987 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, | 987 __ Assert(ne, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, |
988 Operand(zero_reg)); | 988 Operand(zero_reg)); |
989 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4); | 989 __ GetObjectType(kInterpreterBytecodeArrayRegister, a4, a4); |
990 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, | 990 __ Assert(eq, kFunctionDataShouldBeBytecodeArrayOnInterpreterEntry, a4, |
991 Operand(BYTECODE_ARRAY_TYPE)); | 991 Operand(BYTECODE_ARRAY_TYPE)); |
992 } | 992 } |
993 | 993 |
994 // Push new.target, bytecode array and zero for bytecode array offset. | 994 // Load initial bytecode offset. |
995 __ Push(a3, kInterpreterBytecodeArrayRegister, zero_reg); | 995 __ li(kInterpreterBytecodeOffsetRegister, |
| 996 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); |
| 997 |
| 998 // Push new.target, bytecode array and Smi tagged bytecode array offset. |
| 999 __ SmiTag(a4, kInterpreterBytecodeOffsetRegister); |
| 1000 __ Push(a3, kInterpreterBytecodeArrayRegister, a4); |
996 | 1001 |
997 // Allocate the local and temporary register file on the stack. | 1002 // Allocate the local and temporary register file on the stack. |
998 { | 1003 { |
999 // Load frame size (word) from the BytecodeArray object. | 1004 // Load frame size (word) from the BytecodeArray object. |
1000 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister, | 1005 __ lw(a4, FieldMemOperand(kInterpreterBytecodeArrayRegister, |
1001 BytecodeArray::kFrameSizeOffset)); | 1006 BytecodeArray::kFrameSizeOffset)); |
1002 | 1007 |
1003 // Do a stack check to ensure we don't go over the limit. | 1008 // Do a stack check to ensure we don't go over the limit. |
1004 Label ok; | 1009 Label ok; |
1005 __ Dsubu(a5, sp, Operand(a4)); | 1010 __ Dsubu(a5, sp, Operand(a4)); |
1006 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); | 1011 __ LoadRoot(a2, Heap::kRealStackLimitRootIndex); |
1007 __ Branch(&ok, hs, a5, Operand(a2)); | 1012 __ Branch(&ok, hs, a5, Operand(a2)); |
1008 __ CallRuntime(Runtime::kThrowStackOverflow); | 1013 __ CallRuntime(Runtime::kThrowStackOverflow); |
1009 __ bind(&ok); | 1014 __ bind(&ok); |
1010 | 1015 |
1011 // If ok, push undefined as the initial value for all register file entries. | 1016 // If ok, push undefined as the initial value for all register file entries. |
1012 Label loop_header; | 1017 Label loop_header; |
1013 Label loop_check; | 1018 Label loop_check; |
1014 __ LoadRoot(a5, Heap::kUndefinedValueRootIndex); | 1019 __ LoadRoot(a5, Heap::kUndefinedValueRootIndex); |
1015 __ Branch(&loop_check); | 1020 __ Branch(&loop_check); |
1016 __ bind(&loop_header); | 1021 __ bind(&loop_header); |
1017 // TODO(rmcilroy): Consider doing more than one push per loop iteration. | 1022 // TODO(rmcilroy): Consider doing more than one push per loop iteration. |
1018 __ push(a5); | 1023 __ push(a5); |
1019 // Continue loop if not done. | 1024 // Continue loop if not done. |
1020 __ bind(&loop_check); | 1025 __ bind(&loop_check); |
1021 __ Dsubu(a4, a4, Operand(kPointerSize)); | 1026 __ Dsubu(a4, a4, Operand(kPointerSize)); |
1022 __ Branch(&loop_header, ge, a4, Operand(zero_reg)); | 1027 __ Branch(&loop_header, ge, a4, Operand(zero_reg)); |
1023 } | 1028 } |
1024 | 1029 |
1025 // Load bytecode offset and dispatch table into registers. | 1030 // Load accumulator and dispatch table into registers. |
1026 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); | 1031 __ LoadRoot(kInterpreterAccumulatorRegister, Heap::kUndefinedValueRootIndex); |
1027 __ Daddu(a7, fp, Operand(InterpreterFrameConstants::kRegisterFileFromFp)); | |
1028 __ li(kInterpreterBytecodeOffsetRegister, | |
1029 Operand(BytecodeArray::kHeaderSize - kHeapObjectTag)); | |
1030 __ li(kInterpreterDispatchTableRegister, | 1032 __ li(kInterpreterDispatchTableRegister, |
1031 Operand(ExternalReference::interpreter_dispatch_table_address( | 1033 Operand(ExternalReference::interpreter_dispatch_table_address( |
1032 masm->isolate()))); | 1034 masm->isolate()))); |
1033 | 1035 |
1034 // Dispatch to the first bytecode handler for the function. | 1036 // Dispatch to the first bytecode handler for the function. |
1035 __ Daddu(a0, kInterpreterBytecodeArrayRegister, | 1037 __ Daddu(a0, kInterpreterBytecodeArrayRegister, |
1036 kInterpreterBytecodeOffsetRegister); | 1038 kInterpreterBytecodeOffsetRegister); |
1037 __ lbu(a0, MemOperand(a0)); | 1039 __ lbu(a0, MemOperand(a0)); |
1038 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); | 1040 __ Dlsa(at, kInterpreterDispatchTableRegister, a0, kPointerSizeLog2); |
1039 __ ld(at, MemOperand(at)); | 1041 __ ld(at, MemOperand(at)); |
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2892 } | 2894 } |
2893 } | 2895 } |
2894 | 2896 |
2895 | 2897 |
2896 #undef __ | 2898 #undef __ |
2897 | 2899 |
2898 } // namespace internal | 2900 } // namespace internal |
2899 } // namespace v8 | 2901 } // namespace v8 |
2900 | 2902 |
2901 #endif // V8_TARGET_ARCH_MIPS64 | 2903 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |