Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: src/mips/macro-assembler-mips.cc

Issue 358363002: Move platform abstraction to base library (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_MIPS 9 #if V8_TARGET_ARCH_MIPS
10 10
(...skipping 4693 matching lines...) Expand 10 before | Expand all | Expand 10 after
4704 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); 4704 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset));
4705 } 4705 }
4706 4706
4707 4707
4708 int MacroAssembler::ActivationFrameAlignment() { 4708 int MacroAssembler::ActivationFrameAlignment() {
4709 #if V8_HOST_ARCH_MIPS 4709 #if V8_HOST_ARCH_MIPS
4710 // Running on the real platform. Use the alignment as mandated by the local 4710 // Running on the real platform. Use the alignment as mandated by the local
4711 // environment. 4711 // environment.
4712 // Note: This will break if we ever start generating snapshots on one Mips 4712 // Note: This will break if we ever start generating snapshots on one Mips
4713 // platform for another Mips platform with a different alignment. 4713 // platform for another Mips platform with a different alignment.
4714 return OS::ActivationFrameAlignment(); 4714 return base::OS::ActivationFrameAlignment();
4715 #else // V8_HOST_ARCH_MIPS 4715 #else // V8_HOST_ARCH_MIPS
4716 // If we are using the simulator then we should always align to the expected 4716 // If we are using the simulator then we should always align to the expected
4717 // alignment. As the simulator is used to generate snapshots we do not know 4717 // alignment. As the simulator is used to generate snapshots we do not know
4718 // if the target platform will need alignment, so this is controlled from a 4718 // if the target platform will need alignment, so this is controlled from a
4719 // flag. 4719 // flag.
4720 return FLAG_sim_stack_alignment; 4720 return FLAG_sim_stack_alignment;
4721 #endif // V8_HOST_ARCH_MIPS 4721 #endif // V8_HOST_ARCH_MIPS
4722 } 4722 }
4723 4723
4724 4724
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after
5177 int num_double_arguments) { 5177 int num_double_arguments) {
5178 ASSERT(has_frame()); 5178 ASSERT(has_frame());
5179 // Make sure that the stack is aligned before calling a C function unless 5179 // Make sure that the stack is aligned before calling a C function unless
5180 // running in the simulator. The simulator has its own alignment check which 5180 // running in the simulator. The simulator has its own alignment check which
5181 // provides more information. 5181 // provides more information.
5182 // The argument stots are presumed to have been set up by 5182 // The argument stots are presumed to have been set up by
5183 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. 5183 // PrepareCallCFunction. The C function must be called via t9, for mips ABI.
5184 5184
5185 #if V8_HOST_ARCH_MIPS 5185 #if V8_HOST_ARCH_MIPS
5186 if (emit_debug_code()) { 5186 if (emit_debug_code()) {
5187 int frame_alignment = OS::ActivationFrameAlignment(); 5187 int frame_alignment = base::OS::ActivationFrameAlignment();
5188 int frame_alignment_mask = frame_alignment - 1; 5188 int frame_alignment_mask = frame_alignment - 1;
5189 if (frame_alignment > kPointerSize) { 5189 if (frame_alignment > kPointerSize) {
5190 ASSERT(IsPowerOf2(frame_alignment)); 5190 ASSERT(IsPowerOf2(frame_alignment));
5191 Label alignment_as_expected; 5191 Label alignment_as_expected;
5192 And(at, sp, Operand(frame_alignment_mask)); 5192 And(at, sp, Operand(frame_alignment_mask));
5193 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); 5193 Branch(&alignment_as_expected, eq, at, Operand(zero_reg));
5194 // Don't use Check here, as it will call Runtime_Abort possibly 5194 // Don't use Check here, as it will call Runtime_Abort possibly
5195 // re-entering here. 5195 // re-entering here.
5196 stop("Unexpected alignment in CallCFunction"); 5196 stop("Unexpected alignment in CallCFunction");
5197 bind(&alignment_as_expected); 5197 bind(&alignment_as_expected);
5198 } 5198 }
5199 } 5199 }
5200 #endif // V8_HOST_ARCH_MIPS 5200 #endif // V8_HOST_ARCH_MIPS
5201 5201
5202 // Just call directly. The function called cannot cause a GC, or 5202 // Just call directly. The function called cannot cause a GC, or
5203 // allow preemption, so the return address in the link register 5203 // allow preemption, so the return address in the link register
5204 // stays correct. 5204 // stays correct.
5205 5205
5206 if (!function.is(t9)) { 5206 if (!function.is(t9)) {
5207 mov(t9, function); 5207 mov(t9, function);
5208 function = t9; 5208 function = t9;
5209 } 5209 }
5210 5210
5211 Call(function); 5211 Call(function);
5212 5212
5213 int stack_passed_arguments = CalculateStackPassedWords( 5213 int stack_passed_arguments = CalculateStackPassedWords(
5214 num_reg_arguments, num_double_arguments); 5214 num_reg_arguments, num_double_arguments);
5215 5215
5216 if (OS::ActivationFrameAlignment() > kPointerSize) { 5216 if (base::OS::ActivationFrameAlignment() > kPointerSize) {
5217 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize)); 5217 lw(sp, MemOperand(sp, stack_passed_arguments * kPointerSize));
5218 } else { 5218 } else {
5219 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize))); 5219 Addu(sp, sp, Operand(stack_passed_arguments * sizeof(kPointerSize)));
5220 } 5220 }
5221 } 5221 }
5222 5222
5223 5223
5224 #undef BRANCH_ARGS_CHECK 5224 #undef BRANCH_ARGS_CHECK
5225 5225
5226 5226
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after
5690 // Create a new macro assembler pointing to the address of the code to patch. 5690 // Create a new macro assembler pointing to the address of the code to patch.
5691 // The size is adjusted with kGap on order for the assembler to generate size 5691 // The size is adjusted with kGap on order for the assembler to generate size
5692 // bytes of instructions without failing with buffer size constraints. 5692 // bytes of instructions without failing with buffer size constraints.
5693 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 5693 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
5694 } 5694 }
5695 5695
5696 5696
5697 CodePatcher::~CodePatcher() { 5697 CodePatcher::~CodePatcher() {
5698 // Indicate that code has changed. 5698 // Indicate that code has changed.
5699 if (flush_cache_ == FLUSH) { 5699 if (flush_cache_ == FLUSH) {
5700 CPU::FlushICache(address_, size_); 5700 CpuFeatures::FlushICache(address_, size_);
5701 } 5701 }
5702 5702
5703 // Check that the code was patched as expected. 5703 // Check that the code was patched as expected.
5704 ASSERT(masm_.pc_ == address_ + size_); 5704 ASSERT(masm_.pc_ == address_ + size_);
5705 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 5705 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
5706 } 5706 }
5707 5707
5708 5708
5709 void CodePatcher::Emit(Instr instr) { 5709 void CodePatcher::Emit(Instr instr) {
5710 masm()->emit(instr); 5710 masm()->emit(instr);
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
5756 } 5756 }
5757 if (ms.shift() > 0) sra(result, result, ms.shift()); 5757 if (ms.shift() > 0) sra(result, result, ms.shift());
5758 srl(at, dividend, 31); 5758 srl(at, dividend, 31);
5759 Addu(result, result, Operand(at)); 5759 Addu(result, result, Operand(at));
5760 } 5760 }
5761 5761
5762 5762
5763 } } // namespace v8::internal 5763 } } // namespace v8::internal
5764 5764
5765 #endif // V8_TARGET_ARCH_MIPS 5765 #endif // V8_TARGET_ARCH_MIPS
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698