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

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

Issue 1497783002: Fix optimizations on static fields in precompiled code. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: addressed comment Created 5 years 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
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 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 (field_.StaticValue() != Object::transition_sentinel().raw()); 391 (field_.StaticValue() != Object::transition_sentinel().raw());
392 // When precompiling, the fact that a field is currently initialized does not 392 // When precompiling, the fact that a field is currently initialized does not
393 // make it safe to omit code that checks if the field needs initialization 393 // make it safe to omit code that checks if the field needs initialization
394 // because the field will be reset so it starts uninitialized in the process 394 // because the field will be reset so it starts uninitialized in the process
395 // running the precompiled code. We must be prepared to reinitialize fields. 395 // running the precompiled code. We must be prepared to reinitialize fields.
396 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this; 396 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this;
397 } 397 }
398 398
399 399
400 EffectSet LoadStaticFieldInstr::Dependencies() const { 400 EffectSet LoadStaticFieldInstr::Dependencies() const {
401 return StaticField().is_final() ? EffectSet::None() : EffectSet::All(); 401 return (StaticField().is_final() && !FLAG_fields_may_be_reset)
402 ? EffectSet::None() : EffectSet::All();
402 } 403 }
403 404
404 405
405 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { 406 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
406 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); 407 LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
407 ASSERT(other_load != NULL); 408 ASSERT(other_load != NULL);
408 // Assert that the field is initialized. 409 // Assert that the field is initialized.
409 ASSERT(StaticField().StaticValue() != Object::sentinel().raw()); 410 ASSERT(StaticField().StaticValue() != Object::sentinel().raw());
410 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw()); 411 ASSERT(StaticField().StaticValue() != Object::transition_sentinel().raw());
411 return StaticField().raw() == other_load->StaticField().raw(); 412 return StaticField().raw() == other_load->StaticField().raw();
(...skipping 3265 matching lines...) Expand 10 before | Expand all | Expand 10 after
3677 set_native_c_function(native_function); 3678 set_native_c_function(native_function);
3678 function().SetIsNativeAutoSetupScope(auto_setup_scope); 3679 function().SetIsNativeAutoSetupScope(auto_setup_scope);
3679 Dart_NativeEntryResolver resolver = library.native_entry_resolver(); 3680 Dart_NativeEntryResolver resolver = library.native_entry_resolver();
3680 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver); 3681 bool is_bootstrap_native = Bootstrap::IsBootstapResolver(resolver);
3681 set_is_bootstrap_native(is_bootstrap_native); 3682 set_is_bootstrap_native(is_bootstrap_native);
3682 } 3683 }
3683 3684
3684 #undef __ 3685 #undef __
3685 3686
3686 } // namespace dart 3687 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | tests/language/vm/precompiled_static_initializer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698