| 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 12 matching lines...) Expand all Loading... |
| 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 <stdlib.h> | 28 #include <stdlib.h> |
| 29 #include <cmath> | 29 #include <cmath> |
| 30 #include <cstdarg> | 30 #include <cstdarg> |
| 31 #include "v8.h" | 31 #include "v8.h" |
| 32 | 32 |
| 33 #if defined(V8_TARGET_ARCH_ARM) | 33 #if V8_TARGET_ARCH_ARM |
| 34 | 34 |
| 35 #include "disasm.h" | 35 #include "disasm.h" |
| 36 #include "assembler.h" | 36 #include "assembler.h" |
| 37 #include "codegen.h" | 37 #include "codegen.h" |
| 38 #include "arm/constants-arm.h" | 38 #include "arm/constants-arm.h" |
| 39 #include "arm/simulator-arm.h" | 39 #include "arm/simulator-arm.h" |
| 40 | 40 |
| 41 #if defined(USE_SIMULATOR) | 41 #if defined(USE_SIMULATOR) |
| 42 | 42 |
| 43 // Only build the simulator if not compiling for real ARM hardware. | 43 // Only build the simulator if not compiling for real ARM hardware. |
| (...skipping 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1019 } | 1019 } |
| 1020 | 1020 |
| 1021 | 1021 |
| 1022 void Simulator::TrashCallerSaveRegisters() { | 1022 void Simulator::TrashCallerSaveRegisters() { |
| 1023 // We don't trash the registers with the return value. | 1023 // We don't trash the registers with the return value. |
| 1024 registers_[2] = 0x50Bad4U; | 1024 registers_[2] = 0x50Bad4U; |
| 1025 registers_[3] = 0x50Bad4U; | 1025 registers_[3] = 0x50Bad4U; |
| 1026 registers_[12] = 0x50Bad4U; | 1026 registers_[12] = 0x50Bad4U; |
| 1027 } | 1027 } |
| 1028 | 1028 |
| 1029 |
| 1029 // Some Operating Systems allow unaligned access on ARMv7 targets. We | 1030 // Some Operating Systems allow unaligned access on ARMv7 targets. We |
| 1030 // assume that unaligned accesses are not allowed unless the v8 build system | 1031 // assume that unaligned accesses are not allowed unless the v8 build system |
| 1031 // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. | 1032 // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. |
| 1032 // The following statements below describes the behavior of the ARM CPUs | 1033 // The following statements below describes the behavior of the ARM CPUs |
| 1033 // that don't support unaligned access. | 1034 // that don't support unaligned access. |
| 1034 // Some ARM platforms raise an interrupt on detecting unaligned access. | 1035 // Some ARM platforms raise an interrupt on detecting unaligned access. |
| 1035 // On others it does a funky rotation thing. For now we | 1036 // On others it does a funky rotation thing. For now we |
| 1036 // simply disallow unaligned reads. Note that simulator runs have the runtime | 1037 // simply disallow unaligned reads. Note that simulator runs have the runtime |
| 1037 // system running directly on the host system and only generated code is | 1038 // system running directly on the host system and only generated code is |
| 1038 // executed in the simulator. Since the host is typically IA32 we will not | 1039 // executed in the simulator. Since the host is typically IA32 we will not |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1518 default: { | 1519 default: { |
| 1519 UNREACHABLE(); | 1520 UNREACHABLE(); |
| 1520 break; | 1521 break; |
| 1521 } | 1522 } |
| 1522 } | 1523 } |
| 1523 if (instr->HasW()) { | 1524 if (instr->HasW()) { |
| 1524 set_register(rn, rn_val); | 1525 set_register(rn, rn_val); |
| 1525 } | 1526 } |
| 1526 } | 1527 } |
| 1527 | 1528 |
| 1529 |
| 1528 // Addressing Mode 4 - Load and Store Multiple | 1530 // Addressing Mode 4 - Load and Store Multiple |
| 1529 void Simulator::HandleRList(Instruction* instr, bool load) { | 1531 void Simulator::HandleRList(Instruction* instr, bool load) { |
| 1530 int rlist = instr->RlistValue(); | 1532 int rlist = instr->RlistValue(); |
| 1531 int num_regs = count_bits(rlist); | 1533 int num_regs = count_bits(rlist); |
| 1532 | 1534 |
| 1533 intptr_t start_address = 0; | 1535 intptr_t start_address = 0; |
| 1534 intptr_t end_address = 0; | 1536 intptr_t end_address = 0; |
| 1535 ProcessPUW(instr, num_regs, kPointerSize, &start_address, &end_address); | 1537 ProcessPUW(instr, num_regs, kPointerSize, &start_address, &end_address); |
| 1536 | 1538 |
| 1537 intptr_t* address = reinterpret_cast<intptr_t*>(start_address); | 1539 intptr_t* address = reinterpret_cast<intptr_t*>(start_address); |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 } | 1949 } |
| 1948 } | 1950 } |
| 1949 } | 1951 } |
| 1950 | 1952 |
| 1951 | 1953 |
| 1952 double Simulator::canonicalizeNaN(double value) { | 1954 double Simulator::canonicalizeNaN(double value) { |
| 1953 return (FPSCR_default_NaN_mode_ && std::isnan(value)) ? | 1955 return (FPSCR_default_NaN_mode_ && std::isnan(value)) ? |
| 1954 FixedDoubleArray::canonical_not_the_hole_nan_as_double() : value; | 1956 FixedDoubleArray::canonical_not_the_hole_nan_as_double() : value; |
| 1955 } | 1957 } |
| 1956 | 1958 |
| 1959 |
| 1957 // Stop helper functions. | 1960 // Stop helper functions. |
| 1958 bool Simulator::isStopInstruction(Instruction* instr) { | 1961 bool Simulator::isStopInstruction(Instruction* instr) { |
| 1959 return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode); | 1962 return (instr->Bits(27, 24) == 0xF) && (instr->SvcValue() >= kStopCode); |
| 1960 } | 1963 } |
| 1961 | 1964 |
| 1962 | 1965 |
| 1963 bool Simulator::isWatchedStop(uint32_t code) { | 1966 bool Simulator::isWatchedStop(uint32_t code) { |
| 1964 ASSERT(code <= kMaxStopCode); | 1967 ASSERT(code <= kMaxStopCode); |
| 1965 return code < kNumOfWatchedStops; | 1968 return code < kNumOfWatchedStops; |
| 1966 } | 1969 } |
| (...skipping 1610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3577 uintptr_t address = *stack_slot; | 3580 uintptr_t address = *stack_slot; |
| 3578 set_register(sp, current_sp + sizeof(uintptr_t)); | 3581 set_register(sp, current_sp + sizeof(uintptr_t)); |
| 3579 return address; | 3582 return address; |
| 3580 } | 3583 } |
| 3581 | 3584 |
| 3582 } } // namespace v8::internal | 3585 } } // namespace v8::internal |
| 3583 | 3586 |
| 3584 #endif // USE_SIMULATOR | 3587 #endif // USE_SIMULATOR |
| 3585 | 3588 |
| 3586 #endif // V8_TARGET_ARCH_ARM | 3589 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |