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

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

Issue 266913017: Convert property methods into getters. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased Created 6 years, 7 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 HVisitor<R> { 7 abstract class HVisitor<R> {
8 R visitAdd(HAdd node); 8 R visitAdd(HAdd node);
9 R visitBitAnd(HBitAnd node); 9 R visitBitAnd(HBitAnd node);
10 R visitBitNot(HBitNot node); 10 R visitBitNot(HBitNot node);
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 // because we don't need to check the arity (already checked in 1385 // because we don't need to check the arity (already checked in
1386 // [gvnEquals]), and the receiver types may not be in sync. 1386 // [gvnEquals]), and the receiver types may not be in sync.
1387 return selector.name == other.selector.name 1387 return selector.name == other.selector.name
1388 && selector.kind == other.selector.kind; 1388 && selector.kind == other.selector.kind;
1389 } 1389 }
1390 } 1390 }
1391 1391
1392 class HInvokeClosure extends HInvokeDynamic { 1392 class HInvokeClosure extends HInvokeDynamic {
1393 HInvokeClosure(Selector selector, List<HInstruction> inputs, TypeMask type) 1393 HInvokeClosure(Selector selector, List<HInstruction> inputs, TypeMask type)
1394 : super(selector, null, inputs, type) { 1394 : super(selector, null, inputs, type) {
1395 assert(selector.isClosureCall()); 1395 assert(selector.isClosureCall);
1396 } 1396 }
1397 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); 1397 accept(HVisitor visitor) => visitor.visitInvokeClosure(this);
1398 } 1398 }
1399 1399
1400 class HInvokeDynamicMethod extends HInvokeDynamic { 1400 class HInvokeDynamicMethod extends HInvokeDynamic {
1401 HInvokeDynamicMethod(Selector selector, 1401 HInvokeDynamicMethod(Selector selector,
1402 List<HInstruction> inputs, 1402 List<HInstruction> inputs,
1403 TypeMask type, 1403 TypeMask type,
1404 [bool isIntercepted = false]) 1404 [bool isIntercepted = false])
1405 : super(selector, null, inputs, type, isIntercepted); 1405 : super(selector, null, inputs, type, isIntercepted);
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
1498 1498
1499 class HFieldGet extends HFieldAccess { 1499 class HFieldGet extends HFieldAccess {
1500 final bool isAssignable; 1500 final bool isAssignable;
1501 1501
1502 HFieldGet(Element element, 1502 HFieldGet(Element element,
1503 HInstruction receiver, 1503 HInstruction receiver,
1504 TypeMask type, 1504 TypeMask type,
1505 {bool isAssignable}) 1505 {bool isAssignable})
1506 : this.isAssignable = (isAssignable != null) 1506 : this.isAssignable = (isAssignable != null)
1507 ? isAssignable 1507 ? isAssignable
1508 : element.isAssignable(), 1508 : element.isAssignable,
1509 super(element, <HInstruction>[receiver], type) { 1509 super(element, <HInstruction>[receiver], type) {
1510 sideEffects.clearAllSideEffects(); 1510 sideEffects.clearAllSideEffects();
1511 sideEffects.clearAllDependencies(); 1511 sideEffects.clearAllDependencies();
1512 setUseGvn(); 1512 setUseGvn();
1513 if (this.isAssignable) { 1513 if (this.isAssignable) {
1514 sideEffects.setDependsOnInstancePropertyStore(); 1514 sideEffects.setDependsOnInstancePropertyStore();
1515 } 1515 }
1516 } 1516 }
1517 1517
1518 bool isInterceptor(Compiler compiler) { 1518 bool isInterceptor(Compiler compiler) {
1519 if (sourceElement == null) return false; 1519 if (sourceElement == null) return false;
1520 // In case of a closure inside an interceptor class, [:this:] is 1520 // In case of a closure inside an interceptor class, [:this:] is
1521 // stored in the generated closure class, and accessed through a 1521 // stored in the generated closure class, and accessed through a
1522 // [HFieldGet]. 1522 // [HFieldGet].
1523 JavaScriptBackend backend = compiler.backend; 1523 JavaScriptBackend backend = compiler.backend;
1524 bool interceptor = 1524 bool interceptor =
1525 backend.isInterceptorClass(sourceElement.getEnclosingClass()); 1525 backend.isInterceptorClass(sourceElement.enclosingClass);
1526 return interceptor && sourceElement is ThisElement; 1526 return interceptor && sourceElement is ThisElement;
1527 } 1527 }
1528 1528
1529 bool canThrow() => receiver.canBeNull(); 1529 bool canThrow() => receiver.canBeNull();
1530 1530
1531 HInstruction getDartReceiver(Compiler compiler) => receiver; 1531 HInstruction getDartReceiver(Compiler compiler) => receiver;
1532 bool onlyThrowsNSM() => true; 1532 bool onlyThrowsNSM() => true;
1533 bool get isNullCheck => element == null; 1533 bool get isNullCheck => element == null;
1534 1534
1535 accept(HVisitor visitor) => visitor.visitFieldGet(this); 1535 accept(HVisitor visitor) => visitor.visitFieldGet(this);
(...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after
2048 accept(HVisitor visitor) => visitor.visitParameterValue(this); 2048 accept(HVisitor visitor) => visitor.visitParameterValue(this);
2049 } 2049 }
2050 2050
2051 class HThis extends HParameterValue { 2051 class HThis extends HParameterValue {
2052 HThis(Element element, TypeMask type) : super(element, type); 2052 HThis(Element element, TypeMask type) : super(element, type);
2053 toString() => 'this'; 2053 toString() => 'this';
2054 accept(HVisitor visitor) => visitor.visitThis(this); 2054 accept(HVisitor visitor) => visitor.visitThis(this);
2055 bool isCodeMotionInvariant() => true; 2055 bool isCodeMotionInvariant() => true;
2056 bool isInterceptor(Compiler compiler) { 2056 bool isInterceptor(Compiler compiler) {
2057 JavaScriptBackend backend = compiler.backend; 2057 JavaScriptBackend backend = compiler.backend;
2058 return backend.isInterceptorClass(sourceElement.getEnclosingClass()); 2058 return backend.isInterceptorClass(sourceElement.enclosingClass);
2059 } 2059 }
2060 } 2060 }
2061 2061
2062 class HPhi extends HInstruction { 2062 class HPhi extends HInstruction {
2063 static const IS_NOT_LOGICAL_OPERATOR = 0; 2063 static const IS_NOT_LOGICAL_OPERATOR = 0;
2064 static const IS_AND = 1; 2064 static const IS_AND = 1;
2065 static const IS_OR = 2; 2065 static const IS_OR = 2;
2066 2066
2067 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR; 2067 int logicalOperatorType = IS_NOT_LOGICAL_OPERATOR;
2068 2068
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
2176 accept(HVisitor visitor) => visitor.visitThrow(this); 2176 accept(HVisitor visitor) => visitor.visitThrow(this);
2177 } 2177 }
2178 2178
2179 class HStatic extends HInstruction { 2179 class HStatic extends HInstruction {
2180 final Element element; 2180 final Element element;
2181 HStatic(this.element, type) : super(<HInstruction>[], type) { 2181 HStatic(this.element, type) : super(<HInstruction>[], type) {
2182 assert(element != null); 2182 assert(element != null);
2183 assert(invariant(this, element.isDeclaration)); 2183 assert(invariant(this, element.isDeclaration));
2184 sideEffects.clearAllSideEffects(); 2184 sideEffects.clearAllSideEffects();
2185 sideEffects.clearAllDependencies(); 2185 sideEffects.clearAllDependencies();
2186 if (element.isAssignable()) { 2186 if (element.isAssignable) {
2187 sideEffects.setDependsOnStaticPropertyStore(); 2187 sideEffects.setDependsOnStaticPropertyStore();
2188 } 2188 }
2189 setUseGvn(); 2189 setUseGvn();
2190 } 2190 }
2191 toString() => 'static ${element.name}'; 2191 toString() => 'static ${element.name}';
2192 accept(HVisitor visitor) => visitor.visitStatic(this); 2192 accept(HVisitor visitor) => visitor.visitStatic(this);
2193 2193
2194 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode; 2194 int gvnHashCode() => super.gvnHashCode() ^ element.hashCode;
2195 int typeCode() => HInstruction.STATIC_TYPECODE; 2195 int typeCode() => HInstruction.STATIC_TYPECODE;
2196 bool typeEquals(other) => other is HStatic; 2196 bool typeEquals(other) => other is HStatic;
2197 bool dataEquals(HStatic other) => element == other.element; 2197 bool dataEquals(HStatic other) => element == other.element;
2198 bool isCodeMotionInvariant() => !element.isAssignable(); 2198 bool isCodeMotionInvariant() => !element.isAssignable;
2199 } 2199 }
2200 2200
2201 class HInterceptor extends HInstruction { 2201 class HInterceptor extends HInstruction {
2202 // This field should originally be null to allow GVN'ing all 2202 // This field should originally be null to allow GVN'ing all
2203 // [HInterceptor] on the same input. 2203 // [HInterceptor] on the same input.
2204 Set<ClassElement> interceptedClasses; 2204 Set<ClassElement> interceptedClasses;
2205 HInterceptor(HInstruction receiver, TypeMask type) 2205 HInterceptor(HInstruction receiver, TypeMask type)
2206 : super(<HInstruction>[receiver], type) { 2206 : super(<HInstruction>[receiver], type) {
2207 sideEffects.clearAllSideEffects(); 2207 sideEffects.clearAllSideEffects();
2208 sideEffects.clearAllDependencies(); 2208 sideEffects.clearAllDependencies();
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
3026 class HDynamicType extends HRuntimeType { 3026 class HDynamicType extends HRuntimeType {
3027 HDynamicType(DynamicType dartType, TypeMask instructionType) 3027 HDynamicType(DynamicType dartType, TypeMask instructionType)
3028 : super(const <HInstruction>[], dartType, instructionType); 3028 : super(const <HInstruction>[], dartType, instructionType);
3029 3029
3030 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3030 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3031 3031
3032 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3032 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3033 3033
3034 bool typeEquals(HInstruction other) => other is HDynamicType; 3034 bool typeEquals(HInstruction other) => other is HDynamicType;
3035 } 3035 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698