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

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

Issue 1390153004: Move deopt_id and related helpers/definitions from Isolate to Thread (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 2 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
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_builder.h" 5 #include "vm/flow_graph_builder.h"
6 6
7 #include "lib/invocation_mirror.h" 7 #include "lib/invocation_mirror.h"
8 #include "vm/ast_printer.h" 8 #include "vm/ast_printer.h"
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/class_finalizer.h" 10 #include "vm/class_finalizer.h"
(...skipping 1588 matching lines...) Expand 10 before | Expand all | Expand 10 after
1599 Value* instantiator_type_arguments = NULL; 1599 Value* instantiator_type_arguments = NULL;
1600 if (dst_type.IsInstantiated()) { 1600 if (dst_type.IsInstantiated()) {
1601 instantiator = BuildNullValue(); 1601 instantiator = BuildNullValue();
1602 instantiator_type_arguments = BuildNullValue(); 1602 instantiator_type_arguments = BuildNullValue();
1603 } else { 1603 } else {
1604 BuildTypecheckArguments(token_pos, 1604 BuildTypecheckArguments(token_pos,
1605 &instantiator, 1605 &instantiator,
1606 &instantiator_type_arguments); 1606 &instantiator_type_arguments);
1607 } 1607 }
1608 1608
1609 const intptr_t deopt_id = Isolate::Current()->GetNextDeoptId(); 1609 const intptr_t deopt_id = Thread::Current()->GetNextDeoptId();
1610 return new(Z) AssertAssignableInstr(token_pos, 1610 return new(Z) AssertAssignableInstr(token_pos,
1611 value, 1611 value,
1612 instantiator, 1612 instantiator,
1613 instantiator_type_arguments, 1613 instantiator_type_arguments,
1614 dst_type, 1614 dst_type,
1615 dst_name, 1615 dst_name,
1616 deopt_id); 1616 deopt_id);
1617 } 1617 }
1618 1618
1619 1619
(...skipping 834 matching lines...) Expand 10 before | Expand all | Expand 10 after
2454 type_args); 2454 type_args);
2455 Value* num_elements = 2455 Value* num_elements =
2456 Bind(new(Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(node->length())))); 2456 Bind(new(Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(node->length()))));
2457 CreateArrayInstr* create = new(Z) CreateArrayInstr(node->token_pos(), 2457 CreateArrayInstr* create = new(Z) CreateArrayInstr(node->token_pos(),
2458 element_type, 2458 element_type,
2459 num_elements); 2459 num_elements);
2460 Value* array_val = Bind(create); 2460 Value* array_val = Bind(create);
2461 2461
2462 { LocalVariable* tmp_var = EnterTempLocalScope(array_val); 2462 { LocalVariable* tmp_var = EnterTempLocalScope(array_val);
2463 const intptr_t class_id = kArrayCid; 2463 const intptr_t class_id = kArrayCid;
2464 const intptr_t deopt_id = Isolate::kNoDeoptId; 2464 const intptr_t deopt_id = Thread::kNoDeoptId;
2465 for (int i = 0; i < node->length(); ++i) { 2465 for (int i = 0; i < node->length(); ++i) {
2466 Value* array = Bind(new(Z) LoadLocalInstr(*tmp_var)); 2466 Value* array = Bind(new(Z) LoadLocalInstr(*tmp_var));
2467 Value* index = 2467 Value* index =
2468 Bind(new(Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(i)))); 2468 Bind(new(Z) ConstantInstr(Smi::ZoneHandle(Z, Smi::New(i))));
2469 ValueGraphVisitor for_value(owner()); 2469 ValueGraphVisitor for_value(owner());
2470 node->ElementAt(i)->Visit(&for_value); 2470 node->ElementAt(i)->Visit(&for_value);
2471 Append(for_value); 2471 Append(for_value);
2472 // No store barrier needed for constants. 2472 // No store barrier needed for constants.
2473 const StoreBarrierType emit_store_barrier = 2473 const StoreBarrierType emit_store_barrier =
2474 for_value.value()->BindsToConstant() 2474 for_value.value()->BindsToConstant()
(...skipping 1301 matching lines...) Expand 10 before | Expand all | Expand 10 after
3776 store_value, 3776 store_value,
3777 type, 3777 type,
3778 dst_name); 3778 dst_name);
3779 } 3779 }
3780 3780
3781 if (FLAG_use_field_guards) { 3781 if (FLAG_use_field_guards) {
3782 store_value = Bind(BuildStoreExprTemp(store_value)); 3782 store_value = Bind(BuildStoreExprTemp(store_value));
3783 GuardFieldClassInstr* guard_field_class = 3783 GuardFieldClassInstr* guard_field_class =
3784 new(Z) GuardFieldClassInstr(store_value, 3784 new(Z) GuardFieldClassInstr(store_value,
3785 node->field(), 3785 node->field(),
3786 isolate()->GetNextDeoptId()); 3786 thread()->GetNextDeoptId());
3787 AddInstruction(guard_field_class); 3787 AddInstruction(guard_field_class);
3788 store_value = Bind(BuildLoadExprTemp()); 3788 store_value = Bind(BuildLoadExprTemp());
3789 GuardFieldLengthInstr* guard_field_length = 3789 GuardFieldLengthInstr* guard_field_length =
3790 new(Z) GuardFieldLengthInstr(store_value, 3790 new(Z) GuardFieldLengthInstr(store_value,
3791 node->field(), 3791 node->field(),
3792 isolate()->GetNextDeoptId()); 3792 thread()->GetNextDeoptId());
3793 AddInstruction(guard_field_length); 3793 AddInstruction(guard_field_length);
3794 store_value = Bind(BuildLoadExprTemp()); 3794 store_value = Bind(BuildLoadExprTemp());
3795 } 3795 }
3796 StoreInstanceFieldInstr* store = 3796 StoreInstanceFieldInstr* store =
3797 new(Z) StoreInstanceFieldInstr(node->field(), 3797 new(Z) StoreInstanceFieldInstr(node->field(),
3798 for_instance.value(), 3798 for_instance.value(),
3799 store_value, 3799 store_value,
3800 kEmitStoreBarrier, 3800 kEmitStoreBarrier,
3801 node->token_pos()); 3801 node->token_pos());
3802 // Maybe initializing unboxed store. 3802 // Maybe initializing unboxed store.
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
4665 new(Z) GraphEntryInstr(parsed_function(), normal_entry, osr_id_); 4665 new(Z) GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
4666 EffectGraphVisitor for_effect(this); 4666 EffectGraphVisitor for_effect(this);
4667 parsed_function().node_sequence()->Visit(&for_effect); 4667 parsed_function().node_sequence()->Visit(&for_effect);
4668 AppendFragment(normal_entry, for_effect); 4668 AppendFragment(normal_entry, for_effect);
4669 // Check that the graph is properly terminated. 4669 // Check that the graph is properly terminated.
4670 ASSERT(!for_effect.is_open()); 4670 ASSERT(!for_effect.is_open());
4671 4671
4672 // When compiling for OSR, use a depth first search to prune instructions 4672 // When compiling for OSR, use a depth first search to prune instructions
4673 // unreachable from the OSR entry. Catch entries are always considered 4673 // unreachable from the OSR entry. Catch entries are always considered
4674 // reachable, even if they become unreachable after OSR. 4674 // reachable, even if they become unreachable after OSR.
4675 if (osr_id_ != Isolate::kNoDeoptId) { 4675 if (osr_id_ != Thread::kNoDeoptId) {
4676 PruneUnreachable(); 4676 PruneUnreachable();
4677 } 4677 }
4678 4678
4679 FlowGraph* graph = 4679 FlowGraph* graph =
4680 new(Z) FlowGraph(parsed_function(), graph_entry_, last_used_block_id_); 4680 new(Z) FlowGraph(parsed_function(), graph_entry_, last_used_block_id_);
4681 return graph; 4681 return graph;
4682 } 4682 }
4683 4683
4684 4684
4685 void FlowGraphBuilder::PruneUnreachable() { 4685 void FlowGraphBuilder::PruneUnreachable() {
4686 ASSERT(osr_id_ != Isolate::kNoDeoptId); 4686 ASSERT(osr_id_ != Thread::kNoDeoptId);
4687 BitVector* block_marks = new(Z) BitVector(Z, last_used_block_id_ + 1); 4687 BitVector* block_marks = new(Z) BitVector(Z, last_used_block_id_ + 1);
4688 bool found = graph_entry_->PruneUnreachable(this, graph_entry_, NULL, osr_id_, 4688 bool found = graph_entry_->PruneUnreachable(this, graph_entry_, NULL, osr_id_,
4689 block_marks); 4689 block_marks);
4690 ASSERT(found); 4690 ASSERT(found);
4691 } 4691 }
4692 4692
4693 4693
4694 void FlowGraphBuilder::Bailout(const char* reason) const { 4694 void FlowGraphBuilder::Bailout(const char* reason) const {
4695 const Function& function = parsed_function_.function(); 4695 const Function& function = parsed_function_.function();
4696 Report::MessageF(Report::kBailout, 4696 Report::MessageF(Report::kBailout,
4697 Script::Handle(function.script()), 4697 Script::Handle(function.script()),
4698 function.token_pos(), 4698 function.token_pos(),
4699 "FlowGraphBuilder Bailout: %s %s", 4699 "FlowGraphBuilder Bailout: %s %s",
4700 String::Handle(function.name()).ToCString(), 4700 String::Handle(function.name()).ToCString(),
4701 reason); 4701 reason);
4702 UNREACHABLE(); 4702 UNREACHABLE();
4703 } 4703 }
4704 4704
4705 } // namespace dart 4705 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698