OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // | 2 // |
3 // Redistribution and use in source and binary forms, with or without | 3 // Redistribution and use in source and binary forms, with or without |
4 // modification, are permitted provided that the following conditions are | 4 // modification, are permitted provided that the following conditions are |
5 // met: | 5 // met: |
6 // | 6 // |
7 // * Redistributions of source code must retain the above copyright | 7 // * Redistributions of source code must retain the above copyright |
8 // notice, this list of conditions and the following disclaimer. | 8 // notice, this list of conditions and the following disclaimer. |
9 // * Redistributions in binary form must reproduce the above | 9 // * Redistributions in binary form must reproduce the above |
10 // copyright notice, this list of conditions and the following | 10 // copyright notice, this list of conditions and the following |
(...skipping 15 matching lines...) Expand all Loading... |
26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 26 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 27 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
28 | 28 |
29 #include "src/v8.h" | 29 #include "src/v8.h" |
30 | 30 |
31 #if V8_TARGET_ARCH_ARM64 | 31 #if V8_TARGET_ARCH_ARM64 |
32 | 32 |
33 #define ARM64_DEFINE_REG_STATICS | 33 #define ARM64_DEFINE_REG_STATICS |
34 | 34 |
35 #include "src/arm64/assembler-arm64-inl.h" | 35 #include "src/arm64/assembler-arm64-inl.h" |
| 36 #include "src/base/bits.h" |
36 #include "src/base/cpu.h" | 37 #include "src/base/cpu.h" |
37 | 38 |
38 namespace v8 { | 39 namespace v8 { |
39 namespace internal { | 40 namespace internal { |
40 | 41 |
41 | 42 |
42 // ----------------------------------------------------------------------------- | 43 // ----------------------------------------------------------------------------- |
43 // CpuFeatures implementation. | 44 // CpuFeatures implementation. |
44 | 45 |
45 void CpuFeatures::ProbeImpl(bool cross_compile) { | 46 void CpuFeatures::ProbeImpl(bool cross_compile) { |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 desc->buffer_size = buffer_size_; | 595 desc->buffer_size = buffer_size_; |
595 desc->instr_size = pc_offset(); | 596 desc->instr_size = pc_offset(); |
596 desc->reloc_size = (reinterpret_cast<byte*>(buffer_) + buffer_size_) - | 597 desc->reloc_size = (reinterpret_cast<byte*>(buffer_) + buffer_size_) - |
597 reloc_info_writer.pos(); | 598 reloc_info_writer.pos(); |
598 desc->origin = this; | 599 desc->origin = this; |
599 } | 600 } |
600 } | 601 } |
601 | 602 |
602 | 603 |
603 void Assembler::Align(int m) { | 604 void Assembler::Align(int m) { |
604 DCHECK(m >= 4 && IsPowerOf2(m)); | 605 DCHECK(m >= 4 && base::bits::IsPowerOfTwo32(m)); |
605 while ((pc_offset() & (m - 1)) != 0) { | 606 while ((pc_offset() & (m - 1)) != 0) { |
606 nop(); | 607 nop(); |
607 } | 608 } |
608 } | 609 } |
609 | 610 |
610 | 611 |
611 void Assembler::CheckLabelLinkChain(Label const * label) { | 612 void Assembler::CheckLabelLinkChain(Label const * label) { |
612 #ifdef DEBUG | 613 #ifdef DEBUG |
613 if (label->is_linked()) { | 614 if (label->is_linked()) { |
614 int linkoffset = label->pos(); | 615 int linkoffset = label->pos(); |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2201 Emit(HLT | ImmException(code)); | 2202 Emit(HLT | ImmException(code)); |
2202 } | 2203 } |
2203 | 2204 |
2204 | 2205 |
2205 void Assembler::brk(int code) { | 2206 void Assembler::brk(int code) { |
2206 DCHECK(is_uint16(code)); | 2207 DCHECK(is_uint16(code)); |
2207 Emit(BRK | ImmException(code)); | 2208 Emit(BRK | ImmException(code)); |
2208 } | 2209 } |
2209 | 2210 |
2210 | 2211 |
| 2212 void Assembler::EmitStringData(const char* string) { |
| 2213 size_t len = strlen(string) + 1; |
| 2214 DCHECK(RoundUp(len, kInstructionSize) <= static_cast<size_t>(kGap)); |
| 2215 EmitData(string, len); |
| 2216 // Pad with NULL characters until pc_ is aligned. |
| 2217 const char pad[] = {'\0', '\0', '\0', '\0'}; |
| 2218 STATIC_ASSERT(sizeof(pad) == kInstructionSize); |
| 2219 EmitData(pad, RoundUp(pc_offset(), kInstructionSize) - pc_offset()); |
| 2220 } |
| 2221 |
| 2222 |
2211 void Assembler::debug(const char* message, uint32_t code, Instr params) { | 2223 void Assembler::debug(const char* message, uint32_t code, Instr params) { |
2212 #ifdef USE_SIMULATOR | 2224 #ifdef USE_SIMULATOR |
2213 // Don't generate simulator specific code if we are building a snapshot, which | 2225 // Don't generate simulator specific code if we are building a snapshot, which |
2214 // might be run on real hardware. | 2226 // might be run on real hardware. |
2215 if (!serializer_enabled()) { | 2227 if (!serializer_enabled()) { |
2216 // The arguments to the debug marker need to be contiguous in memory, so | 2228 // The arguments to the debug marker need to be contiguous in memory, so |
2217 // make sure we don't try to emit pools. | 2229 // make sure we don't try to emit pools. |
2218 BlockPoolsScope scope(this); | 2230 BlockPoolsScope scope(this); |
2219 | 2231 |
2220 Label start; | 2232 Label start; |
(...skipping 899 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3120 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); | 3132 movz(scratch, (target_offset >> 16) & 0xFFFF, 16); |
3121 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); | 3133 movk(scratch, (target_offset >> 32) & 0xFFFF, 32); |
3122 DCHECK((target_offset >> 48) == 0); | 3134 DCHECK((target_offset >> 48) == 0); |
3123 add(rd, rd, scratch); | 3135 add(rd, rd, scratch); |
3124 } | 3136 } |
3125 | 3137 |
3126 | 3138 |
3127 } } // namespace v8::internal | 3139 } } // namespace v8::internal |
3128 | 3140 |
3129 #endif // V8_TARGET_ARCH_ARM64 | 3141 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |