Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: runtime/vm/intermediate_language.cc

Issue 1859273002: Add flag to disable string externalization (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/jit_optimizer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "vm/intermediate_language.h" 5 #include "vm/intermediate_language.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/bootstrap.h" 8 #include "vm/bootstrap.h"
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/constant_propagator.h" 10 #include "vm/constant_propagator.h"
(...skipping 18 matching lines...) Expand all
29 29
30 namespace dart { 30 namespace dart {
31 31
32 DEFINE_FLAG(bool, propagate_ic_data, true, 32 DEFINE_FLAG(bool, propagate_ic_data, true,
33 "Propagate IC data from unoptimized to optimized IC calls."); 33 "Propagate IC data from unoptimized to optimized IC calls.");
34 DEFINE_FLAG(bool, two_args_smi_icd, true, 34 DEFINE_FLAG(bool, two_args_smi_icd, true,
35 "Generate special IC stubs for two args Smi operations"); 35 "Generate special IC stubs for two args Smi operations");
36 DEFINE_FLAG(bool, unbox_numeric_fields, true, 36 DEFINE_FLAG(bool, unbox_numeric_fields, true,
37 "Support unboxed double and float32x4 fields."); 37 "Support unboxed double and float32x4 fields.");
38 DECLARE_FLAG(bool, eliminate_type_checks); 38 DECLARE_FLAG(bool, eliminate_type_checks);
39 DECLARE_FLAG(bool, support_externalizable_strings);
39 40
40 41
41 #if defined(DEBUG) 42 #if defined(DEBUG)
42 void Instruction::CheckField(const Field& field) const { 43 void Instruction::CheckField(const Field& field) const {
43 ASSERT(field.IsZoneHandle()); 44 ASSERT(field.IsZoneHandle());
44 ASSERT(!Compiler::IsBackgroundCompilation() || !field.IsOriginal()); 45 ASSERT(!Compiler::IsBackgroundCompilation() || !field.IsOriginal());
45 } 46 }
46 #endif // DEBUG 47 #endif // DEBUG
47 48
48 49
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 // TODO(fschneider): Make sure ic_data are sorted to hit more cases. 163 // TODO(fschneider): Make sure ic_data are sorted to hit more cases.
163 if (unary_checks().GetReceiverClassIdAt(i) != 164 if (unary_checks().GetReceiverClassIdAt(i) !=
164 other_check->unary_checks().GetReceiverClassIdAt(i)) { 165 other_check->unary_checks().GetReceiverClassIdAt(i)) {
165 return false; 166 return false;
166 } 167 }
167 } 168 }
168 return true; 169 return true;
169 } 170 }
170 171
171 172
172 bool CheckClassInstr::IsImmutableClassId(intptr_t cid) {
173 switch (cid) {
174 case kOneByteStringCid:
175 case kTwoByteStringCid:
176 return false;
177 default:
178 return true;
179 }
180 }
181
182
183 static bool AreAllChecksImmutable(const ICData& checks) { 173 static bool AreAllChecksImmutable(const ICData& checks) {
184 const intptr_t len = checks.NumberOfChecks(); 174 const intptr_t len = checks.NumberOfChecks();
185 for (intptr_t i = 0; i < len; i++) { 175 for (intptr_t i = 0; i < len; i++) {
186 if (checks.IsUsedAt(i)) { 176 if (checks.IsUsedAt(i)) {
187 if (!CheckClassInstr::IsImmutableClassId( 177 if (Field::IsExternalizableCid(
188 checks.GetReceiverClassIdAt(i))) { 178 checks.GetReceiverClassIdAt(i))) {
189 return false; 179 return false;
190 } 180 }
191 } 181 }
192 } 182 }
193 return true; 183 return true;
194 } 184 }
195 185
196 186
197 EffectSet CheckClassInstr::Dependencies() const { 187 EffectSet CheckClassInstr::Dependencies() const {
198 // Externalization of strings via the API can change the class-id. 188 // Externalization of strings via the API can change the class-id.
199 return !AreAllChecksImmutable(unary_checks()) ? 189 return !AreAllChecksImmutable(unary_checks()) ?
200 EffectSet::Externalization() : EffectSet::None(); 190 EffectSet::Externalization() : EffectSet::None();
201 } 191 }
202 192
203 193
204 EffectSet CheckClassIdInstr::Dependencies() const { 194 EffectSet CheckClassIdInstr::Dependencies() const {
205 // Externalization of strings via the API can change the class-id. 195 // Externalization of strings via the API can change the class-id.
206 return !CheckClassInstr::IsImmutableClassId(cid_) ? 196 return Field::IsExternalizableCid(cid_) ?
207 EffectSet::Externalization() : EffectSet::None(); 197 EffectSet::Externalization() : EffectSet::None();
208 } 198 }
209 199
210 200
211 bool CheckClassInstr::DeoptIfNull() const { 201 bool CheckClassInstr::DeoptIfNull() const {
212 if (unary_checks().NumberOfChecks() != 1) { 202 if (unary_checks().NumberOfChecks() != 1) {
213 return false; 203 return false;
214 } 204 }
215 CompileType* in_type = value()->Type(); 205 CompileType* in_type = value()->Type();
216 const intptr_t cid = unary_checks().GetCidAt(0); 206 const intptr_t cid = unary_checks().GetCidAt(0);
(...skipping 3534 matching lines...) Expand 10 before | Expand all | Expand 10 after
3751 set_native_c_function(native_function); 3741 set_native_c_function(native_function);
3752 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3742 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3753 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3743 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3754 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3744 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3755 set_is_bootstrap_native(is_bootstrap_native); 3745 set_is_bootstrap_native(is_bootstrap_native);
3756 } 3746 }
3757 3747
3758 #undef __ 3748 #undef __
3759 3749
3760 } // namespace dart 3750 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/intermediate_language.h ('k') | runtime/vm/jit_optimizer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698