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

Side by Side Diff: lib/compiler/implementation/ssa/optimize.dart

Issue 10831154: Make field-get/set work without elements. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 8 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 | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('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) 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 interface OptimizationPhase { 5 interface OptimizationPhase {
6 String get name(); 6 String get name();
7 void visitGraph(HGraph graph); 7 void visitGraph(HGraph graph);
8 } 8 }
9 9
10 class SsaOptimizerTask extends CompilerTask { 10 class SsaOptimizerTask extends CompilerTask {
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 work.element); 585 work.element);
586 break; 586 break;
587 case Compiler.PHASE_RECOMPILING: 587 case Compiler.PHASE_RECOMPILING:
588 // If field is not final or const but no setters are used then the 588 // If field is not final or const but no setters are used then the
589 // field might be considered final anyway as it will be either 589 // field might be considered final anyway as it will be either
590 // un-initialized or initialized in the constructor initializer list. 590 // un-initialized or initialized in the constructor initializer list.
591 isFinalOrConst = true; 591 isFinalOrConst = true;
592 break; 592 break;
593 } 593 }
594 } 594 }
595 return new HFieldGet(field, node.inputs[0], isFinalOrConst: isFinalOrConst); 595 return new HFieldGet.withElement(
596 field, node.inputs[0], isFinalOrConst: isFinalOrConst);
596 } 597 }
597 598
598 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 599 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
599 HInstruction receiver = node.inputs[0]; 600 HInstruction receiver = node.inputs[0];
600 if (!receiver.propagatedType.isUseful()) return node; 601 if (!receiver.propagatedType.isUseful()) return node;
601 if (receiver.propagatedType.canBeNull()) return node; 602 if (receiver.propagatedType.canBeNull()) return node;
602 Type type = receiver.propagatedType.computeType(compiler); 603 Type type = receiver.propagatedType.computeType(compiler);
603 if (type === null) return node; 604 if (type === null) return node;
604 Element field = compiler.world.locateSingleField(type, node.name); 605 Element field = compiler.world.locateSingleField(type, node.name);
605 if (field === null) return node; 606 if (field === null) return node;
606 return new HFieldSet(field, node.inputs[0], node.inputs[1]); 607 return new HFieldSet.withElement(field, node.inputs[0], node.inputs[1]);
607 } 608 }
608 609
609 HInstruction visitStringConcat(HStringConcat node) { 610 HInstruction visitStringConcat(HStringConcat node) {
610 DartString folded = const LiteralDartString(""); 611 DartString folded = const LiteralDartString("");
611 for (int i = 0; i < node.inputs.length; i++) { 612 for (int i = 0; i < node.inputs.length; i++) {
612 HInstruction part = node.inputs[i]; 613 HInstruction part = node.inputs[i];
613 if (!part.isConstant()) return node; 614 if (!part.isConstant()) return node;
614 HConstant constant = part; 615 HConstant constant = part;
615 if (!constant.constant.isPrimitive()) return node; 616 if (!constant.constant.isPrimitive()) return node;
616 PrimitiveConstant primitive = constant.constant; 617 PrimitiveConstant primitive = constant.constant;
(...skipping 685 matching lines...) Expand 10 before | Expand all | Expand 10 after
1302 // this type for the field is still a strong signal 1303 // this type for the field is still a strong signal
1303 // indicating the expected type of the field. 1304 // indicating the expected type of the field.
1304 field.propagatedType = type; 1305 field.propagatedType = type;
1305 } else { 1306 } else {
1306 // If there are no invoked setters we know the type of 1307 // If there are no invoked setters we know the type of
1307 // this field for sure. 1308 // this field for sure.
1308 field.guaranteedType = type; 1309 field.guaranteedType = type;
1309 } 1310 }
1310 } 1311 }
1311 } 1312 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/ssa/nodes.dart ('k') | lib/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698