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 #include "src/v8.h" | 7 #include "src/v8.h" |
8 | 8 |
9 #if V8_TARGET_ARCH_MIPS64 | 9 #if V8_TARGET_ARCH_MIPS64 |
10 | 10 |
(...skipping 4850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4861 sdc1(reg, MemOperand(sp, i * kDoubleSize)); | 4861 sdc1(reg, MemOperand(sp, i * kDoubleSize)); |
4862 } | 4862 } |
4863 } | 4863 } |
4864 | 4864 |
4865 // Reserve place for the return address, stack space and an optional slot | 4865 // Reserve place for the return address, stack space and an optional slot |
4866 // (used by the DirectCEntryStub to hold the return value if a struct is | 4866 // (used by the DirectCEntryStub to hold the return value if a struct is |
4867 // returned) and align the frame preparing for calling the runtime function. | 4867 // returned) and align the frame preparing for calling the runtime function. |
4868 DCHECK(stack_space >= 0); | 4868 DCHECK(stack_space >= 0); |
4869 Dsubu(sp, sp, Operand((stack_space + 2) * kPointerSize)); | 4869 Dsubu(sp, sp, Operand((stack_space + 2) * kPointerSize)); |
4870 if (frame_alignment > 0) { | 4870 if (frame_alignment > 0) { |
4871 DCHECK(IsPowerOf2(frame_alignment)); | 4871 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
4872 And(sp, sp, Operand(-frame_alignment)); // Align stack. | 4872 And(sp, sp, Operand(-frame_alignment)); // Align stack. |
4873 } | 4873 } |
4874 | 4874 |
4875 // Set the exit frame sp value to point just before the return address | 4875 // Set the exit frame sp value to point just before the return address |
4876 // location. | 4876 // location. |
4877 daddiu(at, sp, kPointerSize); | 4877 daddiu(at, sp, kPointerSize); |
4878 sd(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); | 4878 sd(at, MemOperand(fp, ExitFrameConstants::kSPOffset)); |
4879 } | 4879 } |
4880 | 4880 |
4881 | 4881 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4959 } | 4959 } |
4960 | 4960 |
4961 | 4961 |
4962 void MacroAssembler::AssertStackIsAligned() { | 4962 void MacroAssembler::AssertStackIsAligned() { |
4963 if (emit_debug_code()) { | 4963 if (emit_debug_code()) { |
4964 const int frame_alignment = ActivationFrameAlignment(); | 4964 const int frame_alignment = ActivationFrameAlignment(); |
4965 const int frame_alignment_mask = frame_alignment - 1; | 4965 const int frame_alignment_mask = frame_alignment - 1; |
4966 | 4966 |
4967 if (frame_alignment > kPointerSize) { | 4967 if (frame_alignment > kPointerSize) { |
4968 Label alignment_as_expected; | 4968 Label alignment_as_expected; |
4969 DCHECK(IsPowerOf2(frame_alignment)); | 4969 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
4970 andi(at, sp, frame_alignment_mask); | 4970 andi(at, sp, frame_alignment_mask); |
4971 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); | 4971 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); |
4972 // Don't use Check here, as it will call Runtime_Abort re-entering here. | 4972 // Don't use Check here, as it will call Runtime_Abort re-entering here. |
4973 stop("Unexpected stack alignment"); | 4973 stop("Unexpected stack alignment"); |
4974 bind(&alignment_as_expected); | 4974 bind(&alignment_as_expected); |
4975 } | 4975 } |
4976 } | 4976 } |
4977 } | 4977 } |
4978 | 4978 |
4979 | 4979 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5423 // Both ABIs: Remaining arguments are pushed on the stack, above (higher | 5423 // Both ABIs: Remaining arguments are pushed on the stack, above (higher |
5424 // address than) the (O32) argument slots. (arg slot calculation handled by | 5424 // address than) the (O32) argument slots. (arg slot calculation handled by |
5425 // CalculateStackPassedWords()). | 5425 // CalculateStackPassedWords()). |
5426 int stack_passed_arguments = CalculateStackPassedWords( | 5426 int stack_passed_arguments = CalculateStackPassedWords( |
5427 num_reg_arguments, num_double_arguments); | 5427 num_reg_arguments, num_double_arguments); |
5428 if (frame_alignment > kPointerSize) { | 5428 if (frame_alignment > kPointerSize) { |
5429 // Make stack end at alignment and make room for num_arguments - 4 words | 5429 // Make stack end at alignment and make room for num_arguments - 4 words |
5430 // and the original value of sp. | 5430 // and the original value of sp. |
5431 mov(scratch, sp); | 5431 mov(scratch, sp); |
5432 Dsubu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); | 5432 Dsubu(sp, sp, Operand((stack_passed_arguments + 1) * kPointerSize)); |
5433 DCHECK(IsPowerOf2(frame_alignment)); | 5433 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
5434 And(sp, sp, Operand(-frame_alignment)); | 5434 And(sp, sp, Operand(-frame_alignment)); |
5435 sd(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); | 5435 sd(scratch, MemOperand(sp, stack_passed_arguments * kPointerSize)); |
5436 } else { | 5436 } else { |
5437 Dsubu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); | 5437 Dsubu(sp, sp, Operand(stack_passed_arguments * kPointerSize)); |
5438 } | 5438 } |
5439 } | 5439 } |
5440 | 5440 |
5441 | 5441 |
5442 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, | 5442 void MacroAssembler::PrepareCallCFunction(int num_reg_arguments, |
5443 Register scratch) { | 5443 Register scratch) { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5480 // running in the simulator. The simulator has its own alignment check which | 5480 // running in the simulator. The simulator has its own alignment check which |
5481 // provides more information. | 5481 // provides more information. |
5482 // The argument stots are presumed to have been set up by | 5482 // The argument stots are presumed to have been set up by |
5483 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. | 5483 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. |
5484 | 5484 |
5485 #if V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 | 5485 #if V8_HOST_ARCH_MIPS || V8_HOST_ARCH_MIPS64 |
5486 if (emit_debug_code()) { | 5486 if (emit_debug_code()) { |
5487 int frame_alignment = base::OS::ActivationFrameAlignment(); | 5487 int frame_alignment = base::OS::ActivationFrameAlignment(); |
5488 int frame_alignment_mask = frame_alignment - 1; | 5488 int frame_alignment_mask = frame_alignment - 1; |
5489 if (frame_alignment > kPointerSize) { | 5489 if (frame_alignment > kPointerSize) { |
5490 DCHECK(IsPowerOf2(frame_alignment)); | 5490 DCHECK(base::bits::IsPowerOfTwo32(frame_alignment)); |
5491 Label alignment_as_expected; | 5491 Label alignment_as_expected; |
5492 And(at, sp, Operand(frame_alignment_mask)); | 5492 And(at, sp, Operand(frame_alignment_mask)); |
5493 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); | 5493 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); |
5494 // Don't use Check here, as it will call Runtime_Abort possibly | 5494 // Don't use Check here, as it will call Runtime_Abort possibly |
5495 // re-entering here. | 5495 // re-entering here. |
5496 stop("Unexpected alignment in CallCFunction"); | 5496 stop("Unexpected alignment in CallCFunction"); |
5497 bind(&alignment_as_expected); | 5497 bind(&alignment_as_expected); |
5498 } | 5498 } |
5499 } | 5499 } |
5500 #endif // V8_HOST_ARCH_MIPS | 5500 #endif // V8_HOST_ARCH_MIPS |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6101 } | 6101 } |
6102 if (ms.shift() > 0) sra(result, result, ms.shift()); | 6102 if (ms.shift() > 0) sra(result, result, ms.shift()); |
6103 srl(at, dividend, 31); | 6103 srl(at, dividend, 31); |
6104 Addu(result, result, Operand(at)); | 6104 Addu(result, result, Operand(at)); |
6105 } | 6105 } |
6106 | 6106 |
6107 | 6107 |
6108 } } // namespace v8::internal | 6108 } } // namespace v8::internal |
6109 | 6109 |
6110 #endif // V8_TARGET_ARCH_MIPS64 | 6110 #endif // V8_TARGET_ARCH_MIPS64 |
OLD | NEW |