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

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

Issue 1093873002: Revert "Type and constant propagator should guard against mutable class ids." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « no previous file | runtime/vm/dart_api_impl_test.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/constant_propagator.h" 5 #include "vm/constant_propagator.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/flow_graph_compiler.h" 9 #include "vm/flow_graph_compiler.h"
10 #include "vm/flow_graph_range_analysis.h" 10 #include "vm/flow_graph_range_analysis.h"
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 SetValue(instr, non_constant_); 781 SetValue(instr, non_constant_);
782 } 782 }
783 783
784 784
785 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { 785 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) {
786 intptr_t cid = instr->object()->Type()->ToCid(); 786 intptr_t cid = instr->object()->Type()->ToCid();
787 if (cid != kDynamicCid) { 787 if (cid != kDynamicCid) {
788 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid))); 788 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid)));
789 return; 789 return;
790 } 790 }
791
792 const Object& object = instr->object()->definition()->constant_value(); 791 const Object& object = instr->object()->definition()->constant_value();
793 if (IsConstant(object)) { 792 if (IsConstant(object)) {
794 cid = object.GetClassId(); 793 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(object.GetClassId())));
795 if (CheckClassInstr::IsImmutableClassId(cid)) { 794 return;
796 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid)));
797 return;
798 }
799 } 795 }
800 SetValue(instr, non_constant_); 796 SetValue(instr, non_constant_);
801 } 797 }
802 798
803 799
804 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { 800 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) {
805 Value* instance = instr->instance(); 801 Value* instance = instr->instance();
806 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && 802 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) &&
807 instance->definition()->OriginalDefinition()->IsCreateArray()) { 803 instance->definition()->OriginalDefinition()->IsCreateArray()) {
808 Value* num_elements = instance->definition()->OriginalDefinition() 804 Value* num_elements = instance->definition()->OriginalDefinition()
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after
1667 graph_->MergeBlocks(); 1663 graph_->MergeBlocks();
1668 GrowableArray<BitVector*> dominance_frontier; 1664 GrowableArray<BitVector*> dominance_frontier;
1669 graph_->ComputeDominators(&dominance_frontier); 1665 graph_->ComputeDominators(&dominance_frontier);
1670 1666
1671 if (FLAG_trace_constant_propagation) { 1667 if (FLAG_trace_constant_propagation) {
1672 FlowGraphPrinter::PrintGraph("After CP", graph_); 1668 FlowGraphPrinter::PrintGraph("After CP", graph_);
1673 } 1669 }
1674 } 1670 }
1675 1671
1676 } // namespace dart 1672 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart_api_impl_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698