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

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

Issue 12381080: 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 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 } 591 }
592 592
593 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) { 593 HInstruction visitInvokeDynamicGetter(HInvokeDynamicGetter node) {
594 if (node.isCallOnInterceptor) return handleInterceptorCall(node); 594 if (node.isCallOnInterceptor) return handleInterceptorCall(node);
595 595
596 Element field = 596 Element field =
597 findConcreteFieldForDynamicAccess(node.receiver, node.selector); 597 findConcreteFieldForDynamicAccess(node.receiver, node.selector);
598 if (field == null) return node; 598 if (field == null) return node;
599 599
600 Modifiers modifiers = field.modifiers; 600 Modifiers modifiers = field.modifiers;
601 bool isFinalOrConst = modifiers.isFinal() || modifiers.isConst(); 601 bool isAssignable = !(modifiers.isFinal() || modifiers.isConst());
602 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) { 602 if (!compiler.resolverWorld.hasInvokedSetter(field, compiler)) {
603 // If no setter is ever used for this field it is only initialized in the 603 // If no setter is ever used for this field it is only initialized in the
604 // initializer list. 604 // initializer list.
605 isFinalOrConst = true; 605 isAssignable = false;
606 }
607 if (field.isNative()) {
608 // Some native fields are views of data that may be changed by operations.
609 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2).
610 // TODO(sra): Refine the effect classification so that native effects are
611 // distinct from ordinary Dart effects.
612 isAssignable = true;
606 } 613 }
607 HFieldGet result = new HFieldGet( 614 HFieldGet result = new HFieldGet(
608 field, node.inputs[0], isAssignable: !isFinalOrConst); 615 field, node.inputs[0], isAssignable: isAssignable);
609
610 // Some native fields are views of data that may be changed by operations.
611 // E.g. node.firstChild depends on parentNode.removeBefore(n1, n2).
612 // TODO(sra): Refine the effect classification so that native effects are
613 // distinct from ordinary Dart effects.
614 if (field.isNative()) {
615 result.setDependsOnSomething();
616 }
617 616
618 if (field.getEnclosingClass().isNative()) { 617 if (field.getEnclosingClass().isNative()) {
619 result.instructionType = 618 result.instructionType =
620 new HType.subtype(field.computeType(compiler), compiler); 619 new HType.subtype(field.computeType(compiler), compiler);
621 } else { 620 } else {
622 HType type = new HType.inferredForElement(field, compiler); 621 HType type = new HType.inferredForElement(field, compiler);
623 if (type.isUnknown()) { 622 if (type.isUnknown()) {
624 type = backend.optimisticFieldType(field); 623 type = backend.optimisticFieldType(field);
625 if (type != null) { 624 if (type != null) {
626 backend.registerFieldTypesOptimization( 625 backend.registerFieldTypesOptimization(
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1539 HBasicBlock block = user.block; 1538 HBasicBlock block = user.block;
1540 block.addAfter(user, interceptor); 1539 block.addAfter(user, interceptor);
1541 block.rewrite(user, interceptor); 1540 block.rewrite(user, interceptor);
1542 block.remove(user); 1541 block.remove(user);
1543 1542
1544 // The interceptor will be removed in the dead code elimination 1543 // The interceptor will be removed in the dead code elimination
1545 // phase. Note that removing it here would not work because of how 1544 // phase. Note that removing it here would not work because of how
1546 // the [visitBasicBlock] is implemented. 1545 // the [visitBasicBlock] is implemented.
1547 } 1546 }
1548 } 1547 }
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