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

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

Issue 2997173002: [vm] Remove Dart_MakeExternalString and --support-externalizable-strings (Closed)
Patch Set: Update vm.status Created 3 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
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 #if !defined(DART_PRECOMPILED_RUNTIME) 5 #if !defined(DART_PRECOMPILED_RUNTIME)
6 6
7 #include "vm/constant_propagator.h" 7 #include "vm/constant_propagator.h"
8 8
9 #include "vm/bit_vector.h" 9 #include "vm/bit_vector.h"
10 #include "vm/flow_graph_builder.h" 10 #include "vm/flow_graph_builder.h"
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 } 282 }
283 } 283 }
284 if (!SetValue(instr, value) && 284 if (!SetValue(instr, value) &&
285 marked_phis_->Contains(instr->ssa_temp_index())) { 285 marked_phis_->Contains(instr->ssa_temp_index())) {
286 marked_phis_->Remove(instr->ssa_temp_index()); 286 marked_phis_->Remove(instr->ssa_temp_index());
287 definition_worklist_.Add(instr); 287 definition_worklist_.Add(instr);
288 } 288 }
289 } 289 }
290 290
291 void ConstantPropagator::VisitRedefinition(RedefinitionInstr* instr) { 291 void ConstantPropagator::VisitRedefinition(RedefinitionInstr* instr) {
292 // Ensure that we never remove redefinition of a constant unless we are also
293 // are guaranteed to fold away code paths that correspond to non-matching
294 // class ids. Otherwise LICM might potentially hoist incorrect code.
295 const Object& value = instr->value()->definition()->constant_value(); 292 const Object& value = instr->value()->definition()->constant_value();
296 if (IsConstant(value) && !Field::IsExternalizableCid(value.GetClassId())) { 293 if (IsConstant(value)) {
297 SetValue(instr, value); 294 SetValue(instr, value);
298 } else { 295 } else {
299 SetValue(instr, non_constant_); 296 SetValue(instr, non_constant_);
300 } 297 }
301 } 298 }
302 299
303 void ConstantPropagator::VisitParameter(ParameterInstr* instr) { 300 void ConstantPropagator::VisitParameter(ParameterInstr* instr) {
304 SetValue(instr, non_constant_); 301 SetValue(instr, non_constant_);
305 } 302 }
306 303
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) { 726 void ConstantPropagator::VisitLoadClassId(LoadClassIdInstr* instr) {
730 intptr_t cid = instr->object()->Type()->ToCid(); 727 intptr_t cid = instr->object()->Type()->ToCid();
731 if (cid != kDynamicCid) { 728 if (cid != kDynamicCid) {
732 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid))); 729 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid)));
733 return; 730 return;
734 } 731 }
735 732
736 const Object& object = instr->object()->definition()->constant_value(); 733 const Object& object = instr->object()->definition()->constant_value();
737 if (IsConstant(object)) { 734 if (IsConstant(object)) {
738 cid = object.GetClassId(); 735 cid = object.GetClassId();
739 if (!Field::IsExternalizableCid(cid)) { 736 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid)));
740 SetValue(instr, Smi::ZoneHandle(Z, Smi::New(cid))); 737 return;
741 return;
742 }
743 } 738 }
744 SetValue(instr, non_constant_); 739 SetValue(instr, non_constant_);
745 } 740 }
746 741
747 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) { 742 void ConstantPropagator::VisitLoadField(LoadFieldInstr* instr) {
748 Value* instance = instr->instance(); 743 Value* instance = instr->instance();
749 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) && 744 if ((instr->recognized_kind() == MethodRecognizer::kObjectArrayLength) &&
750 instance->definition()->OriginalDefinition()->IsCreateArray()) { 745 instance->definition()->OriginalDefinition()->IsCreateArray()) {
751 Value* num_elements = instance->definition() 746 Value* num_elements = instance->definition()
752 ->OriginalDefinition() 747 ->OriginalDefinition()
(...skipping 828 matching lines...) Expand 10 before | Expand all | Expand 10 after
1581 1576
1582 if (FLAG_trace_constant_propagation && 1577 if (FLAG_trace_constant_propagation &&
1583 FlowGraphPrinter::ShouldPrint(graph_->function())) { 1578 FlowGraphPrinter::ShouldPrint(graph_->function())) {
1584 FlowGraphPrinter::PrintGraph("After CP", graph_); 1579 FlowGraphPrinter::PrintGraph("After CP", graph_);
1585 } 1580 }
1586 } 1581 }
1587 1582
1588 } // namespace dart 1583 } // namespace dart
1589 1584
1590 #endif // !defined(DART_PRECOMPILED_RUNTIME) 1585 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698