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

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

Issue 12327010: Infer types of final fields. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 10 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) 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 part of ssa; 5 part of ssa;
6 6
7 abstract class OptimizationPhase { 7 abstract class OptimizationPhase {
8 String get name; 8 String get name;
9 void visitGraph(HGraph graph); 9 void visitGraph(HGraph graph);
10 } 10 }
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
613 // initializer list. 613 // initializer list.
614 isFinalOrConst = true; 614 isFinalOrConst = true;
615 } 615 }
616 HFieldGet result = new HFieldGet( 616 HFieldGet result = new HFieldGet(
617 field, node.inputs[0], isAssignable: !isFinalOrConst); 617 field, node.inputs[0], isAssignable: !isFinalOrConst);
618 618
619 if (field.getEnclosingClass().isNative()) { 619 if (field.getEnclosingClass().isNative()) {
620 result.instructionType = 620 result.instructionType =
621 new HType.subtype(field.computeType(compiler), compiler); 621 new HType.subtype(field.computeType(compiler), compiler);
622 } else { 622 } else {
623 HType type = backend.optimisticFieldType(field); 623 HType type = new HType.inferredForElement(field, compiler);
624 if (type.isUnknown()) {
625 type = backend.optimisticFieldType(field);
626 if (type != null) {
627 backend.registerFieldTypesOptimization(
628 work.element, field, result.instructionType);
629 }
630 }
624 if (type != null) { 631 if (type != null) {
625 backend.registerFieldTypesOptimization(
626 work.element, field, result.instructionType);
627 result.instructionType = type; 632 result.instructionType = type;
628 } 633 }
629 } 634 }
630 return result; 635 return result;
631 } 636 }
632 637
633 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) { 638 HInstruction visitInvokeDynamicSetter(HInvokeDynamicSetter node) {
634 if (node.isInterceptorCall) return handleInterceptorCall(node); 639 if (node.isInterceptorCall) return handleInterceptorCall(node);
635 640
636 Element field = 641 Element field =
(...skipping 884 matching lines...) Expand 10 before | Expand all | Expand 10 after
1521 HBasicBlock block = user.block; 1526 HBasicBlock block = user.block;
1522 block.addAfter(user, interceptor); 1527 block.addAfter(user, interceptor);
1523 block.rewrite(user, interceptor); 1528 block.rewrite(user, interceptor);
1524 block.remove(user); 1529 block.remove(user);
1525 1530
1526 // The interceptor will be removed in the dead code elimination 1531 // The interceptor will be removed in the dead code elimination
1527 // phase. Note that removing it here would not work because of how 1532 // phase. Note that removing it here would not work because of how
1528 // the [visitBasicBlock] is implemented. 1533 // the [visitBasicBlock] is implemented.
1529 } 1534 }
1530 } 1535 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/builder.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/types.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698