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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_MIPS64 | 7 #if V8_TARGET_ARCH_MIPS64 |
8 | 8 |
9 #include "src/base/division-by-constant.h" | 9 #include "src/base/division-by-constant.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 5855 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5866 | 5866 |
5867 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 5867 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
5868 const Runtime::Function* function = Runtime::FunctionForId(fid); | 5868 const Runtime::Function* function = Runtime::FunctionForId(fid); |
5869 DCHECK_EQ(1, function->result_size); | 5869 DCHECK_EQ(1, function->result_size); |
5870 if (function->nargs >= 0) { | 5870 if (function->nargs >= 0) { |
5871 PrepareCEntryArgs(function->nargs); | 5871 PrepareCEntryArgs(function->nargs); |
5872 } | 5872 } |
5873 JumpToExternalReference(ExternalReference(fid, isolate())); | 5873 JumpToExternalReference(ExternalReference(fid, isolate())); |
5874 } | 5874 } |
5875 | 5875 |
5876 | |
5877 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, | 5876 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, |
5878 BranchDelaySlot bd) { | 5877 BranchDelaySlot bd, |
| 5878 bool builtin_exit_frame) { |
5879 PrepareCEntryFunction(builtin); | 5879 PrepareCEntryFunction(builtin); |
5880 CEntryStub stub(isolate(), 1); | 5880 CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack, |
| 5881 builtin_exit_frame); |
5881 Jump(stub.GetCode(), | 5882 Jump(stub.GetCode(), |
5882 RelocInfo::CODE_TARGET, | 5883 RelocInfo::CODE_TARGET, |
5883 al, | 5884 al, |
5884 zero_reg, | 5885 zero_reg, |
5885 Operand(zero_reg), | 5886 Operand(zero_reg), |
5886 bd); | 5887 bd); |
5887 } | 5888 } |
5888 | 5889 |
5889 | |
5890 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 5890 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
5891 Register scratch1, Register scratch2) { | 5891 Register scratch1, Register scratch2) { |
5892 if (FLAG_native_code_counters && counter->Enabled()) { | 5892 if (FLAG_native_code_counters && counter->Enabled()) { |
5893 li(scratch1, Operand(value)); | 5893 li(scratch1, Operand(value)); |
5894 li(scratch2, Operand(ExternalReference(counter))); | 5894 li(scratch2, Operand(ExternalReference(counter))); |
5895 sd(scratch1, MemOperand(scratch2)); | 5895 sd(scratch1, MemOperand(scratch2)); |
5896 } | 5896 } |
5897 } | 5897 } |
5898 | 5898 |
5899 | 5899 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6135 Daddu(fp, sp, Operand(fp_offset)); | 6135 Daddu(fp, sp, Operand(fp_offset)); |
6136 } | 6136 } |
6137 | 6137 |
6138 | 6138 |
6139 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 6139 void MacroAssembler::LeaveFrame(StackFrame::Type type) { |
6140 daddiu(sp, fp, 2 * kPointerSize); | 6140 daddiu(sp, fp, 2 * kPointerSize); |
6141 ld(ra, MemOperand(fp, 1 * kPointerSize)); | 6141 ld(ra, MemOperand(fp, 1 * kPointerSize)); |
6142 ld(fp, MemOperand(fp, 0 * kPointerSize)); | 6142 ld(fp, MemOperand(fp, 0 * kPointerSize)); |
6143 } | 6143 } |
6144 | 6144 |
6145 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { | 6145 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, |
| 6146 StackFrame::Type frame_type) { |
| 6147 DCHECK(frame_type == StackFrame::EXIT || |
| 6148 frame_type == StackFrame::BUILTIN_EXIT); |
| 6149 |
6146 // Set up the frame structure on the stack. | 6150 // Set up the frame structure on the stack. |
6147 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); | 6151 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); |
6148 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); | 6152 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); |
6149 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); | 6153 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); |
6150 | 6154 |
6151 // This is how the stack will look: | 6155 // This is how the stack will look: |
6152 // fp + 2 (==kCallerSPDisplacement) - old stack's end | 6156 // fp + 2 (==kCallerSPDisplacement) - old stack's end |
6153 // [fp + 1 (==kCallerPCOffset)] - saved old ra | 6157 // [fp + 1 (==kCallerPCOffset)] - saved old ra |
6154 // [fp + 0 (==kCallerFPOffset)] - saved old fp | 6158 // [fp + 0 (==kCallerFPOffset)] - saved old fp |
6155 // [fp - 1 StackFrame::EXIT Smi | 6159 // [fp - 1 StackFrame::EXIT Smi |
6156 // [fp - 2 (==kSPOffset)] - sp of the called function | 6160 // [fp - 2 (==kSPOffset)] - sp of the called function |
6157 // [fp - 3 (==kCodeOffset)] - CodeObject | 6161 // [fp - 3 (==kCodeOffset)] - CodeObject |
6158 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the | 6162 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the |
6159 // new stack (will contain saved ra) | 6163 // new stack (will contain saved ra) |
6160 | 6164 |
6161 // Save registers and reserve room for saved entry sp and code object. | 6165 // Save registers and reserve room for saved entry sp and code object. |
6162 daddiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); | 6166 daddiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); |
6163 sd(ra, MemOperand(sp, 4 * kPointerSize)); | 6167 sd(ra, MemOperand(sp, 4 * kPointerSize)); |
6164 sd(fp, MemOperand(sp, 3 * kPointerSize)); | 6168 sd(fp, MemOperand(sp, 3 * kPointerSize)); |
6165 li(at, Operand(Smi::FromInt(StackFrame::EXIT))); | 6169 li(at, Operand(Smi::FromInt(frame_type))); |
6166 sd(at, MemOperand(sp, 2 * kPointerSize)); | 6170 sd(at, MemOperand(sp, 2 * kPointerSize)); |
6167 // Set up new frame pointer. | 6171 // Set up new frame pointer. |
6168 daddiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); | 6172 daddiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); |
6169 | 6173 |
6170 if (emit_debug_code()) { | 6174 if (emit_debug_code()) { |
6171 sd(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 6175 sd(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
6172 } | 6176 } |
6173 | 6177 |
6174 // Accessed from ExitFrame::code_slot. | 6178 // Accessed from ExitFrame::code_slot. |
6175 li(t8, Operand(CodeObject()), CONSTANT_SIZE); | 6179 li(t8, Operand(CodeObject()), CONSTANT_SIZE); |
(...skipping 1030 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7206 if (mag.shift > 0) sra(result, result, mag.shift); | 7210 if (mag.shift > 0) sra(result, result, mag.shift); |
7207 srl(at, dividend, 31); | 7211 srl(at, dividend, 31); |
7208 Addu(result, result, Operand(at)); | 7212 Addu(result, result, Operand(at)); |
7209 } | 7213 } |
7210 | 7214 |
7211 | 7215 |
7212 } // namespace internal | 7216 } // namespace internal |
7213 } // namespace v8 | 7217 } // namespace v8 |
7214 | 7218 |
7215 #endif // V8_TARGET_ARCH_MIPS64 | 7219 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |