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

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

Issue 298913007: Use isolate when allocation Zone objects and handles: focus on FlowGraphOptimizer, next inliner. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 7 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.h ('k') | runtime/vm/flow_graph_builder.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) 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"
11 #include "vm/growable_array.h" 11 #include "vm/growable_array.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 DECLARE_FLAG(bool, reorder_basic_blocks); 15 DECLARE_FLAG(bool, reorder_basic_blocks);
16 DECLARE_FLAG(bool, trace_optimization); 16 DECLARE_FLAG(bool, trace_optimization);
17 DECLARE_FLAG(bool, verify_compiler); 17 DECLARE_FLAG(bool, verify_compiler);
18 DEFINE_FLAG(bool, optimize_try_catch, true, "Optimization of try-catch"); 18 DEFINE_FLAG(bool, optimize_try_catch, true, "Optimization of try-catch");
19 19
20 20
21 FlowGraph::FlowGraph(const FlowGraphBuilder& builder, 21 FlowGraph::FlowGraph(const FlowGraphBuilder& builder,
22 GraphEntryInstr* graph_entry, 22 GraphEntryInstr* graph_entry,
23 intptr_t max_block_id) 23 intptr_t max_block_id)
24 : parent_(), 24 : isolate_(Isolate::Current()),
25 parent_(),
25 current_ssa_temp_index_(0), 26 current_ssa_temp_index_(0),
26 max_block_id_(max_block_id), 27 max_block_id_(max_block_id),
27 builder_(builder), 28 builder_(builder),
28 parsed_function_(*builder.parsed_function()), 29 parsed_function_(*builder.parsed_function()),
29 num_copied_params_(builder.num_copied_params()), 30 num_copied_params_(builder.num_copied_params()),
30 num_non_copied_params_(builder.num_non_copied_params()), 31 num_non_copied_params_(builder.num_non_copied_params()),
31 num_stack_locals_(builder.num_stack_locals()), 32 num_stack_locals_(builder.num_stack_locals()),
32 graph_entry_(graph_entry), 33 graph_entry_(graph_entry),
33 preorder_(), 34 preorder_(),
34 postorder_(), 35 postorder_(),
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 void FlowGraph::InsertAfter(Instruction* prev, 113 void FlowGraph::InsertAfter(Instruction* prev,
113 Instruction* instr, 114 Instruction* instr,
114 Environment* env, 115 Environment* env,
115 UseKind use_kind) { 116 UseKind use_kind) {
116 if (use_kind == kValue) { 117 if (use_kind == kValue) {
117 ASSERT(instr->IsDefinition()); 118 ASSERT(instr->IsDefinition());
118 AllocateSSAIndexes(instr->AsDefinition()); 119 AllocateSSAIndexes(instr->AsDefinition());
119 } 120 }
120 instr->InsertAfter(prev); 121 instr->InsertAfter(prev);
121 ASSERT(instr->env() == NULL); 122 ASSERT(instr->env() == NULL);
122 if (env != NULL) env->DeepCopyTo(instr); 123 if (env != NULL) env->DeepCopyTo(isolate(), instr);
123 } 124 }
124 125
125 126
126 Instruction* FlowGraph::AppendTo(Instruction* prev, 127 Instruction* FlowGraph::AppendTo(Instruction* prev,
127 Instruction* instr, 128 Instruction* instr,
128 Environment* env, 129 Environment* env,
129 UseKind use_kind) { 130 UseKind use_kind) {
130 if (use_kind == kValue) { 131 if (use_kind == kValue) {
131 ASSERT(instr->IsDefinition()); 132 ASSERT(instr->IsDefinition());
132 AllocateSSAIndexes(instr->AsDefinition()); 133 AllocateSSAIndexes(instr->AsDefinition());
133 } 134 }
134 ASSERT(instr->env() == NULL); 135 ASSERT(instr->env() == NULL);
135 if (env != NULL) env->DeepCopyTo(instr); 136 if (env != NULL) env->DeepCopyTo(isolate(), instr);
136 return prev->AppendInstruction(instr); 137 return prev->AppendInstruction(instr);
137 } 138 }
138 139
139 140
140 void FlowGraph::DiscoverBlocks() { 141 void FlowGraph::DiscoverBlocks() {
141 // Initialize state. 142 // Initialize state.
142 preorder_.Clear(); 143 preorder_.Clear();
143 postorder_.Clear(); 144 postorder_.Clear();
144 reverse_postorder_.Clear(); 145 reverse_postorder_.Clear();
145 parent_.Clear(); 146 parent_.Clear();
(...skipping 601 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 // on entry to the catch. 748 // on entry to the catch.
748 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params()); 749 entry->set_fixed_slot_count(num_stack_locals() + num_copied_params());
749 } 750 }
750 RenameRecursive(entry, &env, live_phis, variable_liveness); 751 RenameRecursive(entry, &env, live_phis, variable_liveness);
751 } 752 }
752 753
753 754
754 void FlowGraph::AttachEnvironment(Instruction* instr, 755 void FlowGraph::AttachEnvironment(Instruction* instr,
755 GrowableArray<Definition*>* env) { 756 GrowableArray<Definition*>* env) {
756 Environment* deopt_env = 757 Environment* deopt_env =
757 Environment::From(*env, 758 Environment::From(isolate(),
759 *env,
758 num_non_copied_params_, 760 num_non_copied_params_,
759 Code::Handle(parsed_function_.code())); 761 Code::Handle(parsed_function_.code()));
760 // TODO(fschneider): Add predicates CanEagerlyDeoptimize and 762 // TODO(fschneider): Add predicates CanEagerlyDeoptimize and
761 // CanLazilyDeoptimize to instructions to generally deal with instructions 763 // CanLazilyDeoptimize to instructions to generally deal with instructions
762 // that have pushed arguments and input operands. 764 // that have pushed arguments and input operands.
763 // Right now, closure calls are the only instructions that have both. They 765 // Right now, closure calls are the only instructions that have both. They
764 // also don't have an eager deoptimziation point, so the environment attached 766 // also don't have an eager deoptimziation point, so the environment attached
765 // here is only used for after the call. 767 // here is only used for after the call.
766 if (instr->IsClosureCall()) { 768 if (instr->IsClosureCall()) {
767 deopt_env = deopt_env->DeepCopy(deopt_env->Length() - instr->InputCount()); 769 deopt_env = deopt_env->DeepCopy(isolate(),
770 deopt_env->Length() - instr->InputCount());
768 } 771 }
769 instr->SetEnvironment(deopt_env); 772 instr->SetEnvironment(deopt_env);
770 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) { 773 for (Environment::DeepIterator it(deopt_env); !it.Done(); it.Advance()) {
771 Value* use = it.CurrentValue(); 774 Value* use = it.CurrentValue();
772 use->definition()->AddEnvUse(use); 775 use->definition()->AddEnvUse(use);
773 } 776 }
774 if (instr->CanDeoptimize()) { 777 if (instr->CanDeoptimize()) {
775 instr->env()->set_deopt_id(instr->deopt_id()); 778 instr->env()->set_deopt_id(instr->deopt_id());
776 } 779 }
777 } 780 }
(...skipping 450 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 } 1231 }
1229 1232
1230 1233
1231 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from, 1234 bool BlockEffects::IsSideEffectFreePath(BlockEntryInstr* from,
1232 BlockEntryInstr* to) const { 1235 BlockEntryInstr* to) const {
1233 return available_at_[to->postorder_number()]->Contains( 1236 return available_at_[to->postorder_number()]->Contains(
1234 from->postorder_number()); 1237 from->postorder_number());
1235 } 1238 }
1236 1239
1237 } // namespace dart 1240 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph.h ('k') | runtime/vm/flow_graph_builder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698