Chromium Code Reviews| 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 #include "serialize.h" | 40 #include "serialize.h" |
| 41 | 41 |
| 42 namespace v8 { | 42 namespace v8 { |
| 43 namespace internal { | 43 namespace internal { |
| 44 | 44 |
| 45 // Safe default is no features. | 45 // Safe default is no features. |
| 46 unsigned CpuFeatures::supported_ = 0; | 46 unsigned CpuFeatures::supported_ = 0; |
| 47 unsigned CpuFeatures::enabled_ = 0; | 47 unsigned CpuFeatures::enabled_ = 0; |
| 48 unsigned CpuFeatures::found_by_runtime_probing_ = 0; | 48 unsigned CpuFeatures::found_by_runtime_probing_ = 0; |
| 49 | 49 |
| 50 | |
| 51 #ifdef __arm__ | |
|
Søren Thygesen Gjesse
2010/02/25 11:25:58
Please add comment
// NAME_OF_DEFINE
to all #e
| |
| 52 static uint64_t CpuFeaturesImpliedByCompiler() { | |
| 53 uint64_t answer = 0; | |
| 54 #ifdef CAN_USE_ARMV7_INSTRUCTIONS | |
| 55 answer |= 1u << ARMv7; | |
| 56 #endif | |
| 57 // If the compiler is allowed to use VFP then we can use VFP too in our code | |
| 58 // generation even when generating snapshots. This won't work for cross | |
| 59 // compilation. | |
| 60 #if defined(__VFP_FP__) && !defined(__SOFTFP__) | |
| 61 answer |= 1u << VFP3; | |
| 62 #endif | |
| 63 #ifdef CAN_USE_VFP_INSTRUCTIONS | |
| 64 answer |= 1u << VFP3; | |
| 65 #endif | |
| 66 return answer; | |
| 67 } | |
| 68 #endif | |
| 69 | |
| 70 | |
| 50 void CpuFeatures::Probe() { | 71 void CpuFeatures::Probe() { |
| 51 // If the compiler is allowed to use vfp then we can use vfp too in our | |
| 52 // code generation. | |
| 53 #if !defined(__arm__) | 72 #if !defined(__arm__) |
|
Søren Thygesen Gjesse
2010/02/25 11:25:58
#ifndef for consistency? Maybe turn it around to b
| |
| 54 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is enabled. | 73 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is enabled. |
| 55 if (FLAG_enable_vfp3) { | 74 if (FLAG_enable_vfp3) { |
| 56 supported_ |= 1u << VFP3; | 75 supported_ |= 1u << VFP3; |
| 57 } | 76 } |
| 58 // For the simulator=arm build, use ARMv7 when FLAG_enable_armv7 is enabled | 77 // For the simulator=arm build, use ARMv7 when FLAG_enable_armv7 is enabled |
| 59 if (FLAG_enable_armv7) { | 78 if (FLAG_enable_armv7) { |
| 60 supported_ |= 1u << ARMv7; | 79 supported_ |= 1u << ARMv7; |
| 61 } | 80 } |
| 62 #else | 81 #else |
| 63 if (Serializer::enabled()) { | 82 if (Serializer::enabled()) { |
| 64 supported_ |= OS::CpuFeaturesImpliedByPlatform(); | 83 supported_ |= OS::CpuFeaturesImpliedByPlatform(); |
| 84 supported_ |= CpuFeaturesImpliedByCompiler(); | |
| 65 return; // No features if we might serialize. | 85 return; // No features if we might serialize. |
| 66 } | 86 } |
| 67 | 87 |
| 68 if (OS::ArmCpuHasFeature(VFP3)) { | 88 if (OS::ArmCpuHasFeature(VFP3)) { |
| 69 // This implementation also sets the VFP flags if | 89 // This implementation also sets the VFP flags if |
| 70 // runtime detection of VFP returns true. | 90 // runtime detection of VFP returns true. |
| 71 supported_ |= 1u << VFP3; | 91 supported_ |= 1u << VFP3; |
| 72 found_by_runtime_probing_ |= 1u << VFP3; | 92 found_by_runtime_probing_ |= 1u << VFP3; |
| 73 } | 93 } |
| 74 | 94 |
| (...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1222 B7 | B4 | src.code()); | 1242 B7 | B4 | src.code()); |
| 1223 } | 1243 } |
| 1224 | 1244 |
| 1225 | 1245 |
| 1226 // Exception-generating instructions and debugging support. | 1246 // Exception-generating instructions and debugging support. |
| 1227 void Assembler::stop(const char* msg) { | 1247 void Assembler::stop(const char* msg) { |
| 1228 #if !defined(__arm__) | 1248 #if !defined(__arm__) |
| 1229 // The simulator handles these special instructions and stops execution. | 1249 // The simulator handles these special instructions and stops execution. |
| 1230 emit(15 << 28 | ((intptr_t) msg)); | 1250 emit(15 << 28 | ((intptr_t) msg)); |
| 1231 #else | 1251 #else |
| 1232 // Just issue a simple break instruction for now. Alternatively we could use | 1252 #ifdef CAN_USE_ARMV5_INSTRUCTIONS |
| 1233 // the swi(0x9f0001) instruction on Linux. | |
| 1234 bkpt(0); | 1253 bkpt(0); |
| 1254 #else | |
| 1255 swi(0x9f0001); | |
| 1256 #endif | |
| 1235 #endif | 1257 #endif |
| 1236 } | 1258 } |
| 1237 | 1259 |
| 1238 | 1260 |
| 1239 void Assembler::bkpt(uint32_t imm16) { // v5 and above | 1261 void Assembler::bkpt(uint32_t imm16) { // v5 and above |
| 1240 ASSERT(is_uint16(imm16)); | 1262 ASSERT(is_uint16(imm16)); |
| 1241 emit(al | B24 | B21 | (imm16 >> 4)*B8 | 7*B4 | (imm16 & 0xf)); | 1263 emit(al | B24 | B21 | (imm16 >> 4)*B8 | 7*B4 | (imm16 & 0xf)); |
| 1242 } | 1264 } |
| 1243 | 1265 |
| 1244 | 1266 |
| (...skipping 624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1869 bind(&after_pool); | 1891 bind(&after_pool); |
| 1870 } | 1892 } |
| 1871 | 1893 |
| 1872 // Since a constant pool was just emitted, move the check offset forward by | 1894 // Since a constant pool was just emitted, move the check offset forward by |
| 1873 // the standard interval. | 1895 // the standard interval. |
| 1874 next_buffer_check_ = pc_offset() + kCheckConstInterval; | 1896 next_buffer_check_ = pc_offset() + kCheckConstInterval; |
| 1875 } | 1897 } |
| 1876 | 1898 |
| 1877 | 1899 |
| 1878 } } // namespace v8::internal | 1900 } } // namespace v8::internal |
| OLD | NEW |