OLD | NEW |
---|---|
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 visitBailoutTarget(HBailoutTarget node); | 9 R visitBailoutTarget(HBailoutTarget node); |
10 R visitBitAnd(HBitAnd node); | 10 R visitBitAnd(HBitAnd node); |
(...skipping 771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
782 static const int GREATER_TYPECODE = 21; | 782 static const int GREATER_TYPECODE = 21; |
783 static const int GREATER_EQUAL_TYPECODE = 22; | 783 static const int GREATER_EQUAL_TYPECODE = 22; |
784 static const int LESS_TYPECODE = 23; | 784 static const int LESS_TYPECODE = 23; |
785 static const int LESS_EQUAL_TYPECODE = 24; | 785 static const int LESS_EQUAL_TYPECODE = 24; |
786 static const int STATIC_TYPECODE = 25; | 786 static const int STATIC_TYPECODE = 25; |
787 static const int STATIC_STORE_TYPECODE = 26; | 787 static const int STATIC_STORE_TYPECODE = 26; |
788 static const int FIELD_GET_TYPECODE = 27; | 788 static const int FIELD_GET_TYPECODE = 27; |
789 static const int TYPE_CONVERSION_TYPECODE = 28; | 789 static const int TYPE_CONVERSION_TYPECODE = 28; |
790 static const int BAILOUT_TARGET_TYPECODE = 29; | 790 static const int BAILOUT_TARGET_TYPECODE = 29; |
791 static const int INVOKE_STATIC_TYPECODE = 30; | 791 static const int INVOKE_STATIC_TYPECODE = 30; |
792 static const int INVOKE_DYNAMIC_GETTER_TYPECODE = 31; | |
kasperl
2013/01/23 12:38:04
No more use of 31?
ngeoffray
2013/01/23 12:42:23
No, as well as others. I have updated the constant
| |
793 static const int INDEX_TYPECODE = 32; | 792 static const int INDEX_TYPECODE = 32; |
793 static const int IS_TYPECODE = 33; | |
794 static const int INVOKE_DYNAMIC_TYPECODE = 34; | |
794 | 795 |
795 HInstruction(this.inputs) : id = idCounter++, usedBy = <HInstruction>[]; | 796 HInstruction(this.inputs) : id = idCounter++, usedBy = <HInstruction>[]; |
796 | 797 |
797 int get hashCode => id; | 798 int get hashCode => id; |
798 | 799 |
799 bool getFlag(int position) => (flags & (1 << position)) != 0; | 800 bool getFlag(int position) => (flags & (1 << position)) != 0; |
800 void setFlag(int position) { flags |= (1 << position); } | 801 void setFlag(int position) { flags |= (1 << position); } |
801 void clearFlag(int position) { flags &= ~(1 << position); } | 802 void clearFlag(int position) { flags &= ~(1 << position); } |
802 | 803 |
803 static int computeDependsOnFlags(int flags) => flags << FLAG_CHANGES_COUNT; | 804 static int computeDependsOnFlags(int flags) => flags << FLAG_CHANGES_COUNT; |
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1320 : super(inputs); | 1321 : super(inputs); |
1321 toString() => 'invoke dynamic: $selector'; | 1322 toString() => 'invoke dynamic: $selector'; |
1322 HInstruction get receiver => inputs[0]; | 1323 HInstruction get receiver => inputs[0]; |
1323 | 1324 |
1324 bool get isInterceptorCall { | 1325 bool get isInterceptorCall { |
1325 // We know it's a selector call if it follows the interceptor | 1326 // We know it's a selector call if it follows the interceptor |
1326 // calling convention, which adds the actual receiver as a | 1327 // calling convention, which adds the actual receiver as a |
1327 // parameter to the call. | 1328 // parameter to the call. |
1328 return inputs.length - 2 == selector.argumentCount; | 1329 return inputs.length - 2 == selector.argumentCount; |
1329 } | 1330 } |
1331 | |
1332 int typeCode() => HInstruction.INVOKE_DYNAMIC_TYPECODE; | |
1333 bool typeEquals(other) => other is HInvokeDynamic; | |
1334 bool dataEquals(HInvokeDynamic other) { | |
1335 return selector == other.selector | |
1336 && element == other.element; | |
1337 } | |
1330 } | 1338 } |
1331 | 1339 |
1332 class HInvokeClosure extends HInvokeDynamic { | 1340 class HInvokeClosure extends HInvokeDynamic { |
1333 HInvokeClosure(Selector selector, List<HInstruction> inputs) | 1341 HInvokeClosure(Selector selector, List<HInstruction> inputs) |
1334 : super(selector, null, inputs) { | 1342 : super(selector, null, inputs) { |
1335 assert(selector.isClosureCall()); | 1343 assert(selector.isClosureCall()); |
1336 } | 1344 } |
1337 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); | 1345 accept(HVisitor visitor) => visitor.visitInvokeClosure(this); |
1338 } | 1346 } |
1339 | 1347 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1383 if (isSideEffectFree) { | 1391 if (isSideEffectFree) { |
1384 setUseGvn(); | 1392 setUseGvn(); |
1385 setDependsOnInstancePropertyStore(); | 1393 setDependsOnInstancePropertyStore(); |
1386 } else { | 1394 } else { |
1387 setDependsOnSomething(); | 1395 setDependsOnSomething(); |
1388 setAllSideEffects(); | 1396 setAllSideEffects(); |
1389 } | 1397 } |
1390 } | 1398 } |
1391 toString() => 'invoke dynamic getter: $selector'; | 1399 toString() => 'invoke dynamic getter: $selector'; |
1392 accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this); | 1400 accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this); |
1393 | |
1394 int typeCode() => HInstruction.INVOKE_DYNAMIC_GETTER_TYPECODE; | |
1395 bool typeEquals(other) => other is HInvokeDynamicGetter; | |
1396 bool dataEquals(HInvokeDynamicGetter other) => selector == other.selector; | |
1397 } | 1401 } |
1398 | 1402 |
1399 class HInvokeDynamicSetter extends HInvokeDynamicField { | 1403 class HInvokeDynamicSetter extends HInvokeDynamicField { |
1400 HInvokeDynamicSetter(selector, element, receiver, value, isSideEffectFree) | 1404 HInvokeDynamicSetter(selector, element, receiver, value, isSideEffectFree) |
1401 : super(selector, element, [receiver, value], isSideEffectFree) { | 1405 : super(selector, element, [receiver, value], isSideEffectFree) { |
1402 clearAllSideEffects(); | 1406 clearAllSideEffects(); |
1403 if (isSideEffectFree) { | 1407 if (isSideEffectFree) { |
1404 setChangesInstanceProperty(); | 1408 setChangesInstanceProperty(); |
1405 } else { | 1409 } else { |
1406 setAllSideEffects(); | 1410 setAllSideEffects(); |
(...skipping 823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2230 HInstruction getCheck(int index) => inputs[index + 1]; | 2234 HInstruction getCheck(int index) => inputs[index + 1]; |
2231 int get checkCount => inputs.length - 1; | 2235 int get checkCount => inputs.length - 1; |
2232 | 2236 |
2233 bool hasArgumentChecks() => inputs.length > 1; | 2237 bool hasArgumentChecks() => inputs.length > 1; |
2234 | 2238 |
2235 HType get guaranteedType => HType.BOOLEAN; | 2239 HType get guaranteedType => HType.BOOLEAN; |
2236 | 2240 |
2237 accept(HVisitor visitor) => visitor.visitIs(this); | 2241 accept(HVisitor visitor) => visitor.visitIs(this); |
2238 | 2242 |
2239 toString() => "$expression is $typeExpression"; | 2243 toString() => "$expression is $typeExpression"; |
2244 | |
2245 int typeCode() => HInstruction.IS_TYPECODE; | |
2246 bool typeEquals(HInstruction other) => other is HIs; | |
2247 bool dataEquals(HIs other) { | |
2248 return typeExpression == other.typeExpression | |
2249 && nullOk == other.nullOk; | |
2250 } | |
2240 } | 2251 } |
2241 | 2252 |
2242 class HTypeConversion extends HCheck { | 2253 class HTypeConversion extends HCheck { |
2243 HType type; | 2254 HType type; |
2244 final int kind; | 2255 final int kind; |
2245 | 2256 |
2246 static const int NO_CHECK = 0; | 2257 static const int NO_CHECK = 0; |
2247 static const int CHECKED_MODE_CHECK = 1; | 2258 static const int CHECKED_MODE_CHECK = 1; |
2248 static const int ARGUMENT_TYPE_CHECK = 2; | 2259 static const int ARGUMENT_TYPE_CHECK = 2; |
2249 static const int CAST_TYPE_CHECK = 3; | 2260 static const int CAST_TYPE_CHECK = 3; |
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2635 HBasicBlock get start => expression.start; | 2646 HBasicBlock get start => expression.start; |
2636 HBasicBlock get end { | 2647 HBasicBlock get end { |
2637 // We don't create a switch block if there are no cases. | 2648 // We don't create a switch block if there are no cases. |
2638 assert(!statements.isEmpty); | 2649 assert(!statements.isEmpty); |
2639 return statements.last.end; | 2650 return statements.last.end; |
2640 } | 2651 } |
2641 | 2652 |
2642 bool accept(HStatementInformationVisitor visitor) => | 2653 bool accept(HStatementInformationVisitor visitor) => |
2643 visitor.visitSwitchInfo(this); | 2654 visitor.visitSwitchInfo(this); |
2644 } | 2655 } |
OLD | NEW |