| 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_ARM | 9 #if V8_TARGET_ARCH_ARM |
| 10 | 10 |
| (...skipping 1126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1137 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); | 1137 str(scratch1, FieldMemOperand(string, String::kHashFieldOffset)); |
| 1138 } | 1138 } |
| 1139 | 1139 |
| 1140 | 1140 |
| 1141 int MacroAssembler::ActivationFrameAlignment() { | 1141 int MacroAssembler::ActivationFrameAlignment() { |
| 1142 #if V8_HOST_ARCH_ARM | 1142 #if V8_HOST_ARCH_ARM |
| 1143 // Running on the real platform. Use the alignment as mandated by the local | 1143 // Running on the real platform. Use the alignment as mandated by the local |
| 1144 // environment. | 1144 // environment. |
| 1145 // Note: This will break if we ever start generating snapshots on one ARM | 1145 // Note: This will break if we ever start generating snapshots on one ARM |
| 1146 // platform for another ARM platform with a different alignment. | 1146 // platform for another ARM platform with a different alignment. |
| 1147 return OS::ActivationFrameAlignment(); | 1147 return base::OS::ActivationFrameAlignment(); |
| 1148 #else // V8_HOST_ARCH_ARM | 1148 #else // V8_HOST_ARCH_ARM |
| 1149 // If we are using the simulator then we should always align to the expected | 1149 // If we are using the simulator then we should always align to the expected |
| 1150 // alignment. As the simulator is used to generate snapshots we do not know | 1150 // alignment. As the simulator is used to generate snapshots we do not know |
| 1151 // if the target platform will need alignment, so this is controlled from a | 1151 // if the target platform will need alignment, so this is controlled from a |
| 1152 // flag. | 1152 // flag. |
| 1153 return FLAG_sim_stack_alignment; | 1153 return FLAG_sim_stack_alignment; |
| 1154 #endif // V8_HOST_ARCH_ARM | 1154 #endif // V8_HOST_ARCH_ARM |
| 1155 } | 1155 } |
| 1156 | 1156 |
| 1157 | 1157 |
| (...skipping 2430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3588 | 3588 |
| 3589 void MacroAssembler::CallCFunctionHelper(Register function, | 3589 void MacroAssembler::CallCFunctionHelper(Register function, |
| 3590 int num_reg_arguments, | 3590 int num_reg_arguments, |
| 3591 int num_double_arguments) { | 3591 int num_double_arguments) { |
| 3592 ASSERT(has_frame()); | 3592 ASSERT(has_frame()); |
| 3593 // Make sure that the stack is aligned before calling a C function unless | 3593 // Make sure that the stack is aligned before calling a C function unless |
| 3594 // running in the simulator. The simulator has its own alignment check which | 3594 // running in the simulator. The simulator has its own alignment check which |
| 3595 // provides more information. | 3595 // provides more information. |
| 3596 #if V8_HOST_ARCH_ARM | 3596 #if V8_HOST_ARCH_ARM |
| 3597 if (emit_debug_code()) { | 3597 if (emit_debug_code()) { |
| 3598 int frame_alignment = OS::ActivationFrameAlignment(); | 3598 int frame_alignment = base::OS::ActivationFrameAlignment(); |
| 3599 int frame_alignment_mask = frame_alignment - 1; | 3599 int frame_alignment_mask = frame_alignment - 1; |
| 3600 if (frame_alignment > kPointerSize) { | 3600 if (frame_alignment > kPointerSize) { |
| 3601 ASSERT(IsPowerOf2(frame_alignment)); | 3601 ASSERT(IsPowerOf2(frame_alignment)); |
| 3602 Label alignment_as_expected; | 3602 Label alignment_as_expected; |
| 3603 tst(sp, Operand(frame_alignment_mask)); | 3603 tst(sp, Operand(frame_alignment_mask)); |
| 3604 b(eq, &alignment_as_expected); | 3604 b(eq, &alignment_as_expected); |
| 3605 // Don't use Check here, as it will call Runtime_Abort possibly | 3605 // Don't use Check here, as it will call Runtime_Abort possibly |
| 3606 // re-entering here. | 3606 // re-entering here. |
| 3607 stop("Unexpected alignment"); | 3607 stop("Unexpected alignment"); |
| 3608 bind(&alignment_as_expected); | 3608 bind(&alignment_as_expected); |
| (...skipping 424 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4033 // Create a new macro assembler pointing to the address of the code to patch. | 4033 // Create a new macro assembler pointing to the address of the code to patch. |
| 4034 // The size is adjusted with kGap on order for the assembler to generate size | 4034 // The size is adjusted with kGap on order for the assembler to generate size |
| 4035 // bytes of instructions without failing with buffer size constraints. | 4035 // bytes of instructions without failing with buffer size constraints. |
| 4036 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 4036 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 4037 } | 4037 } |
| 4038 | 4038 |
| 4039 | 4039 |
| 4040 CodePatcher::~CodePatcher() { | 4040 CodePatcher::~CodePatcher() { |
| 4041 // Indicate that code has changed. | 4041 // Indicate that code has changed. |
| 4042 if (flush_cache_ == FLUSH) { | 4042 if (flush_cache_ == FLUSH) { |
| 4043 CPU::FlushICache(address_, size_); | 4043 CpuFeatures::FlushICache(address_, size_); |
| 4044 } | 4044 } |
| 4045 | 4045 |
| 4046 // Check that the code was patched as expected. | 4046 // Check that the code was patched as expected. |
| 4047 ASSERT(masm_.pc_ == address_ + size_); | 4047 ASSERT(masm_.pc_ == address_ + size_); |
| 4048 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); | 4048 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); |
| 4049 } | 4049 } |
| 4050 | 4050 |
| 4051 | 4051 |
| 4052 void CodePatcher::Emit(Instr instr) { | 4052 void CodePatcher::Emit(Instr instr) { |
| 4053 masm()->emit(instr); | 4053 masm()->emit(instr); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 4082 sub(result, result, Operand(dividend)); | 4082 sub(result, result, Operand(dividend)); |
| 4083 } | 4083 } |
| 4084 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); | 4084 if (ms.shift() > 0) mov(result, Operand(result, ASR, ms.shift())); |
| 4085 add(result, result, Operand(dividend, LSR, 31)); | 4085 add(result, result, Operand(dividend, LSR, 31)); |
| 4086 } | 4086 } |
| 4087 | 4087 |
| 4088 | 4088 |
| 4089 } } // namespace v8::internal | 4089 } } // namespace v8::internal |
| 4090 | 4090 |
| 4091 #endif // V8_TARGET_ARCH_ARM | 4091 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |