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

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

Issue 23589008: Clean up handling of guarded fields in the flow graph builder. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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.h" 5 #include "vm/flow_graph.h"
6 6
7 #include "vm/bit_vector.h" 7 #include "vm/bit_vector.h"
8 #include "vm/flow_graph_builder.h" 8 #include "vm/flow_graph_builder.h"
9 #include "vm/intermediate_language.h" 9 #include "vm/intermediate_language.h"
10 #include "vm/longjump.h" 10 #include "vm/longjump.h"
(...skipping 20 matching lines...) Expand all
31 num_stack_locals_(builder.num_stack_locals()), 31 num_stack_locals_(builder.num_stack_locals()),
32 graph_entry_(graph_entry), 32 graph_entry_(graph_entry),
33 preorder_(), 33 preorder_(),
34 postorder_(), 34 postorder_(),
35 reverse_postorder_(), 35 reverse_postorder_(),
36 optimized_block_order_(), 36 optimized_block_order_(),
37 block_effects_(NULL), 37 block_effects_(NULL),
38 licm_allowed_(true), 38 licm_allowed_(true),
39 use_far_branches_(false), 39 use_far_branches_(false),
40 loop_headers_(NULL), 40 loop_headers_(NULL),
41 loop_invariant_loads_(NULL) { 41 loop_invariant_loads_(NULL),
42 guarded_fields_(builder.guarded_fields()) {
42 DiscoverBlocks(); 43 DiscoverBlocks();
43 } 44 }
44 45
45 46
47 void FlowGraph::AddToGuardedFields(
48 const Field* field,
49 ZoneGrowableArray<const Field*>* array) {
50 if ((field->guarded_cid() == kDynamicCid) ||
51 (field->guarded_cid() == kIllegalCid)) {
52 return;
53 }
54 for (intptr_t j = 0; j < array->length(); j++) {
55 if ((*array)[j]->raw() == field->raw()) {
56 return;
57 }
58 }
59 array->Add(field);
60 }
61
62
46 GrowableArray<BlockEntryInstr*>* FlowGraph::codegen_block_order( 63 GrowableArray<BlockEntryInstr*>* FlowGraph::codegen_block_order(
47 bool is_optimized) { 64 bool is_optimized) {
48 return (is_optimized && FLAG_reorder_basic_blocks) 65 return (is_optimized && FLAG_reorder_basic_blocks)
49 ? &optimized_block_order_ 66 ? &optimized_block_order_
50 : &reverse_postorder_; 67 : &reverse_postorder_;
51 } 68 }
52 69
53 70
54 ConstantInstr* FlowGraph::GetConstant(const Object& object) { 71 ConstantInstr* FlowGraph::GetConstant(const Object& object) {
55 // Check if the constant is already in the pool. 72 // Check if the constant is already in the pool.
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 } 1186 }
1170 1187
1171 1188
1172 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1189 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1173 BlockEntryInstr* to) const { 1190 BlockEntryInstr* to) const {
1174 return available_at_[to->postorder_number()]->Contains( 1191 return available_at_[to->postorder_number()]->Contains(
1175 from->postorder_number()); 1192 from->postorder_number());
1176 } 1193 }
1177 1194
1178 } // namespace dart 1195 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698