OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 #if !defined(DART_PRECOMPILED_RUNTIME) | 5 #if !defined(DART_PRECOMPILED_RUNTIME) |
6 | 6 |
7 #include "vm/intermediate_language.h" | 7 #include "vm/intermediate_language.h" |
8 | 8 |
9 #include "vm/bit_vector.h" | 9 #include "vm/bit_vector.h" |
10 #include "vm/bootstrap.h" | 10 #include "vm/bootstrap.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 "Propagate IC data from unoptimized to optimized IC calls."); | 37 "Propagate IC data from unoptimized to optimized IC calls."); |
38 DEFINE_FLAG(bool, | 38 DEFINE_FLAG(bool, |
39 two_args_smi_icd, | 39 two_args_smi_icd, |
40 true, | 40 true, |
41 "Generate special IC stubs for two args Smi operations"); | 41 "Generate special IC stubs for two args Smi operations"); |
42 DEFINE_FLAG(bool, | 42 DEFINE_FLAG(bool, |
43 unbox_numeric_fields, | 43 unbox_numeric_fields, |
44 !USING_DBC, | 44 !USING_DBC, |
45 "Support unboxed double and float32x4 fields."); | 45 "Support unboxed double and float32x4 fields."); |
46 DECLARE_FLAG(bool, eliminate_type_checks); | 46 DECLARE_FLAG(bool, eliminate_type_checks); |
47 DECLARE_FLAG(bool, support_externalizable_strings); | |
48 | 47 |
49 #if defined(DEBUG) | 48 #if defined(DEBUG) |
50 void Instruction::CheckField(const Field& field) const { | 49 void Instruction::CheckField(const Field& field) const { |
51 ASSERT(field.IsZoneHandle()); | 50 ASSERT(field.IsZoneHandle()); |
52 ASSERT(!Compiler::IsBackgroundCompilation() || !field.IsOriginal()); | 51 ASSERT(!Compiler::IsBackgroundCompilation() || !field.IsOriginal()); |
53 } | 52 } |
54 #endif // DEBUG | 53 #endif // DEBUG |
55 | 54 |
56 Definition::Definition(intptr_t deopt_id) | 55 Definition::Definition(intptr_t deopt_id) |
57 : Instruction(deopt_id), | 56 : Instruction(deopt_id), |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 return (*a)->cid_start - (*b)->cid_start; | 140 return (*a)->cid_start - (*b)->cid_start; |
142 } | 141 } |
143 | 142 |
144 static int OrderByFrequency(CidRange* const* a, CidRange* const* b) { | 143 static int OrderByFrequency(CidRange* const* a, CidRange* const* b) { |
145 const TargetInfo* target_info_a = static_cast<const TargetInfo*>(*a); | 144 const TargetInfo* target_info_a = static_cast<const TargetInfo*>(*a); |
146 const TargetInfo* target_info_b = static_cast<const TargetInfo*>(*b); | 145 const TargetInfo* target_info_b = static_cast<const TargetInfo*>(*b); |
147 // Negative if 'a' should sort before 'b'. | 146 // Negative if 'a' should sort before 'b'. |
148 return target_info_b->count - target_info_a->count; | 147 return target_info_b->count - target_info_a->count; |
149 } | 148 } |
150 | 149 |
151 bool Cids::ContainsExternalizableCids() const { | |
152 for (intptr_t i = 0; i < length(); i++) { | |
153 for (intptr_t cid = cid_ranges_[i]->cid_start; | |
154 cid <= cid_ranges_[i]->cid_end; cid++) { | |
155 if (Field::IsExternalizableCid(cid)) { | |
156 return true; | |
157 } | |
158 } | |
159 } | |
160 return false; | |
161 } | |
162 | |
163 bool Cids::Equals(const Cids& other) const { | 150 bool Cids::Equals(const Cids& other) const { |
164 if (length() != other.length()) return false; | 151 if (length() != other.length()) return false; |
165 for (int i = 0; i < length(); i++) { | 152 for (int i = 0; i < length(); i++) { |
166 if (cid_ranges_[i]->cid_start != other.cid_ranges_[i]->cid_start || | 153 if (cid_ranges_[i]->cid_start != other.cid_ranges_[i]->cid_start || |
167 cid_ranges_[i]->cid_end != other.cid_ranges_[i]->cid_end) { | 154 cid_ranges_[i]->cid_end != other.cid_ranges_[i]->cid_end) { |
168 return false; | 155 return false; |
169 } | 156 } |
170 } | 157 } |
171 return true; | 158 return true; |
172 } | 159 } |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 ASSERT(number_of_checks != 1 || !cids[0].IsSingleCid() || | 271 ASSERT(number_of_checks != 1 || !cids[0].IsSingleCid() || |
285 cids[0].cid_start != kSmiCid); | 272 cids[0].cid_start != kSmiCid); |
286 } | 273 } |
287 | 274 |
288 bool CheckClassInstr::AttributesEqual(Instruction* other) const { | 275 bool CheckClassInstr::AttributesEqual(Instruction* other) const { |
289 CheckClassInstr* other_check = other->AsCheckClass(); | 276 CheckClassInstr* other_check = other->AsCheckClass(); |
290 ASSERT(other_check != NULL); | 277 ASSERT(other_check != NULL); |
291 return cids().Equals(other_check->cids()); | 278 return cids().Equals(other_check->cids()); |
292 } | 279 } |
293 | 280 |
294 EffectSet CheckClassInstr::Dependencies() const { | |
295 // Externalization of strings via the API can change the class-id. | |
296 return cids_.ContainsExternalizableCids() ? EffectSet::Externalization() | |
297 : EffectSet::None(); | |
298 } | |
299 | |
300 EffectSet CheckClassIdInstr::Dependencies() const { | |
301 // Externalization of strings via the API can change the class-id. | |
302 for (intptr_t i = cids_.cid_start; i <= cids_.cid_end; i++) { | |
303 if (Field::IsExternalizableCid(i)) return EffectSet::Externalization(); | |
304 } | |
305 return EffectSet::None(); | |
306 } | |
307 | |
308 bool CheckClassInstr::IsDeoptIfNull() const { | 281 bool CheckClassInstr::IsDeoptIfNull() const { |
309 if (!cids().IsMonomorphic()) { | 282 if (!cids().IsMonomorphic()) { |
310 return false; | 283 return false; |
311 } | 284 } |
312 CompileType* in_type = value()->Type(); | 285 CompileType* in_type = value()->Type(); |
313 const intptr_t cid = cids().MonomorphicReceiverCid(); | 286 const intptr_t cid = cids().MonomorphicReceiverCid(); |
314 // Performance check: use CheckSmiInstr instead. | 287 // Performance check: use CheckSmiInstr instead. |
315 ASSERT(cid != kSmiCid); | 288 ASSERT(cid != kSmiCid); |
316 return in_type->is_nullable() && (in_type->ToNullableCid() == cid); | 289 return in_type->is_nullable() && (in_type->ToNullableCid() == cid); |
317 } | 290 } |
(...skipping 3743 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4061 } | 4034 } |
4062 set_is_auto_scope(auto_setup_scope); | 4035 set_is_auto_scope(auto_setup_scope); |
4063 set_native_c_function(native_function); | 4036 set_native_c_function(native_function); |
4064 } | 4037 } |
4065 | 4038 |
4066 #undef __ | 4039 #undef __ |
4067 | 4040 |
4068 } // namespace dart | 4041 } // namespace dart |
4069 | 4042 |
4070 #endif // !defined(DART_PRECOMPILED_RUNTIME) | 4043 #endif // !defined(DART_PRECOMPILED_RUNTIME) |
OLD | NEW |