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

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: address Ivan's comments 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
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.h » ('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/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 if (!field.is_nullable() || (field.guarded_cid() == kNullCid)) {
1238 load->set_result_cid(field.guarded_cid());
1239 }
1240 load->set_field(&Field::ZoneHandle(field.raw()));
1241 }
1242 load->set_field_name(String::Handle(field.name()).ToCString());
1243
1236 // Discard the environment from the original instruction because the load 1244 // Discard the environment from the original instruction because the load
1237 // can't deoptimize. 1245 // can't deoptimize.
1238 call->RemoveEnvironment(); 1246 call->RemoveEnvironment();
1239 ReplaceCall(call, load); 1247 ReplaceCall(call, load);
1240 } 1248 }
1241 1249
1242 1250
1243 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call, 1251 void FlowGraphOptimizer::InlineArrayLengthGetter(InstanceCallInstr* call,
1244 intptr_t length_offset, 1252 intptr_t length_offset,
1245 bool is_immutable, 1253 bool is_immutable,
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after
2009 } 2017 }
2010 StoreBarrierType needs_store_barrier = kEmitStoreBarrier; 2018 StoreBarrierType needs_store_barrier = kEmitStoreBarrier;
2011 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) { 2019 if (ArgIsAlwaysSmi(*instr->ic_data(), 1)) {
2012 InsertBefore(instr, 2020 InsertBefore(instr,
2013 new CheckSmiInstr(new Value(instr->ArgumentAt(1)), 2021 new CheckSmiInstr(new Value(instr->ArgumentAt(1)),
2014 instr->deopt_id()), 2022 instr->deopt_id()),
2015 instr->env(), 2023 instr->env(),
2016 Definition::kEffect); 2024 Definition::kEffect);
2017 needs_store_barrier = kNoStoreBarrier; 2025 needs_store_barrier = kNoStoreBarrier;
2018 } 2026 }
2027
2028 if (field.guarded_cid() != kDynamicCid) {
2029 InsertBefore(instr,
2030 new GuardFieldInstr(new Value(instr->ArgumentAt(1)),
2031 field,
2032 instr->deopt_id()),
2033 instr->env(),
2034 Definition::kEffect);
2035 }
2036
2037 // Field guard was detached.
2019 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr( 2038 StoreInstanceFieldInstr* store = new StoreInstanceFieldInstr(
2020 field, 2039 field,
2021 new Value(instr->ArgumentAt(0)), 2040 new Value(instr->ArgumentAt(0)),
2022 new Value(instr->ArgumentAt(1)), 2041 new Value(instr->ArgumentAt(1)),
2023 needs_store_barrier); 2042 needs_store_barrier);
2024 // Discard the environment from the original instruction because the store 2043 // Discard the environment from the original instruction because the store
2025 // can't deoptimize. 2044 // can't deoptimize.
2026 instr->RemoveEnvironment(); 2045 instr->RemoveEnvironment();
2027 ReplaceCall(instr, store); 2046 ReplaceCall(instr, store);
2028 return true; 2047 return true;
(...skipping 1741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3770 3789
3771 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { } 3790 void ConstantPropagator::VisitCatchEntry(CatchEntryInstr* instr) { }
3772 3791
3773 3792
3774 void ConstantPropagator::VisitCheckStackOverflow( 3793 void ConstantPropagator::VisitCheckStackOverflow(
3775 CheckStackOverflowInstr* instr) { } 3794 CheckStackOverflowInstr* instr) { }
3776 3795
3777 3796
3778 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { } 3797 void ConstantPropagator::VisitCheckClass(CheckClassInstr* instr) { }
3779 3798
3799 void ConstantPropagator::VisitGuardField(GuardFieldInstr* instr) { }
3780 3800
3781 void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) { } 3801 void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) { }
3782 3802
3783 3803
3784 void ConstantPropagator::VisitCheckEitherNonSmi( 3804 void ConstantPropagator::VisitCheckEitherNonSmi(
3785 CheckEitherNonSmiInstr* instr) { } 3805 CheckEitherNonSmiInstr* instr) { }
3786 3806
3787 3807
3788 void ConstantPropagator::VisitCheckArrayBound(CheckArrayBoundInstr* instr) { } 3808 void ConstantPropagator::VisitCheckArrayBound(CheckArrayBoundInstr* instr) { }
3789 3809
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after
4659 if (changed) { 4679 if (changed) {
4660 // We may have changed the block order and the dominator tree. 4680 // We may have changed the block order and the dominator tree.
4661 flow_graph->DiscoverBlocks(); 4681 flow_graph->DiscoverBlocks();
4662 GrowableArray<BitVector*> dominance_frontier; 4682 GrowableArray<BitVector*> dominance_frontier;
4663 flow_graph->ComputeDominators(&dominance_frontier); 4683 flow_graph->ComputeDominators(&dominance_frontier);
4664 } 4684 }
4665 } 4685 }
4666 4686
4667 4687
4668 } // namespace dart 4688 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698