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_MIPS | 7 #if V8_TARGET_ARCH_MIPS |
8 | 8 |
9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
10 #include "src/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 5624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5635 | 5635 |
5636 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { | 5636 void MacroAssembler::TailCallRuntime(Runtime::FunctionId fid) { |
5637 const Runtime::Function* function = Runtime::FunctionForId(fid); | 5637 const Runtime::Function* function = Runtime::FunctionForId(fid); |
5638 DCHECK_EQ(1, function->result_size); | 5638 DCHECK_EQ(1, function->result_size); |
5639 if (function->nargs >= 0) { | 5639 if (function->nargs >= 0) { |
5640 PrepareCEntryArgs(function->nargs); | 5640 PrepareCEntryArgs(function->nargs); |
5641 } | 5641 } |
5642 JumpToExternalReference(ExternalReference(fid, isolate())); | 5642 JumpToExternalReference(ExternalReference(fid, isolate())); |
5643 } | 5643 } |
5644 | 5644 |
| 5645 |
5645 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, | 5646 void MacroAssembler::JumpToExternalReference(const ExternalReference& builtin, |
5646 BranchDelaySlot bd, | 5647 BranchDelaySlot bd) { |
5647 bool builtin_exit_frame) { | |
5648 PrepareCEntryFunction(builtin); | 5648 PrepareCEntryFunction(builtin); |
5649 CEntryStub stub(isolate(), 1, kDontSaveFPRegs, kArgvOnStack, | 5649 CEntryStub stub(isolate(), 1); |
5650 builtin_exit_frame); | |
5651 Jump(stub.GetCode(), | 5650 Jump(stub.GetCode(), |
5652 RelocInfo::CODE_TARGET, | 5651 RelocInfo::CODE_TARGET, |
5653 al, | 5652 al, |
5654 zero_reg, | 5653 zero_reg, |
5655 Operand(zero_reg), | 5654 Operand(zero_reg), |
5656 bd); | 5655 bd); |
5657 } | 5656 } |
5658 | 5657 |
| 5658 |
5659 void MacroAssembler::SetCounter(StatsCounter* counter, int value, | 5659 void MacroAssembler::SetCounter(StatsCounter* counter, int value, |
5660 Register scratch1, Register scratch2) { | 5660 Register scratch1, Register scratch2) { |
5661 if (FLAG_native_code_counters && counter->Enabled()) { | 5661 if (FLAG_native_code_counters && counter->Enabled()) { |
5662 li(scratch1, Operand(value)); | 5662 li(scratch1, Operand(value)); |
5663 li(scratch2, Operand(ExternalReference(counter))); | 5663 li(scratch2, Operand(ExternalReference(counter))); |
5664 sw(scratch1, MemOperand(scratch2)); | 5664 sw(scratch1, MemOperand(scratch2)); |
5665 } | 5665 } |
5666 } | 5666 } |
5667 | 5667 |
5668 | 5668 |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5903 Addu(fp, sp, Operand(fp_offset)); | 5903 Addu(fp, sp, Operand(fp_offset)); |
5904 } | 5904 } |
5905 | 5905 |
5906 | 5906 |
5907 void MacroAssembler::LeaveFrame(StackFrame::Type type) { | 5907 void MacroAssembler::LeaveFrame(StackFrame::Type type) { |
5908 addiu(sp, fp, 2 * kPointerSize); | 5908 addiu(sp, fp, 2 * kPointerSize); |
5909 lw(ra, MemOperand(fp, 1 * kPointerSize)); | 5909 lw(ra, MemOperand(fp, 1 * kPointerSize)); |
5910 lw(fp, MemOperand(fp, 0 * kPointerSize)); | 5910 lw(fp, MemOperand(fp, 0 * kPointerSize)); |
5911 } | 5911 } |
5912 | 5912 |
5913 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space, | 5913 void MacroAssembler::EnterExitFrame(bool save_doubles, int stack_space) { |
5914 StackFrame::Type frame_type) { | |
5915 DCHECK(frame_type == StackFrame::EXIT || | |
5916 frame_type == StackFrame::BUILTIN_EXIT); | |
5917 | |
5918 // Set up the frame structure on the stack. | 5914 // Set up the frame structure on the stack. |
5919 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); | 5915 STATIC_ASSERT(2 * kPointerSize == ExitFrameConstants::kCallerSPDisplacement); |
5920 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); | 5916 STATIC_ASSERT(1 * kPointerSize == ExitFrameConstants::kCallerPCOffset); |
5921 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); | 5917 STATIC_ASSERT(0 * kPointerSize == ExitFrameConstants::kCallerFPOffset); |
5922 | 5918 |
5923 // This is how the stack will look: | 5919 // This is how the stack will look: |
5924 // fp + 2 (==kCallerSPDisplacement) - old stack's end | 5920 // fp + 2 (==kCallerSPDisplacement) - old stack's end |
5925 // [fp + 1 (==kCallerPCOffset)] - saved old ra | 5921 // [fp + 1 (==kCallerPCOffset)] - saved old ra |
5926 // [fp + 0 (==kCallerFPOffset)] - saved old fp | 5922 // [fp + 0 (==kCallerFPOffset)] - saved old fp |
5927 // [fp - 1 StackFrame::EXIT Smi | 5923 // [fp - 1 StackFrame::EXIT Smi |
5928 // [fp - 2 (==kSPOffset)] - sp of the called function | 5924 // [fp - 2 (==kSPOffset)] - sp of the called function |
5929 // [fp - 3 (==kCodeOffset)] - CodeObject | 5925 // [fp - 3 (==kCodeOffset)] - CodeObject |
5930 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the | 5926 // fp - (2 + stack_space + alignment) == sp == [fp - kSPOffset] - top of the |
5931 // new stack (will contain saved ra) | 5927 // new stack (will contain saved ra) |
5932 | 5928 |
5933 // Save registers and reserve room for saved entry sp and code object. | 5929 // Save registers and reserve room for saved entry sp and code object. |
5934 addiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); | 5930 addiu(sp, sp, -2 * kPointerSize - ExitFrameConstants::kFixedFrameSizeFromFp); |
5935 sw(ra, MemOperand(sp, 4 * kPointerSize)); | 5931 sw(ra, MemOperand(sp, 4 * kPointerSize)); |
5936 sw(fp, MemOperand(sp, 3 * kPointerSize)); | 5932 sw(fp, MemOperand(sp, 3 * kPointerSize)); |
5937 li(at, Operand(Smi::FromInt(frame_type))); | 5933 li(at, Operand(Smi::FromInt(StackFrame::EXIT))); |
5938 sw(at, MemOperand(sp, 2 * kPointerSize)); | 5934 sw(at, MemOperand(sp, 2 * kPointerSize)); |
5939 // Set up new frame pointer. | 5935 // Set up new frame pointer. |
5940 addiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); | 5936 addiu(fp, sp, ExitFrameConstants::kFixedFrameSizeFromFp); |
5941 | 5937 |
5942 if (emit_debug_code()) { | 5938 if (emit_debug_code()) { |
5943 sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 5939 sw(zero_reg, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
5944 } | 5940 } |
5945 | 5941 |
5946 // Accessed from ExitFrame::code_slot. | 5942 // Accessed from ExitFrame::code_slot. |
5947 li(t8, Operand(CodeObject()), CONSTANT_SIZE); | 5943 li(t8, Operand(CodeObject()), CONSTANT_SIZE); |
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6914 if (mag.shift > 0) sra(result, result, mag.shift); | 6910 if (mag.shift > 0) sra(result, result, mag.shift); |
6915 srl(at, dividend, 31); | 6911 srl(at, dividend, 31); |
6916 Addu(result, result, Operand(at)); | 6912 Addu(result, result, Operand(at)); |
6917 } | 6913 } |
6918 | 6914 |
6919 | 6915 |
6920 } // namespace internal | 6916 } // namespace internal |
6921 } // namespace v8 | 6917 } // namespace v8 |
6922 | 6918 |
6923 #endif // V8_TARGET_ARCH_MIPS | 6919 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |