| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #include <limits.h> // For LONG_MIN, LONG_MAX. | 28 #include <limits.h> // For LONG_MIN, LONG_MAX. |
| 29 | 29 |
| 30 #include "v8.h" | 30 #include "v8.h" |
| 31 | 31 |
| 32 #if defined(V8_TARGET_ARCH_MIPS) | 32 #if V8_TARGET_ARCH_MIPS |
| 33 | 33 |
| 34 #include "bootstrapper.h" | 34 #include "bootstrapper.h" |
| 35 #include "codegen.h" | 35 #include "codegen.h" |
| 36 #include "debug.h" | 36 #include "debug.h" |
| 37 #include "runtime.h" | 37 #include "runtime.h" |
| 38 | 38 |
| 39 namespace v8 { | 39 namespace v8 { |
| 40 namespace internal { | 40 namespace internal { |
| 41 | 41 |
| 42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) | 42 MacroAssembler::MacroAssembler(Isolate* arg_isolate, void* buffer, int size) |
| (...skipping 4665 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4708 sll(scratch1, length, kSmiTagSize); | 4708 sll(scratch1, length, kSmiTagSize); |
| 4709 LoadRoot(scratch2, map_index); | 4709 LoadRoot(scratch2, map_index); |
| 4710 sw(scratch1, FieldMemOperand(string, String::kLengthOffset)); | 4710 sw(scratch1, FieldMemOperand(string, String::kLengthOffset)); |
| 4711 li(scratch1, Operand(String::kEmptyHashField)); | 4711 li(scratch1, Operand(String::kEmptyHashField)); |
| 4712 sw(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); | 4712 sw(scratch2, FieldMemOperand(string, HeapObject::kMapOffset)); |
| 4713 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); | 4713 sw(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); |
| 4714 } | 4714 } |
| 4715 | 4715 |
| 4716 | 4716 |
| 4717 int MacroAssembler::ActivationFrameAlignment() { | 4717 int MacroAssembler::ActivationFrameAlignment() { |
| 4718 #if defined(V8_HOST_ARCH_MIPS) | 4718 #if V8_HOST_ARCH_MIPS |
| 4719 // Running on the real platform. Use the alignment as mandated by the local | 4719 // Running on the real platform. Use the alignment as mandated by the local |
| 4720 // environment. | 4720 // environment. |
| 4721 // Note: This will break if we ever start generating snapshots on one Mips | 4721 // Note: This will break if we ever start generating snapshots on one Mips |
| 4722 // platform for another Mips platform with a different alignment. | 4722 // platform for another Mips platform with a different alignment. |
| 4723 return OS::ActivationFrameAlignment(); | 4723 return OS::ActivationFrameAlignment(); |
| 4724 #else // defined(V8_HOST_ARCH_MIPS) | 4724 #else // V8_HOST_ARCH_MIPS |
| 4725 // If we are using the simulator then we should always align to the expected | 4725 // If we are using the simulator then we should always align to the expected |
| 4726 // alignment. As the simulator is used to generate snapshots we do not know | 4726 // alignment. As the simulator is used to generate snapshots we do not know |
| 4727 // if the target platform will need alignment, so this is controlled from a | 4727 // if the target platform will need alignment, so this is controlled from a |
| 4728 // flag. | 4728 // flag. |
| 4729 return FLAG_sim_stack_alignment; | 4729 return FLAG_sim_stack_alignment; |
| 4730 #endif // defined(V8_HOST_ARCH_MIPS) | 4730 #endif // V8_HOST_ARCH_MIPS |
| 4731 } | 4731 } |
| 4732 | 4732 |
| 4733 | 4733 |
| 4734 void MacroAssembler::AssertStackIsAligned() { | 4734 void MacroAssembler::AssertStackIsAligned() { |
| 4735 if (emit_debug_code()) { | 4735 if (emit_debug_code()) { |
| 4736 const int frame_alignment = ActivationFrameAlignment(); | 4736 const int frame_alignment = ActivationFrameAlignment(); |
| 4737 const int frame_alignment_mask = frame_alignment - 1; | 4737 const int frame_alignment_mask = frame_alignment - 1; |
| 4738 | 4738 |
| 4739 if (frame_alignment > kPointerSize) { | 4739 if (frame_alignment > kPointerSize) { |
| 4740 Label alignment_as_expected; | 4740 Label alignment_as_expected; |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5051 void MacroAssembler::CallCFunctionHelper(Register function, | 5051 void MacroAssembler::CallCFunctionHelper(Register function, |
| 5052 int num_reg_arguments, | 5052 int num_reg_arguments, |
| 5053 int num_double_arguments) { | 5053 int num_double_arguments) { |
| 5054 ASSERT(has_frame()); | 5054 ASSERT(has_frame()); |
| 5055 // Make sure that the stack is aligned before calling a C function unless | 5055 // Make sure that the stack is aligned before calling a C function unless |
| 5056 // running in the simulator. The simulator has its own alignment check which | 5056 // running in the simulator. The simulator has its own alignment check which |
| 5057 // provides more information. | 5057 // provides more information. |
| 5058 // The argument stots are presumed to have been set up by | 5058 // The argument stots are presumed to have been set up by |
| 5059 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. | 5059 // PrepareCallCFunction. The C function must be called via t9, for mips ABI. |
| 5060 | 5060 |
| 5061 #if defined(V8_HOST_ARCH_MIPS) | 5061 #if V8_HOST_ARCH_MIPS |
| 5062 if (emit_debug_code()) { | 5062 if (emit_debug_code()) { |
| 5063 int frame_alignment = OS::ActivationFrameAlignment(); | 5063 int frame_alignment = OS::ActivationFrameAlignment(); |
| 5064 int frame_alignment_mask = frame_alignment - 1; | 5064 int frame_alignment_mask = frame_alignment - 1; |
| 5065 if (frame_alignment > kPointerSize) { | 5065 if (frame_alignment > kPointerSize) { |
| 5066 ASSERT(IsPowerOf2(frame_alignment)); | 5066 ASSERT(IsPowerOf2(frame_alignment)); |
| 5067 Label alignment_as_expected; | 5067 Label alignment_as_expected; |
| 5068 And(at, sp, Operand(frame_alignment_mask)); | 5068 And(at, sp, Operand(frame_alignment_mask)); |
| 5069 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); | 5069 Branch(&alignment_as_expected, eq, at, Operand(zero_reg)); |
| 5070 // Don't use Check here, as it will call Runtime_Abort possibly | 5070 // Don't use Check here, as it will call Runtime_Abort possibly |
| 5071 // re-entering here. | 5071 // re-entering here. |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5548 opcode == BGTZL); | 5548 opcode == BGTZL); |
| 5549 opcode = (cond == eq) ? BEQ : BNE; | 5549 opcode = (cond == eq) ? BEQ : BNE; |
| 5550 instr = (instr & ~kOpcodeMask) | opcode; | 5550 instr = (instr & ~kOpcodeMask) | opcode; |
| 5551 masm_.emit(instr); | 5551 masm_.emit(instr); |
| 5552 } | 5552 } |
| 5553 | 5553 |
| 5554 | 5554 |
| 5555 } } // namespace v8::internal | 5555 } } // namespace v8::internal |
| 5556 | 5556 |
| 5557 #endif // V8_TARGET_ARCH_MIPS | 5557 #endif // V8_TARGET_ARCH_MIPS |
| OLD | NEW |