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

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

Issue 12529008: Collect type feedback for fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ensure that not-null constraints are recomputed correctly Created 7 years, 9 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 | Annotate | Revision Log
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/flow_graph_optimizer.h" 5 #include "vm/flow_graph_optimizer.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/cha.h" 8 #include "vm/cha.h"
9 #include "vm/flow_graph_builder.h" 9 #include "vm/flow_graph_builder.h"
10 #include "vm/flow_graph_compiler.h" 10 #include "vm/flow_graph_compiler.h"
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after
1226 ASSERT(!field.IsNull()); 1226 ASSERT(!field.IsNull());
1227 1227
1228 if (InstanceCallNeedsClassCheck(call)) { 1228 if (InstanceCallNeedsClassCheck(call)) {
1229 AddReceiverCheck(call); 1229 AddReceiverCheck(call);
1230 } 1230 }
1231 LoadFieldInstr* load = new LoadFieldInstr( 1231 LoadFieldInstr* load = new LoadFieldInstr(
1232 new Value(call->ArgumentAt(0)), 1232 new Value(call->ArgumentAt(0)),
1233 field.Offset(), 1233 field.Offset(),
1234 AbstractType::ZoneHandle(field.type()), 1234 AbstractType::ZoneHandle(field.type()),
1235 field.is_final()); 1235 field.is_final());
1236 if (field.guarded_cid() != kIllegalCid) {
1237 load->set_result_cid(field.GuardedCid());
1238 load->set_field(&Field::ZoneHandle(field.raw()));
1239 }
1240 load->set_field_name(String::Handle(field.name()).ToCString());
1241
1236 // Discard the environment from the original instruction because the load 1242 // Discard the environment from the original instruction because the load
1237 // can't deoptimize. 1243 // can't deoptimize.
1238 call->RemoveEnvironment(); 1244 call->RemoveEnvironment();
1239 ReplaceCall(call, load); 1245 ReplaceCall(call, load);
1240 } 1246 }
1241 1247
1242 1248
1243 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call, 1249 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call,
1244 intptr_t length_offset, 1250 intptr_t length_offset,
1245 bool is_immutable, 1251 bool is_immutable,
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 } 2015 }
2010 StoreBarrierType needs_store_barrier = kEmitStoreBarrier; 2016 StoreBarrierType needs_store_barrier = kEmitStoreBarrier;
2011 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) { 2017 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) {
2012 InsertBefore(instr, 2018 InsertBefore(instr,
2013 new CheckSmiInstr(new Value(instr->ArgumentAt(1)), 2019 new CheckSmiInstr(new Value(instr->ArgumentAt(1)),
2014 instr->deopt_id()), 2020 instr->deopt_id()),
2015 instr->env(), 2021 instr->env(),
2016 Definition::kEffect); 2022 Definition::kEffect);
2017 needs_store_barrier = kNoStoreBarrier; 2023 needs_store_barrier = kNoStoreBarrier;
2018 } 2024 }
2025
2026 if (field.guarded_cid() != kDynamicCid) {
2027 InsertBefore(instr,
2028 new GuardFieldInstr(new Value(instr->ArgumentAt(1)),
2029 field,
2030 instr->deopt_id()),
2031 instr->env(),
2032 Definition::kEffect);
2033 }
2034
2035 // Field guard was detached.
2019 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr( 2036 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr(
2020 field, 2037 field,
2021 new Value(instr->ArgumentAt(0)), 2038 new Value(instr->ArgumentAt(0)),
2022 new Value(instr->ArgumentAt(1)), 2039 new Value(instr->ArgumentAt(1)),
2023 needs_store_barrier); 2040 needs_store_barrier);
2024 // Discard the environment from the original instruction because the store 2041 // Discard the environment from the original instruction because the store
2025 // can't deoptimize. 2042 // can't deoptimize.
2026 instr->RemoveEnvironment(); 2043 instr->RemoveEnvironment();
2027 ReplaceCall(instr, store); 2044 ReplaceCall(instr, store);
2028 return true; 2045 return true;
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 3787
3771 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { } 3788 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { }
3772 3789
3773 3790
3774 void ConstantPropagator::VisitCheckStackOverflow( 3791 void ConstantPropagator::VisitCheckStackOverflow(
3775 CheckStackOverflowInstr* instr) { } 3792 CheckStackOverflowInstr* instr) { }
3776 3793
3777 3794
3778 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { } 3795 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { }
3779 3796
3797 void ConstantPropagator::VisitGuardField(GuardFieldInstr* instr) { }
3780 3798
3781 void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) { } 3799 void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) { }
3782 3800
3783 3801
3784 void ConstantPropagator::VisitCheckEitherNonSmi( 3802 void ConstantPropagator::VisitCheckEitherNonSmi(
3785 CheckEitherNonSmiInstr* instr) { } 3803 CheckEitherNonSmiInstr* instr) { }
3786 3804
3787 3805
3788 void ConstantPropagator::VisitCheckArrayBound(CheckArrayBoundInstr* instr) { } 3806 void ConstantPropagator::VisitCheckArrayBound(CheckArrayBoundInstr* instr) { }
3789 3807
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
4659 if (changed) { 4677 if (changed) {
4660 // We may have changed the block order and the dominator tree. 4678 // We may have changed the block order and the dominator tree.
4661 flow_graph->DiscoverBlocks(); 4679 flow_graph->DiscoverBlocks();
4662 GrowableArray<BitVector*> dominance_frontier; 4680 GrowableArray<BitVector*> dominance_frontier;
4663 flow_graph->ComputeDominators(&dominance_frontier); 4681 flow_graph->ComputeDominators(&dominance_frontier);
4664 } 4682 }
4665 } 4683 }
4666 4684
4667 4685
4668 } // namespace dart 4686 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698