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

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
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) {
srdjan 2014/08/11 21:42:34 Why don't you do that in the FlowGraphBuilder inst
Florian Schneider 2014/08/13 14:56:12 I only want the inlined code for unoptimized code
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 Definition* def =
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 flow_graph_->InsertAfter(replacement, def, NULL, FlowGraph::kEffect);
4428 Definition* cursor = def;
4429 for (intptr_t i = 0; i < instr->num_context_variables(); ++i) {
4430 def =
4431 new(I) StoreInstanceFieldInstr(Context::variable_offset(i),
4432 new Value(replacement),
4433 new Value(flow_graph_->constant_null()),
4434 kNoStoreBarrier,
4435 instr->token_pos());
4436 flow_graph_->InsertAfter(cursor, def, NULL, FlowGraph::kEffect);
4437 cursor = def;
4438 }
4439 }
4440
4441
4413 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr, 4442 bool FlowGraphOptimizer::TryInlineInstanceSetter(InstanceCallInstr* instr,
4414 const ICData& unary_ic_data) { 4443 const ICData& unary_ic_data) {
4415 ASSERT((unary_ic_data.NumberOfChecks() > 0) && 4444 ASSERT((unary_ic_data.NumberOfChecks() > 0) &&
4416 (unary_ic_data.NumArgsTested() == 1)); 4445 (unary_ic_data.NumArgsTested() == 1));
4417 if (FLAG_enable_type_checks) { 4446 if (FLAG_enable_type_checks) {
4418 // Checked mode setters are inlined like normal methods by conventional 4447 // Checked mode setters are inlined like normal methods by conventional
4419 // inlining. 4448 // inlining.
4420 return false; 4449 return false;
4421 } 4450 }
4422 4451
(...skipping 4217 matching lines...) Expand 10 before | Expand all | Expand 10 after
8640 SetValue(instr, non_constant_); 8669 SetValue(instr, non_constant_);
8641 } 8670 }
8642 } 8671 }
8643 8672
8644 8673
8645 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) { 8674 void ConstantPropagator::VisitAllocateContext(AllocateContextInstr* instr) {
8646 SetValue(instr, non_constant_); 8675 SetValue(instr, non_constant_);
8647 } 8676 }
8648 8677
8649 8678
8679 void ConstantPropagator::VisitAllocateUninitializedContext(
8680 AllocateUninitializedContextInstr* instr) {
8681 SetValue(instr, non_constant_);
8682 }
8683
8684
8650 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) { 8685 void ConstantPropagator::VisitCloneContext(CloneContextInstr* instr) {
8651 SetValue(instr, non_constant_); 8686 SetValue(instr, non_constant_);
8652 } 8687 }
8653 8688
8654 8689
8655 void ConstantPropagator::HandleBinaryOp(Definition* instr, 8690 void ConstantPropagator::HandleBinaryOp(Definition* instr,
8656 Token::Kind op_kind, 8691 Token::Kind op_kind,
8657 const Value& left_val, 8692 const Value& left_val,
8658 const Value& right_val) { 8693 const Value& right_val) {
8659 const Object& left = left_val.definition()->constant_value(); 8694 const Object& left = left_val.definition()->constant_value();
(...skipping 1755 matching lines...) Expand 10 before | Expand all | Expand 10 after
10415 10450
10416 // Insert materializations at environment uses. 10451 // Insert materializations at environment uses.
10417 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) { 10452 for (intptr_t i = 0; i < exits_collector_.exits().length(); i++) {
10418 CreateMaterializationAt( 10453 CreateMaterializationAt(
10419 exits_collector_.exits()[i], alloc, alloc->cls(), *slots); 10454 exits_collector_.exits()[i], alloc, alloc->cls(), *slots);
10420 } 10455 }
10421 } 10456 }
10422 10457
10423 10458
10424 } // namespace dart 10459 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698