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

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

Issue 346823003: VM: Optimized context allocation on all platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 4 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.cc » ('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/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/dart_entry.h" 10 #include "vm/dart_entry.h"
(...skipping 4392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4403 } 4403 }
4404 field.set_is_unboxing_candidate(false); 4404 field.set_is_unboxing_candidate(false);
4405 field.DeoptimizeDependentCode(); 4405 field.DeoptimizeDependentCode();
4406 } else { 4406 } else {
4407 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field); 4407 FlowGraph::AddToGuardedFields(flow_graph_->guarded_fields(), &field);
4408 } 4408 }
4409 } 4409 }
4410 } 4410 }
4411 4411
4412 4412
4413 void FlowGraphOptimizer::VisitAllocateContext(AllocateContextInstr* instr) {
4414 // Replace generic allocation with a sequence of inlined allocation and
4415 // explicit initalizing stores.
4416 AllocateUninitializedContextInstr* replacement =
4417 new AllocateUninitializedContextInstr(instr->token_pos(),
4418 instr->num_context_variables());
4419 instr->ReplaceWith(replacement, current_iterator());
4420
4421 StoreInstanceFieldInstr* store =
4422 new(I) StoreInstanceFieldInstr(Context::parent_offset(),
4423 new Value(replacement),
4424 new Value(flow_graph_->constant_null()),
4425 kNoStoreBarrier,
4426 instr->token_pos());
4427 store->set_is_initialization(true); // Won't be eliminated by DSE.
4428 flow_graph_->InsertAfter(replacement, store, NULL, FlowGraph::kEffect);
4429 Definition* cursor = store;
4430 for (intptr_t i = 0; i < instr->num_context_variables(); ++i) {
4431 store =
4432 new(I) StoreInstanceFieldInstr(Context::variable_offset(i),
4433 new Value(replacement),
4434 new Value(flow_graph_->constant_null()),
4435 kNoStoreBarrier,
4436 instr->token_pos());
4437 store->set_is_initialization(true); // Won't be eliminated by DSE.
4438 flow_graph_->InsertAfter(cursor, store, NULL, FlowGraph::kEffect);
4439 cursor = store;
4440 }
4441 }
4442
4443
4413 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, 4444 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
4414 const ICData& unary_ic_data) { 4445 const ICData& unary_ic_data) {
4415 ASSERT((unary_ic_data.NumberOfChecks() > 0) && 4446 ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
4416 (unary_ic_data.NumArgsTested() == 1)); 4447 (unary_ic_data.NumArgsTested() == 1));
4417 if (FLAG_enable_type_checks) { 4448 if (FLAG_enable_type_checks) {
4418 // Checked mode setters are inlined like normal methods by conventional 4449 // Checked mode setters are inlined like normal methods by conventional
4419 // inlining. 4450 // inlining.
4420 return false; 4451 return false;
4421 } 4452 }
4422 4453
(...skipping 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after
8640 SetValue(instr, non_constant_); 8671 SetValue(instr, non_constant_);
8641 } 8672 }
8642 } 8673 }
8643 8674
8644 8675
8645 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) { 8676 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) {
8646 SetValue(instr, non_constant_); 8677 SetValue(instr, non_constant_);
8647 } 8678 }
8648 8679
8649 8680
8681 void ConstantPropagator::VisitAllocateUninitializedContext(
8682 AllocateUninitializedContextInstr* instr) {
8683 SetValue(instr, non_constant_);
8684 }
8685
8686
8650 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { 8687 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) {
8651 SetValue(instr, non_constant_); 8688 SetValue(instr, non_constant_);
8652 } 8689 }
8653 8690
8654 8691
8655 void ConstantPropagator::HandleBinaryOp(Definition* instr, 8692 void ConstantPropagator::HandleBinaryOp(Definition* instr,
8656 Token::Kind op_kind, 8693 Token::Kind op_kind,
8657 const Value& left_val, 8694 const Value& left_val,
8658 const Value& right_val) { 8695 const Value& right_val) {
8659 const Object& left = left_val.definition()->constant_value(); 8696 const Object& left = left_val.definition()->constant_value();
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
10415 10452
10416 // Insert materializations at environment uses. 10453 // Insert materializations at environment uses.
10417 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10454 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10418 CreateMaterializationAt( 10455 CreateMaterializationAt(
10419 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10456 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10420 } 10457 }
10421 } 10458 }
10422 10459
10423 10460
10424 } // namespace dart 10461 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_optimizer.h ('k') | runtime/vm/flow_graph_type_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698