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

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

Issue 12465004: Revert "Revert "Address code review comments on r19350"" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 9 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 | no next file » | 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 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 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 } 595 }
596 596
597 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { 597 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
598 if (node.isCallOnInterceptor) return handleInterceptorCall(node); 598 if (node.isCallOnInterceptor) return handleInterceptorCall(node);
599 599
600 Element field = 600 Element field =
601 findConcreteFieldForDynamicAccess(node.receiver, node.selector); 601 findConcreteFieldForDynamicAccess(node.receiver, node.selector);
602 if (field == null) return node; 602 if (field == null) return node;
603 603
604 Modifiers modifiers = field.modifiers; 604 Modifiers modifiers = field.modifiers;
605 bool isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); 605 bool isAssignable = !(modifiers.isFinal() || modifiers.isConst());
606 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { 606 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) {
607 // If no setter is ever used for this field it is only initialized in the 607 // If no setter is ever used for this field it is only initialized in the
608 // initializer list. 608 // initializer list.
609 isFinalOrConst = true; 609 isAssignable = false;
610 }
611 if (field.isNative()) {
612 // Some native fields are views of data that may be changed by operations.
613 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2).
614 // TODO(sra): Refine the effect classification so that native effects are
615 // distinct from ordinary Dart effects.
616 isAssignable = true;
610 } 617 }
611 HFieldGet result = new HFieldGet( 618 HFieldGet result = new HFieldGet(
612 field, node.inputs[0], isAssignable: !isFinalOrConst); 619 field, node.inputs[0], isAssignable: isAssignable);
613
614 // Some native fields are views of data that may be changed by operations.
615 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2).
616 // TODO(sra): Refine the effect classification so that native effects are
617 // distinct from ordinary Dart effects.
618 if (field.isNative()) {
619 result.setDependsOnSomething();
620 }
621 620
622 if (field.getEnclosingClass().isNative()) { 621 if (field.getEnclosingClass().isNative()) {
623 result.instructionType = 622 result.instructionType =
624 new HType.subtype(field.computeType(compiler), compiler); 623 new HType.subtype(field.computeType(compiler), compiler);
625 } else { 624 } else {
626 HType type = new HType.inferredTypeForElement(field, compiler); 625 HType type = new HType.inferredTypeForElement(field, compiler);
627 if (type.isUnknown()) { 626 if (type.isUnknown()) {
628 type = backend.optimisticFieldType(field); 627 type = backend.optimisticFieldType(field);
629 if (type != null) { 628 if (type != null) {
630 backend.registerFieldTypesOptimization( 629 backend.registerFieldTypesOptimization(
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1543 HBasicBlock block = user.block; 1542 HBasicBlock block = user.block;
1544 block.addAfter(user, interceptor); 1543 block.addAfter(user, interceptor);
1545 block.rewrite(user, interceptor); 1544 block.rewrite(user, interceptor);
1546 block.remove(user); 1545 block.remove(user);
1547 1546
1548 // The interceptor will be removed in the dead code elimination 1547 // The interceptor will be removed in the dead code elimination
1549 // phase. Note that removing it here would not work because of how 1548 // phase. Note that removing it here would not work because of how
1550 // the [visitBasicBlock] is implemented. 1549 // the [visitBasicBlock] is implemented.
1551 } 1550 }
1552 } 1551 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698