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 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
11 #if V8_TARGET_ARCH_ARM | 11 #if V8_TARGET_ARCH_ARM |
12 | 12 |
13 #include "src/arm/constants-arm.h" | 13 #include "src/arm/constants-arm.h" |
14 #include "src/arm/simulator-arm.h" | 14 #include "src/arm/simulator-arm.h" |
15 #include "src/assembler.h" | 15 #include "src/assembler.h" |
| 16 #include "src/base/bits.h" |
16 #include "src/codegen.h" | 17 #include "src/codegen.h" |
17 #include "src/disasm.h" | 18 #include "src/disasm.h" |
18 | 19 |
19 #if defined(USE_SIMULATOR) | 20 #if defined(USE_SIMULATOR) |
20 | 21 |
21 // Only build the simulator if not compiling for real ARM hardware. | 22 // Only build the simulator if not compiling for real ARM hardware. |
22 namespace v8 { | 23 namespace v8 { |
23 namespace internal { | 24 namespace internal { |
24 | 25 |
25 // This macro provides a platform independent use of sscanf. The reason for | 26 // This macro provides a platform independent use of sscanf. The reason for |
(...skipping 1473 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 } | 1500 } |
1500 return result; | 1501 return result; |
1501 } | 1502 } |
1502 | 1503 |
1503 | 1504 |
1504 // Addressing Mode 1 - Data-processing operands: | 1505 // Addressing Mode 1 - Data-processing operands: |
1505 // Get the value based on the shifter_operand with immediate. | 1506 // Get the value based on the shifter_operand with immediate. |
1506 int32_t Simulator::GetImm(Instruction* instr, bool* carry_out) { | 1507 int32_t Simulator::GetImm(Instruction* instr, bool* carry_out) { |
1507 int rotate = instr->RotateValue() * 2; | 1508 int rotate = instr->RotateValue() * 2; |
1508 int immed8 = instr->Immed8Value(); | 1509 int immed8 = instr->Immed8Value(); |
1509 int imm = (immed8 >> rotate) | (immed8 << (32 - rotate)); | 1510 int imm = base::bits::RotateRight32(immed8, rotate); |
1510 *carry_out = (rotate == 0) ? c_flag_ : (imm < 0); | 1511 *carry_out = (rotate == 0) ? c_flag_ : (imm < 0); |
1511 return imm; | 1512 return imm; |
1512 } | 1513 } |
1513 | 1514 |
1514 | 1515 |
1515 static int count_bits(int bit_vector) { | 1516 static int count_bits(int bit_vector) { |
1516 int count = 0; | 1517 int count = 0; |
1517 while (bit_vector != 0) { | 1518 while (bit_vector != 0) { |
1518 if ((bit_vector & 1) != 0) { | 1519 if ((bit_vector & 1) != 0) { |
1519 count++; | 1520 count++; |
(...skipping 2498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4018 uintptr_t address = *stack_slot; | 4019 uintptr_t address = *stack_slot; |
4019 set_register(sp, current_sp + sizeof(uintptr_t)); | 4020 set_register(sp, current_sp + sizeof(uintptr_t)); |
4020 return address; | 4021 return address; |
4021 } | 4022 } |
4022 | 4023 |
4023 } } // namespace v8::internal | 4024 } } // namespace v8::internal |
4024 | 4025 |
4025 #endif // USE_SIMULATOR | 4026 #endif // USE_SIMULATOR |
4026 | 4027 |
4027 #endif // V8_TARGET_ARCH_ARM | 4028 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |