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

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

Issue 12413005: 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 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 isAssignable = !(modifiers.isFinal() || modifiers.isConst()); 601 bool isFinalOrConst = 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 isAssignable = false; 605 isFinalOrConst = true;
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;
613 } 606 }
614 HFieldGet result = new HFieldGet( 607 HFieldGet result = new HFieldGet(
615 field, node.inputs[0], isAssignable: isAssignable); 608 field, node.inputs[0], isAssignable: !isFinalOrConst);
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 }
616 617
617 if (field.getEnclosingClass().isNative()) { 618 if (field.getEnclosingClass().isNative()) {
618 result.instructionType = 619 result.instructionType =
619 new HType.subtype(field.computeType(compiler), compiler); 620 new HType.subtype(field.computeType(compiler), compiler);
620 } else { 621 } else {
621 HType type = new HType.inferredForElement(field, compiler); 622 HType type = new HType.inferredForElement(field, compiler);
622 if (type.isUnknown()) { 623 if (type.isUnknown()) {
623 type = backend.optimisticFieldType(field); 624 type = backend.optimisticFieldType(field);
624 if (type != null) { 625 if (type != null) {
625 backend.registerFieldTypesOptimization( 626 backend.registerFieldTypesOptimization(
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
1538 HBasicBlock block = user.block; 1539 HBasicBlock block = user.block;
1539 block.addAfter(user, interceptor); 1540 block.addAfter(user, interceptor);
1540 block.rewrite(user, interceptor); 1541 block.rewrite(user, interceptor);
1541 block.remove(user); 1542 block.remove(user);
1542 1543
1543 // The interceptor will be removed in the dead code elimination 1544 // The interceptor will be removed in the dead code elimination
1544 // phase. Note that removing it here would not work because of how 1545 // phase. Note that removing it here would not work because of how
1545 // the [visitBasicBlock] is implemented. 1546 // the [visitBasicBlock] is implemented.
1546 } 1547 }
1547 } 1548 }
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