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 <stdarg.h> | 5 #include <stdarg.h> |
6 #include <stdlib.h> | 6 #include <stdlib.h> |
7 #include <cmath> | 7 #include <cmath> |
8 | 8 |
9 #if V8_TARGET_ARCH_ARM | 9 #if V8_TARGET_ARCH_ARM |
10 | 10 |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)) >> 2; | 562 return static_cast<uint32_t>(reinterpret_cast<uintptr_t>(key)) >> 2; |
563 } | 563 } |
564 | 564 |
565 | 565 |
566 static bool AllOnOnePage(uintptr_t start, int size) { | 566 static bool AllOnOnePage(uintptr_t start, int size) { |
567 intptr_t start_page = (start & ~CachePage::kPageMask); | 567 intptr_t start_page = (start & ~CachePage::kPageMask); |
568 intptr_t end_page = ((start + size) & ~CachePage::kPageMask); | 568 intptr_t end_page = ((start + size) & ~CachePage::kPageMask); |
569 return start_page == end_page; | 569 return start_page == end_page; |
570 } | 570 } |
571 | 571 |
572 | |
573 void Simulator::set_last_debugger_input(char* input) { | 572 void Simulator::set_last_debugger_input(char* input) { |
574 DeleteArray(last_debugger_input_); | 573 DeleteArray(last_debugger_input_); |
575 last_debugger_input_ = input; | 574 last_debugger_input_ = input; |
576 } | 575 } |
577 | 576 |
578 void Simulator::FlushICache(base::CustomMatcherHashMap* i_cache, | 577 void Simulator::FlushICache(base::CustomMatcherHashMap* i_cache, |
579 void* start_addr, size_t size) { | 578 void* start_addr, size_t size) { |
580 intptr_t start = reinterpret_cast<intptr_t>(start_addr); | 579 intptr_t start = reinterpret_cast<intptr_t>(start_addr); |
581 int intra_line = (start & CachePage::kLineMask); | 580 int intra_line = (start & CachePage::kLineMask); |
582 start -= intra_line; | 581 start -= intra_line; |
(...skipping 3603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4186 get_q_register(Vm, src2); | 4185 get_q_register(Vm, src2); |
4187 int boundary = kSimd128Size - imm4; | 4186 int boundary = kSimd128Size - imm4; |
4188 int i = 0; | 4187 int i = 0; |
4189 for (; i < boundary; i++) { | 4188 for (; i < boundary; i++) { |
4190 dst[i] = src1[i + imm4]; | 4189 dst[i] = src1[i + imm4]; |
4191 } | 4190 } |
4192 for (; i < 16; i++) { | 4191 for (; i < 16; i++) { |
4193 dst[i] = src2[i - boundary]; | 4192 dst[i] = src2[i - boundary]; |
4194 } | 4193 } |
4195 set_q_register(Vd, dst); | 4194 set_q_register(Vd, dst); |
| 4195 } else if (instr->Bits(11, 7) == 0xA && instr->Bit(4) == 1) { |
| 4196 // vshl.i<size> Qd, Qm, shift |
| 4197 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); |
| 4198 int shift = instr->Bits(21, 16) - size; |
| 4199 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 4200 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 4201 NeonSize ns = static_cast<NeonSize>(size / 16); |
| 4202 switch (ns) { |
| 4203 case Neon8: { |
| 4204 uint8_t src[16]; |
| 4205 get_q_register(Vm, src); |
| 4206 for (int i = 0; i < 16; i++) { |
| 4207 src[i] <<= shift; |
| 4208 } |
| 4209 set_q_register(Vd, src); |
| 4210 break; |
| 4211 } |
| 4212 case Neon16: { |
| 4213 uint16_t src[8]; |
| 4214 get_q_register(Vm, src); |
| 4215 for (int i = 0; i < 8; i++) { |
| 4216 src[i] <<= shift; |
| 4217 } |
| 4218 set_q_register(Vd, src); |
| 4219 break; |
| 4220 } |
| 4221 case Neon32: { |
| 4222 uint32_t src[4]; |
| 4223 get_q_register(Vm, src); |
| 4224 for (int i = 0; i < 4; i++) { |
| 4225 src[i] <<= shift; |
| 4226 } |
| 4227 set_q_register(Vd, src); |
| 4228 break; |
| 4229 } |
| 4230 default: |
| 4231 UNREACHABLE(); |
| 4232 break; |
| 4233 } |
| 4234 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1) { |
| 4235 // vshr.s<size> Qd, Qm, shift |
| 4236 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); |
| 4237 int shift = 2 * size - instr->Bits(21, 16); |
| 4238 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 4239 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 4240 NeonSize ns = static_cast<NeonSize>(size / 16); |
| 4241 switch (ns) { |
| 4242 case Neon8: { |
| 4243 int8_t src[16]; |
| 4244 get_q_register(Vm, src); |
| 4245 for (int i = 0; i < 16; i++) { |
| 4246 src[i] = ArithmeticShiftRight(src[i], shift); |
| 4247 } |
| 4248 set_q_register(Vd, src); |
| 4249 break; |
| 4250 } |
| 4251 case Neon16: { |
| 4252 int16_t src[8]; |
| 4253 get_q_register(Vm, src); |
| 4254 for (int i = 0; i < 8; i++) { |
| 4255 src[i] = ArithmeticShiftRight(src[i], shift); |
| 4256 } |
| 4257 set_q_register(Vd, src); |
| 4258 break; |
| 4259 } |
| 4260 case Neon32: { |
| 4261 int32_t src[4]; |
| 4262 get_q_register(Vm, src); |
| 4263 for (int i = 0; i < 4; i++) { |
| 4264 src[i] = ArithmeticShiftRight(src[i], shift); |
| 4265 } |
| 4266 set_q_register(Vd, src); |
| 4267 break; |
| 4268 } |
| 4269 default: |
| 4270 UNREACHABLE(); |
| 4271 break; |
| 4272 } |
4196 } else { | 4273 } else { |
4197 UNIMPLEMENTED(); | 4274 UNIMPLEMENTED(); |
4198 } | 4275 } |
4199 break; | 4276 break; |
4200 case 6: | 4277 case 6: |
4201 if (instr->Bits(11, 8) == 8 && instr->Bit(4) == 0) { | 4278 if (instr->Bits(11, 8) == 8 && instr->Bit(4) == 0) { |
4202 // vsub.size Qd, Qm, Qn. | 4279 // vsub.size Qd, Qm, Qn. |
4203 NeonSize size = static_cast<NeonSize>(instr->Bits(21, 20)); | 4280 NeonSize size = static_cast<NeonSize>(instr->Bits(21, 20)); |
4204 int Vd = instr->VFPDRegValue(kSimd128Precision); | 4281 int Vd = instr->VFPDRegValue(kSimd128Precision); |
4205 int Vm = instr->VFPMRegValue(kSimd128Precision); | 4282 int Vm = instr->VFPMRegValue(kSimd128Precision); |
(...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4824 float radicand = bit_cast<float>(src[i]); | 4901 float radicand = bit_cast<float>(src[i]); |
4825 float result = 1.0f / fast_sqrt(radicand, isolate_); | 4902 float result = 1.0f / fast_sqrt(radicand, isolate_); |
4826 result = canonicalizeNaN(result); | 4903 result = canonicalizeNaN(result); |
4827 src[i] = bit_cast<uint32_t>(result); | 4904 src[i] = bit_cast<uint32_t>(result); |
4828 } | 4905 } |
4829 } | 4906 } |
4830 set_q_register(Vd, src); | 4907 set_q_register(Vd, src); |
4831 } else { | 4908 } else { |
4832 UNIMPLEMENTED(); | 4909 UNIMPLEMENTED(); |
4833 } | 4910 } |
| 4911 } else if (instr->Bits(11, 7) == 0 && instr->Bit(4) == 1) { |
| 4912 // vshr.u<size> Qd, Qm, shift |
| 4913 int size = base::bits::RoundDownToPowerOfTwo32(instr->Bits(21, 16)); |
| 4914 int shift = 2 * size - instr->Bits(21, 16); |
| 4915 int Vd = instr->VFPDRegValue(kSimd128Precision); |
| 4916 int Vm = instr->VFPMRegValue(kSimd128Precision); |
| 4917 NeonSize ns = static_cast<NeonSize>(size / 16); |
| 4918 switch (ns) { |
| 4919 case Neon8: { |
| 4920 uint8_t src[16]; |
| 4921 get_q_register(Vm, src); |
| 4922 for (int i = 0; i < 16; i++) { |
| 4923 src[i] >>= shift; |
| 4924 } |
| 4925 set_q_register(Vd, src); |
| 4926 break; |
| 4927 } |
| 4928 case Neon16: { |
| 4929 uint16_t src[8]; |
| 4930 get_q_register(Vm, src); |
| 4931 for (int i = 0; i < 8; i++) { |
| 4932 src[i] >>= shift; |
| 4933 } |
| 4934 set_q_register(Vd, src); |
| 4935 break; |
| 4936 } |
| 4937 case Neon32: { |
| 4938 uint32_t src[4]; |
| 4939 get_q_register(Vm, src); |
| 4940 for (int i = 0; i < 4; i++) { |
| 4941 src[i] >>= shift; |
| 4942 } |
| 4943 set_q_register(Vd, src); |
| 4944 break; |
| 4945 } |
| 4946 default: |
| 4947 UNREACHABLE(); |
| 4948 break; |
| 4949 } |
4834 } else { | 4950 } else { |
4835 UNIMPLEMENTED(); | 4951 UNIMPLEMENTED(); |
4836 } | 4952 } |
4837 break; | 4953 break; |
4838 case 8: | 4954 case 8: |
4839 if (instr->Bits(21, 20) == 0) { | 4955 if (instr->Bits(21, 20) == 0) { |
4840 // vst1 | 4956 // vst1 |
4841 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); | 4957 int Vd = (instr->Bit(22) << 4) | instr->VdValue(); |
4842 int Rn = instr->VnValue(); | 4958 int Rn = instr->VnValue(); |
4843 int type = instr->Bits(11, 8); | 4959 int type = instr->Bits(11, 8); |
(...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5344 set_register(sp, current_sp + sizeof(uintptr_t)); | 5460 set_register(sp, current_sp + sizeof(uintptr_t)); |
5345 return address; | 5461 return address; |
5346 } | 5462 } |
5347 | 5463 |
5348 } // namespace internal | 5464 } // namespace internal |
5349 } // namespace v8 | 5465 } // namespace v8 |
5350 | 5466 |
5351 #endif // USE_SIMULATOR | 5467 #endif // USE_SIMULATOR |
5352 | 5468 |
5353 #endif // V8_TARGET_ARCH_ARM | 5469 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |