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

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

Issue 1327383002: Don't optimize away static field initialization when precompiling. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« runtime/vm/compiler.cc ('K') | « runtime/vm/flow_graph_compiler.cc ('k') | no next file » | 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/constant_propagator.h" 8 #include "vm/constant_propagator.h"
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 19 matching lines...) Expand all
30 30
31 DEFINE_FLAG(bool, ic_range_profiling, true, 31 DEFINE_FLAG(bool, ic_range_profiling, true,
32 "Generate special IC stubs collecting range information " 32 "Generate special IC stubs collecting range information "
33 "for binary and unary arithmetic operations"); 33 "for binary and unary arithmetic operations");
34 DEFINE_FLAG(bool, propagate_ic_data, true, 34 DEFINE_FLAG(bool, propagate_ic_data, true,
35 "Propagate IC data from unoptimized to optimized IC calls."); 35 "Propagate IC data from unoptimized to optimized IC calls.");
36 DEFINE_FLAG(bool, two_args_smi_icd, true, 36 DEFINE_FLAG(bool, two_args_smi_icd, true,
37 "Generate special IC stubs for two args Smi operations"); 37 "Generate special IC stubs for two args Smi operations");
38 DEFINE_FLAG(bool, unbox_numeric_fields, true, 38 DEFINE_FLAG(bool, unbox_numeric_fields, true,
39 "Support unboxed double and float32x4 fields."); 39 "Support unboxed double and float32x4 fields.");
40 DEFINE_FLAG(bool, fields_may_be_reset, false,
41 "Don't optimize away static field initialization");
hausner 2015/09/10 22:55:12 The flag name and the description are quite differ
rmacnak 2015/09/11 00:07:13 Added: // When precompiling, the fact that a fi
40 DECLARE_FLAG(bool, eliminate_type_checks); 42 DECLARE_FLAG(bool, eliminate_type_checks);
41 DECLARE_FLAG(bool, trace_optimization); 43 DECLARE_FLAG(bool, trace_optimization);
42 DECLARE_FLAG(bool, throw_on_javascript_int_overflow); 44 DECLARE_FLAG(bool, throw_on_javascript_int_overflow);
43 45
44 Definition::Definition(intptr_t deopt_id) 46 Definition::Definition(intptr_t deopt_id)
45 : Instruction(deopt_id), 47 : Instruction(deopt_id),
46 range_(NULL), 48 range_(NULL),
47 type_(NULL), 49 type_(NULL),
48 temp_index_(-1), 50 temp_index_(-1),
49 ssa_temp_index_(-1), 51 ssa_temp_index_(-1),
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 } 380 }
379 return (other_load->field() == NULL) && 381 return (other_load->field() == NULL) &&
380 (offset_in_bytes() == other_load->offset_in_bytes()); 382 (offset_in_bytes() == other_load->offset_in_bytes());
381 } 383 }
382 384
383 385
384 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) { 386 Instruction* InitStaticFieldInstr::Canonicalize(FlowGraph* flow_graph) {
385 const bool is_initialized = 387 const bool is_initialized =
386 (field_.StaticValue() != Object::sentinel().raw()) && 388 (field_.StaticValue() != Object::sentinel().raw()) &&
387 (field_.StaticValue() != Object::transition_sentinel().raw()); 389 (field_.StaticValue() != Object::transition_sentinel().raw());
388 return is_initialized ? NULL : this; 390 return is_initialized && !FLAG_fields_may_be_reset ? NULL : this;
389 } 391 }
390 392
391 393
392 EffectSet LoadStaticFieldInstr::Dependencies() const { 394 EffectSet LoadStaticFieldInstr::Dependencies() const {
393 return StaticField().is_final() ? EffectSet::None() : EffectSet::All(); 395 return StaticField().is_final() ? EffectSet::None() : EffectSet::All();
394 } 396 }
395 397
396 398
397 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const { 399 bool LoadStaticFieldInstr::AttributesEqual(Instruction* other) const {
398 LoadStaticFieldInstr* other_load = other->AsLoadStaticField(); 400 LoadStaticFieldInstr* other_load = other->AsLoadStaticField();
(...skipping 3240 matching lines...) Expand 10 before | Expand all | Expand 10 after
3639 case Token::kTRUNCDIV: return 0; 3641 case Token::kTRUNCDIV: return 0;
3640 case Token::kMOD: return 1; 3642 case Token::kMOD: return 1;
3641 default: UNIMPLEMENTED(); return -1; 3643 default: UNIMPLEMENTED(); return -1;
3642 } 3644 }
3643 } 3645 }
3644 3646
3645 3647
3646 #undef __ 3648 #undef __
3647 3649
3648 } // namespace dart 3650 } // namespace dart
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/flow_graph_compiler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698