| OLD | NEW |
| 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
| 2 // All Rights Reserved. | 2 // All Rights Reserved. |
| 3 // | 3 // |
| 4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
| 5 // modification, are permitted provided that the following conditions | 5 // modification, are permitted provided that the following conditions |
| 6 // are met: | 6 // are met: |
| 7 // | 7 // |
| 8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
| 9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
| 10 // | 10 // |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 #include "arm/assembler-arm-inl.h" | 41 #include "arm/assembler-arm-inl.h" |
| 42 #include "serialize.h" | 42 #include "serialize.h" |
| 43 | 43 |
| 44 namespace v8 { | 44 namespace v8 { |
| 45 namespace internal { | 45 namespace internal { |
| 46 | 46 |
| 47 #ifdef DEBUG | 47 #ifdef DEBUG |
| 48 bool CpuFeatures::initialized_ = false; | 48 bool CpuFeatures::initialized_ = false; |
| 49 #endif | 49 #endif |
| 50 unsigned CpuFeatures::supported_ = 0; | 50 uint64_t CpuFeatures::supported_ = 0; |
| 51 unsigned CpuFeatures::found_by_runtime_probing_ = 0; | 51 uint64_t CpuFeatures::found_by_runtime_probing_ = 0; |
| 52 | 52 |
| 53 | 53 |
| 54 // Get the CPU features enabled by the build. For cross compilation the | 54 // Get the CPU features enabled by the build. For cross compilation the |
| 55 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP_INSTRUCTIONS | 55 // preprocessor symbols CAN_USE_ARMV7_INSTRUCTIONS and CAN_USE_VFP_INSTRUCTIONS |
| 56 // can be defined to enable ARMv7 and VFPv3 instructions when building the | 56 // can be defined to enable ARMv7 and VFPv3 instructions when building the |
| 57 // snapshot. | 57 // snapshot. |
| 58 static uint64_t CpuFeaturesImpliedByCompiler() { | 58 static uint64_t CpuFeaturesImpliedByCompiler() { |
| 59 uint64_t answer = 0; | 59 uint64_t answer = 0; |
| 60 #ifdef CAN_USE_ARMV7_INSTRUCTIONS | 60 #ifdef CAN_USE_ARMV7_INSTRUCTIONS |
| 61 answer |= 1u << ARMv7; | 61 answer |= 1u << ARMv7; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 73 answer |= 1u << VFP3 | 1u << ARMv7; | 73 answer |= 1u << VFP3 | 1u << ARMv7; |
| 74 #endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) | 74 #endif // defined(CAN_USE_ARMV7_INSTRUCTIONS) && defined(__VFP_FP__) |
| 75 // && !defined(__SOFTFP__) | 75 // && !defined(__SOFTFP__) |
| 76 #endif // def __arm__ | 76 #endif // def __arm__ |
| 77 | 77 |
| 78 return answer; | 78 return answer; |
| 79 } | 79 } |
| 80 | 80 |
| 81 | 81 |
| 82 void CpuFeatures::Probe() { | 82 void CpuFeatures::Probe() { |
| 83 unsigned standard_features = (OS::CpuFeaturesImpliedByPlatform() | | 83 uint64_t standard_features = (OS::CpuFeaturesImpliedByPlatform() | |
| 84 CpuFeaturesImpliedByCompiler()); | 84 CpuFeaturesImpliedByCompiler()); |
| 85 ASSERT(supported_ == 0 || supported_ == standard_features); | 85 ASSERT(supported_ == 0 || supported_ == standard_features); |
| 86 #ifdef DEBUG | 86 #ifdef DEBUG |
| 87 initialized_ = true; | 87 initialized_ = true; |
| 88 #endif | 88 #endif |
| 89 | 89 |
| 90 // Get the features implied by the OS and the compiler settings. This is the | 90 // Get the features implied by the OS and the compiler settings. This is the |
| 91 // minimal set of features which is also alowed for generated code in the | 91 // minimal set of features which is also alowed for generated code in the |
| 92 // snapshot. | 92 // snapshot. |
| 93 supported_ |= standard_features; | 93 supported_ |= standard_features; |
| (...skipping 645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 if (CpuFeatures::IsSupported(ARMv7)) { | 739 if (CpuFeatures::IsSupported(ARMv7)) { |
| 740 if (imm32 < 0x10000) { | 740 if (imm32 < 0x10000) { |
| 741 *instr ^= kMovwLeaveCCFlip; | 741 *instr ^= kMovwLeaveCCFlip; |
| 742 *instr |= EncodeMovwImmediate(imm32); | 742 *instr |= EncodeMovwImmediate(imm32); |
| 743 *rotate_imm = *immed_8 = 0; // Not used for movw. | 743 *rotate_imm = *immed_8 = 0; // Not used for movw. |
| 744 return true; | 744 return true; |
| 745 } | 745 } |
| 746 } | 746 } |
| 747 } | 747 } |
| 748 } else if ((*instr & kCmpCmnMask) == kCmpCmnPattern) { | 748 } else if ((*instr & kCmpCmnMask) == kCmpCmnPattern) { |
| 749 if (fits_shifter(-imm32, rotate_imm, immed_8, NULL)) { | 749 if (fits_shifter(-static_cast<int32_t>(imm32), rotate_imm, |
| 750 immed_8, NULL)) { |
| 750 *instr ^= kCmpCmnFlip; | 751 *instr ^= kCmpCmnFlip; |
| 751 return true; | 752 return true; |
| 752 } | 753 } |
| 753 } else { | 754 } else { |
| 754 Instr alu_insn = (*instr & kALUMask); | 755 Instr alu_insn = (*instr & kALUMask); |
| 755 if (alu_insn == ADD || | 756 if (alu_insn == ADD || |
| 756 alu_insn == SUB) { | 757 alu_insn == SUB) { |
| 757 if (fits_shifter(-imm32, rotate_imm, immed_8, NULL)) { | 758 if (fits_shifter(-static_cast<int32_t>(imm32), rotate_imm, |
| 759 immed_8, NULL)) { |
| 758 *instr ^= kAddSubFlip; | 760 *instr ^= kAddSubFlip; |
| 759 return true; | 761 return true; |
| 760 } | 762 } |
| 761 } else if (alu_insn == AND || | 763 } else if (alu_insn == AND || |
| 762 alu_insn == BIC) { | 764 alu_insn == BIC) { |
| 763 if (fits_shifter(~imm32, rotate_imm, immed_8, NULL)) { | 765 if (fits_shifter(~imm32, rotate_imm, immed_8, NULL)) { |
| 764 *instr ^= kAndBicFlip; | 766 *instr ^= kAndBicFlip; |
| 765 return true; | 767 return true; |
| 766 } | 768 } |
| 767 } | 769 } |
| (...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 | 2659 |
| 2658 // Since a constant pool was just emitted, move the check offset forward by | 2660 // Since a constant pool was just emitted, move the check offset forward by |
| 2659 // the standard interval. | 2661 // the standard interval. |
| 2660 next_buffer_check_ = pc_offset() + kCheckPoolInterval; | 2662 next_buffer_check_ = pc_offset() + kCheckPoolInterval; |
| 2661 } | 2663 } |
| 2662 | 2664 |
| 2663 | 2665 |
| 2664 } } // namespace v8::internal | 2666 } } // namespace v8::internal |
| 2665 | 2667 |
| 2666 #endif // V8_TARGET_ARCH_ARM | 2668 #endif // V8_TARGET_ARCH_ARM |
| OLD | NEW |