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 30 matching lines...) Expand all Loading... |
41 #include "arm/assembler-arm-inl.h" | 41 #include "arm/assembler-arm-inl.h" |
42 #include "macro-assembler.h" | 42 #include "macro-assembler.h" |
43 #include "serialize.h" | 43 #include "serialize.h" |
44 | 44 |
45 namespace v8 { | 45 namespace v8 { |
46 namespace internal { | 46 namespace internal { |
47 | 47 |
48 #ifdef DEBUG | 48 #ifdef DEBUG |
49 bool CpuFeatures::initialized_ = false; | 49 bool CpuFeatures::initialized_ = false; |
50 #endif | 50 #endif |
| 51 bool CpuFeatures::hint_creating_snapshot_ = false; |
51 unsigned CpuFeatures::supported_ = 0; | 52 unsigned CpuFeatures::supported_ = 0; |
52 unsigned CpuFeatures::found_by_runtime_probing_only_ = 0; | 53 unsigned CpuFeatures::found_by_runtime_probing_only_ = 0; |
53 unsigned CpuFeatures::cross_compile_ = 0; | 54 unsigned CpuFeatures::cross_compile_ = 0; |
54 unsigned CpuFeatures::cache_line_size_ = 64; | 55 unsigned CpuFeatures::cache_line_size_ = 64; |
55 | 56 |
56 | 57 |
57 ExternalReference ExternalReference::cpu_features() { | 58 ExternalReference ExternalReference::cpu_features() { |
58 ASSERT(CpuFeatures::initialized_); | 59 ASSERT(CpuFeatures::initialized_); |
59 return ExternalReference(&CpuFeatures::supported_); | 60 return ExternalReference(&CpuFeatures::supported_); |
60 } | 61 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 ASSERT(index >= 0 && index < NumAllocatableRegisters()); | 94 ASSERT(index >= 0 && index < NumAllocatableRegisters()); |
94 ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() == | 95 ASSERT(kScratchDoubleReg.code() - kDoubleRegZero.code() == |
95 kNumReservedRegisters - 1); | 96 kNumReservedRegisters - 1); |
96 if (index >= kDoubleRegZero.code()) | 97 if (index >= kDoubleRegZero.code()) |
97 index += kNumReservedRegisters; | 98 index += kNumReservedRegisters; |
98 | 99 |
99 return VFPRegisters::Name(index, true); | 100 return VFPRegisters::Name(index, true); |
100 } | 101 } |
101 | 102 |
102 | 103 |
| 104 void CpuFeatures::SetHintCreatingSnapshot() { |
| 105 hint_creating_snapshot_ = true; |
| 106 } |
| 107 |
| 108 |
| 109 void CpuFeatures::ProbeWithoutIsolate() { |
| 110 Probe(hint_creating_snapshot_); |
| 111 } |
| 112 |
| 113 |
103 void CpuFeatures::Probe() { | 114 void CpuFeatures::Probe() { |
| 115 // The Serializer can only be queried after isolate initialization. |
| 116 Probe(Serializer::enabled()); |
| 117 } |
| 118 |
| 119 |
| 120 void CpuFeatures::Probe(bool serializer_enabled) { |
104 uint64_t standard_features = static_cast<unsigned>( | 121 uint64_t standard_features = static_cast<unsigned>( |
105 OS::CpuFeaturesImpliedByPlatform()) | CpuFeaturesImpliedByCompiler(); | 122 OS::CpuFeaturesImpliedByPlatform()) | CpuFeaturesImpliedByCompiler(); |
106 ASSERT(supported_ == 0 || supported_ == standard_features); | 123 ASSERT(supported_ == 0 || |
| 124 (supported_ & standard_features) == standard_features); |
107 #ifdef DEBUG | 125 #ifdef DEBUG |
108 initialized_ = true; | 126 initialized_ = true; |
109 #endif | 127 #endif |
110 | 128 |
111 // Get the features implied by the OS and the compiler settings. This is the | 129 // Get the features implied by the OS and the compiler settings. This is the |
112 // minimal set of features which is also alowed for generated code in the | 130 // minimal set of features which is also alowed for generated code in the |
113 // snapshot. | 131 // snapshot. |
114 supported_ |= standard_features; | 132 supported_ |= standard_features; |
115 | 133 |
116 if (Serializer::enabled()) { | 134 if (serializer_enabled) { |
117 // No probing for features if we might serialize (generate snapshot). | 135 // No probing for features if we might serialize (generate snapshot). |
118 printf(" "); | 136 printf(" "); |
119 PrintFeatures(); | 137 PrintFeatures(); |
120 return; | 138 return; |
121 } | 139 } |
122 | 140 |
123 #ifndef __arm__ | 141 #ifndef __arm__ |
124 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is | 142 // For the simulator=arm build, use VFP when FLAG_enable_vfp3 is |
125 // enabled. VFPv3 implies ARMv7, see ARM DDI 0406B, page A1-6. | 143 // enabled. VFPv3 implies ARMv7, see ARM DDI 0406B, page A1-6. |
126 if (FLAG_enable_vfp3) { | 144 if (FLAG_enable_vfp3) { |
(...skipping 945 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1072 return false; | 1090 return false; |
1073 } | 1091 } |
1074 | 1092 |
1075 | 1093 |
1076 // We have to use the temporary register for things that can be relocated even | 1094 // We have to use the temporary register for things that can be relocated even |
1077 // if they can be encoded in the ARM's 12 bits of immediate-offset instruction | 1095 // if they can be encoded in the ARM's 12 bits of immediate-offset instruction |
1078 // space. There is no guarantee that the relocated location can be similarly | 1096 // space. There is no guarantee that the relocated location can be similarly |
1079 // encoded. | 1097 // encoded. |
1080 bool Operand::must_output_reloc_info(const Assembler* assembler) const { | 1098 bool Operand::must_output_reloc_info(const Assembler* assembler) const { |
1081 if (rmode_ == RelocInfo::EXTERNAL_REFERENCE) { | 1099 if (rmode_ == RelocInfo::EXTERNAL_REFERENCE) { |
1082 #ifdef DEBUG | |
1083 if (!Serializer::enabled()) { | |
1084 Serializer::TooLateToEnableNow(); | |
1085 } | |
1086 #endif // def DEBUG | |
1087 if (assembler != NULL && assembler->predictable_code_size()) return true; | 1100 if (assembler != NULL && assembler->predictable_code_size()) return true; |
1088 return Serializer::enabled(); | 1101 return Serializer::enabled(); |
1089 } else if (RelocInfo::IsNone(rmode_)) { | 1102 } else if (RelocInfo::IsNone(rmode_)) { |
1090 return false; | 1103 return false; |
1091 } | 1104 } |
1092 return true; | 1105 return true; |
1093 } | 1106 } |
1094 | 1107 |
1095 | 1108 |
1096 static bool use_mov_immediate_load(const Operand& x, | 1109 static bool use_mov_immediate_load(const Operand& x, |
(...skipping 2163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3260 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { | 3273 void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { |
3261 RelocInfo rinfo(pc_, rmode, data, NULL); | 3274 RelocInfo rinfo(pc_, rmode, data, NULL); |
3262 RecordRelocInfo(rinfo); | 3275 RecordRelocInfo(rinfo); |
3263 } | 3276 } |
3264 | 3277 |
3265 | 3278 |
3266 void Assembler::RecordRelocInfo(const RelocInfo& rinfo) { | 3279 void Assembler::RecordRelocInfo(const RelocInfo& rinfo) { |
3267 if (!RelocInfo::IsNone(rinfo.rmode())) { | 3280 if (!RelocInfo::IsNone(rinfo.rmode())) { |
3268 // Don't record external references unless the heap will be serialized. | 3281 // Don't record external references unless the heap will be serialized. |
3269 if (rinfo.rmode() == RelocInfo::EXTERNAL_REFERENCE) { | 3282 if (rinfo.rmode() == RelocInfo::EXTERNAL_REFERENCE) { |
3270 #ifdef DEBUG | |
3271 if (!Serializer::enabled()) { | |
3272 Serializer::TooLateToEnableNow(); | |
3273 } | |
3274 #endif | |
3275 if (!Serializer::enabled() && !emit_debug_code()) { | 3283 if (!Serializer::enabled() && !emit_debug_code()) { |
3276 return; | 3284 return; |
3277 } | 3285 } |
3278 } | 3286 } |
3279 ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here | 3287 ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here |
3280 if (rinfo.rmode() == RelocInfo::CODE_TARGET_WITH_ID) { | 3288 if (rinfo.rmode() == RelocInfo::CODE_TARGET_WITH_ID) { |
3281 RelocInfo reloc_info_with_ast_id(rinfo.pc(), | 3289 RelocInfo reloc_info_with_ast_id(rinfo.pc(), |
3282 rinfo.rmode(), | 3290 rinfo.rmode(), |
3283 RecordedAstId().ToInt(), | 3291 RecordedAstId().ToInt(), |
3284 NULL); | 3292 NULL); |
(...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3736 ASSERT((index_64bit == count_of_64bit_) && | 3744 ASSERT((index_64bit == count_of_64bit_) && |
3737 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && | 3745 (index_code_ptr == (index_64bit + count_of_code_ptr_)) && |
3738 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && | 3746 (index_heap_ptr == (index_code_ptr + count_of_heap_ptr_)) && |
3739 (index_32bit == (index_heap_ptr + count_of_32bit_))); | 3747 (index_32bit == (index_heap_ptr + count_of_32bit_))); |
3740 } | 3748 } |
3741 | 3749 |
3742 | 3750 |
3743 } } // namespace v8::internal | 3751 } } // namespace v8::internal |
3744 | 3752 |
3745 #endif // V8_TARGET_ARCH_ARM | 3753 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |