Chromium Code Reviews| 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 import '../closure.dart'; | 5 import '../closure.dart'; |
| 6 import '../common.dart'; | 6 import '../common.dart'; |
| 7 import '../common/backend_api.dart' show BackendClasses; | 7 import '../common/backend_api.dart' show BackendClasses; |
| 8 import '../compiler.dart' show Compiler; | 8 import '../compiler.dart' show Compiler; |
| 9 import '../constants/constant_system.dart'; | 9 import '../constants/constant_system.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 R visitSubtract(HSubtract node); | 90 R visitSubtract(HSubtract node); |
| 91 R visitSwitch(HSwitch node); | 91 R visitSwitch(HSwitch node); |
| 92 R visitThis(HThis node); | 92 R visitThis(HThis node); |
| 93 R visitThrow(HThrow node); | 93 R visitThrow(HThrow node); |
| 94 R visitThrowExpression(HThrowExpression node); | 94 R visitThrowExpression(HThrowExpression node); |
| 95 R visitTruncatingDivide(HTruncatingDivide node); | 95 R visitTruncatingDivide(HTruncatingDivide node); |
| 96 R visitTry(HTry node); | 96 R visitTry(HTry node); |
| 97 R visitTypeConversion(HTypeConversion node); | 97 R visitTypeConversion(HTypeConversion node); |
| 98 R visitTypeKnown(HTypeKnown node); | 98 R visitTypeKnown(HTypeKnown node); |
| 99 R visitYield(HYield node); | 99 R visitYield(HYield node); |
| 100 R visitReadTypeVariable(HReadTypeVariable node); | |
| 101 R visitFunctionType(HFunctionType node); | |
| 102 R visitVoidType(HVoidType node); | |
| 103 R visitInterfaceType(HInterfaceType node); | |
| 104 R visitDynamicType(HDynamicType node); | |
| 105 | 100 |
| 106 R visitTypeInfoReadRaw(HTypeInfoReadRaw node); | 101 R visitTypeInfoReadRaw(HTypeInfoReadRaw node); |
| 107 R visitTypeInfoReadVariable(HTypeInfoReadVariable node); | 102 R visitTypeInfoReadVariable(HTypeInfoReadVariable node); |
| 108 R visitTypeInfoExpression(HTypeInfoExpression node); | 103 R visitTypeInfoExpression(HTypeInfoExpression node); |
| 109 } | 104 } |
| 110 | 105 |
| 111 abstract class HGraphVisitor { | 106 abstract class HGraphVisitor { |
| 112 visitDominatorTree(HGraph graph) { | 107 visitDominatorTree(HGraph graph) { |
| 113 void visitBasicBlockAndSuccessors(HBasicBlock block) { | 108 void visitBasicBlockAndSuccessors(HBasicBlock block) { |
| 114 visitBasicBlock(block); | 109 visitBasicBlock(block); |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 409 visitStringify(HStringify node) => visitInstruction(node); | 404 visitStringify(HStringify node) => visitInstruction(node); |
| 410 visitThis(HThis node) => visitParameterValue(node); | 405 visitThis(HThis node) => visitParameterValue(node); |
| 411 visitThrow(HThrow node) => visitControlFlow(node); | 406 visitThrow(HThrow node) => visitControlFlow(node); |
| 412 visitThrowExpression(HThrowExpression node) => visitInstruction(node); | 407 visitThrowExpression(HThrowExpression node) => visitInstruction(node); |
| 413 visitTruncatingDivide(HTruncatingDivide node) => visitBinaryArithmetic(node); | 408 visitTruncatingDivide(HTruncatingDivide node) => visitBinaryArithmetic(node); |
| 414 visitTry(HTry node) => visitControlFlow(node); | 409 visitTry(HTry node) => visitControlFlow(node); |
| 415 visitIs(HIs node) => visitInstruction(node); | 410 visitIs(HIs node) => visitInstruction(node); |
| 416 visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node); | 411 visitIsViaInterceptor(HIsViaInterceptor node) => visitInstruction(node); |
| 417 visitTypeConversion(HTypeConversion node) => visitCheck(node); | 412 visitTypeConversion(HTypeConversion node) => visitCheck(node); |
| 418 visitTypeKnown(HTypeKnown node) => visitCheck(node); | 413 visitTypeKnown(HTypeKnown node) => visitCheck(node); |
| 419 visitReadTypeVariable(HReadTypeVariable node) => visitInstruction(node); | |
| 420 visitFunctionType(HFunctionType node) => visitInstruction(node); | |
| 421 visitVoidType(HVoidType node) => visitInstruction(node); | |
| 422 visitInterfaceType(HInterfaceType node) => visitInstruction(node); | |
| 423 visitDynamicType(HDynamicType node) => visitInstruction(node); | |
| 424 visitAwait(HAwait node) => visitInstruction(node); | 414 visitAwait(HAwait node) => visitInstruction(node); |
| 425 visitYield(HYield node) => visitInstruction(node); | 415 visitYield(HYield node) => visitInstruction(node); |
| 426 | 416 |
| 427 visitTypeInfoReadRaw(HTypeInfoReadRaw node) => visitInstruction(node); | 417 visitTypeInfoReadRaw(HTypeInfoReadRaw node) => visitInstruction(node); |
| 428 visitTypeInfoReadVariable(HTypeInfoReadVariable node) => | 418 visitTypeInfoReadVariable(HTypeInfoReadVariable node) => |
| 429 visitInstruction(node); | 419 visitInstruction(node); |
| 430 visitTypeInfoExpression(HTypeInfoExpression node) => visitInstruction(node); | 420 visitTypeInfoExpression(HTypeInfoExpression node) => visitInstruction(node); |
| 431 } | 421 } |
| 432 | 422 |
| 433 class SubGraph { | 423 class SubGraph { |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 873 static const int STATIC_TYPECODE = 21; | 863 static const int STATIC_TYPECODE = 21; |
| 874 static const int STATIC_STORE_TYPECODE = 22; | 864 static const int STATIC_STORE_TYPECODE = 22; |
| 875 static const int FIELD_GET_TYPECODE = 23; | 865 static const int FIELD_GET_TYPECODE = 23; |
| 876 static const int TYPE_CONVERSION_TYPECODE = 24; | 866 static const int TYPE_CONVERSION_TYPECODE = 24; |
| 877 static const int TYPE_KNOWN_TYPECODE = 25; | 867 static const int TYPE_KNOWN_TYPECODE = 25; |
| 878 static const int INVOKE_STATIC_TYPECODE = 26; | 868 static const int INVOKE_STATIC_TYPECODE = 26; |
| 879 static const int INDEX_TYPECODE = 27; | 869 static const int INDEX_TYPECODE = 27; |
| 880 static const int IS_TYPECODE = 28; | 870 static const int IS_TYPECODE = 28; |
| 881 static const int INVOKE_DYNAMIC_TYPECODE = 29; | 871 static const int INVOKE_DYNAMIC_TYPECODE = 29; |
| 882 static const int SHIFT_RIGHT_TYPECODE = 30; | 872 static const int SHIFT_RIGHT_TYPECODE = 30; |
| 883 static const int READ_TYPE_VARIABLE_TYPECODE = 31; | 873 |
| 884 static const int FUNCTION_TYPE_TYPECODE = 32; | |
| 885 static const int VOID_TYPE_TYPECODE = 33; | |
| 886 static const int INTERFACE_TYPE_TYPECODE = 34; | |
| 887 static const int DYNAMIC_TYPE_TYPECODE = 35; | |
| 888 static const int TRUNCATING_DIVIDE_TYPECODE = 36; | 874 static const int TRUNCATING_DIVIDE_TYPECODE = 36; |
| 889 static const int IS_VIA_INTERCEPTOR_TYPECODE = 37; | 875 static const int IS_VIA_INTERCEPTOR_TYPECODE = 37; |
| 890 | 876 |
| 891 static const int TYPE_INFO_READ_RAW_TYPECODE = 38; | 877 static const int TYPE_INFO_READ_RAW_TYPECODE = 38; |
| 892 static const int TYPE_INFO_READ_VARIABLE_TYPECODE = 39; | 878 static const int TYPE_INFO_READ_VARIABLE_TYPECODE = 39; |
| 893 static const int TYPE_INFO_EXPRESSION_TYPECODE = 40; | 879 static const int TYPE_INFO_EXPRESSION_TYPECODE = 40; |
| 894 | 880 |
| 895 static const int FOREIGN_CODE_TYPECODE = 41; | 881 static const int FOREIGN_CODE_TYPECODE = 41; |
| 896 static const int REMAINDER_TYPECODE = 42; | 882 static const int REMAINDER_TYPECODE = 42; |
| 897 static const int GET_LENGTH_TYPECODE = 43; | 883 static const int GET_LENGTH_TYPECODE = 43; |
| (...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2870 assert(kind == CHECKED_MODE_CHECK || kind == CAST_TYPE_CHECK); | 2856 assert(kind == CHECKED_MODE_CHECK || kind == CAST_TYPE_CHECK); |
| 2871 sourceElement = input.sourceElement; | 2857 sourceElement = input.sourceElement; |
| 2872 } | 2858 } |
| 2873 | 2859 |
| 2874 bool get hasTypeRepresentation { | 2860 bool get hasTypeRepresentation { |
| 2875 return typeExpression.isInterfaceType && inputs.length > 1; | 2861 return typeExpression.isInterfaceType && inputs.length > 1; |
| 2876 } | 2862 } |
| 2877 | 2863 |
| 2878 HInstruction get typeRepresentation => inputs[1]; | 2864 HInstruction get typeRepresentation => inputs[1]; |
| 2879 | 2865 |
| 2880 bool get usesMethodOnType => | 2866 //bool get usesMethodOnType => |
|
Emily Fortuna
2017/02/25 00:26:02
is this intended to be commented out? along with t
sra1
2017/02/28 05:16:03
We no longer use this form, I'll remove it complet
| |
| 2881 typeExpression != null && typeExpression.isFunctionType; | 2867 // typeExpression != null && typeExpression.isFunctionType; |
| 2868 | |
| 2869 bool get usesMethodOnType => false; | |
| 2882 | 2870 |
| 2883 HInstruction get checkedInput => | 2871 HInstruction get checkedInput => |
| 2884 usesMethodOnType ? inputs[1] : super.checkedInput; | 2872 usesMethodOnType ? inputs[1] : super.checkedInput; |
| 2885 | 2873 |
| 2886 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { | 2874 HInstruction convertType(ClosedWorld closedWorld, DartType type, int kind) { |
| 2887 if (typeExpression == type) { | 2875 if (typeExpression == type) { |
| 2888 // Don't omit a boolean conversion (which doesn't allow `null`) unless | 2876 // Don't omit a boolean conversion (which doesn't allow `null`) unless |
| 2889 // this type conversion is already a boolean conversion. | 2877 // this type conversion is already a boolean conversion. |
| 2890 if (kind != BOOLEAN_CONVERSION_CHECK || isBooleanConversionCheck) { | 2878 if (kind != BOOLEAN_CONVERSION_CHECK || isBooleanConversionCheck) { |
| 2891 return this; | 2879 return this; |
| (...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3398 | 3386 |
| 3399 String get kindAsString { | 3387 String get kindAsString { |
| 3400 switch (kind) { | 3388 switch (kind) { |
| 3401 case TypeInfoExpressionKind.COMPLETE: | 3389 case TypeInfoExpressionKind.COMPLETE: |
| 3402 return 'COMPLETE'; | 3390 return 'COMPLETE'; |
| 3403 case TypeInfoExpressionKind.INSTANCE: | 3391 case TypeInfoExpressionKind.INSTANCE: |
| 3404 return 'INSTANCE'; | 3392 return 'INSTANCE'; |
| 3405 } | 3393 } |
| 3406 } | 3394 } |
| 3407 } | 3395 } |
| 3408 | |
| 3409 class HReadTypeVariable extends HInstruction { | |
| 3410 /// The type variable being read. | |
| 3411 final TypeVariableType dartType; | |
| 3412 | |
| 3413 final bool hasReceiver; | |
| 3414 | |
| 3415 HReadTypeVariable( | |
| 3416 this.dartType, HInstruction receiver, TypeMask instructionType) | |
| 3417 : hasReceiver = true, | |
| 3418 super(<HInstruction>[receiver], instructionType) { | |
| 3419 setUseGvn(); | |
| 3420 } | |
| 3421 | |
| 3422 HReadTypeVariable.noReceiver( | |
| 3423 this.dartType, HInstruction typeArgument, TypeMask instructionType) | |
| 3424 : hasReceiver = false, | |
| 3425 super(<HInstruction>[typeArgument], instructionType) { | |
| 3426 setUseGvn(); | |
| 3427 } | |
| 3428 | |
| 3429 accept(HVisitor visitor) => visitor.visitReadTypeVariable(this); | |
| 3430 | |
| 3431 bool canThrow() => false; | |
| 3432 | |
| 3433 int typeCode() => HInstruction.READ_TYPE_VARIABLE_TYPECODE; | |
| 3434 bool typeEquals(HInstruction other) => other is HReadTypeVariable; | |
| 3435 | |
| 3436 bool dataEquals(HReadTypeVariable other) { | |
| 3437 return dartType == other.dartType && hasReceiver == other.hasReceiver; | |
| 3438 } | |
| 3439 } | |
| 3440 | |
| 3441 abstract class HRuntimeType extends HInstruction { | |
| 3442 final DartType dartType; | |
| 3443 | |
| 3444 HRuntimeType( | |
| 3445 List<HInstruction> inputs, this.dartType, TypeMask instructionType) | |
| 3446 : super(inputs, instructionType) { | |
| 3447 setUseGvn(); | |
| 3448 } | |
| 3449 | |
| 3450 bool canThrow() => false; | |
| 3451 | |
| 3452 int typeCode() { | |
| 3453 throw 'abstract method'; | |
| 3454 } | |
| 3455 | |
| 3456 bool typeEquals(HInstruction other) { | |
| 3457 throw 'abstract method'; | |
| 3458 } | |
| 3459 | |
| 3460 bool dataEquals(HRuntimeType other) { | |
| 3461 return dartType == other.dartType; | |
| 3462 } | |
| 3463 } | |
| 3464 | |
| 3465 class HFunctionType extends HRuntimeType { | |
| 3466 HFunctionType(List<HInstruction> inputs, FunctionType dartType, | |
| 3467 TypeMask instructionType) | |
| 3468 : super(inputs, dartType, instructionType); | |
| 3469 | |
| 3470 accept(HVisitor visitor) => visitor.visitFunctionType(this); | |
| 3471 | |
| 3472 int typeCode() => HInstruction.FUNCTION_TYPE_TYPECODE; | |
| 3473 | |
| 3474 bool typeEquals(HInstruction other) => other is HFunctionType; | |
| 3475 } | |
| 3476 | |
| 3477 class HVoidType extends HRuntimeType { | |
| 3478 HVoidType(VoidType dartType, TypeMask instructionType) | |
| 3479 : super(const <HInstruction>[], dartType, instructionType); | |
| 3480 | |
| 3481 accept(HVisitor visitor) => visitor.visitVoidType(this); | |
| 3482 | |
| 3483 int typeCode() => HInstruction.VOID_TYPE_TYPECODE; | |
| 3484 | |
| 3485 bool typeEquals(HInstruction other) => other is HVoidType; | |
| 3486 } | |
| 3487 | |
| 3488 class HInterfaceType extends HRuntimeType { | |
| 3489 HInterfaceType(List<HInstruction> inputs, InterfaceType dartType, | |
| 3490 TypeMask instructionType) | |
| 3491 : super(inputs, dartType, instructionType); | |
| 3492 | |
| 3493 accept(HVisitor visitor) => visitor.visitInterfaceType(this); | |
| 3494 | |
| 3495 int typeCode() => HInstruction.INTERFACE_TYPE_TYPECODE; | |
| 3496 | |
| 3497 bool typeEquals(HInstruction other) => other is HInterfaceType; | |
| 3498 } | |
| 3499 | |
| 3500 class HDynamicType extends HRuntimeType { | |
| 3501 HDynamicType(DynamicType dartType, TypeMask instructionType) | |
| 3502 : super(const <HInstruction>[], dartType, instructionType); | |
| 3503 | |
| 3504 accept(HVisitor visitor) => visitor.visitDynamicType(this); | |
| 3505 | |
| 3506 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; | |
| 3507 | |
| 3508 bool typeEquals(HInstruction other) => other is HDynamicType; | |
| 3509 } | |
| OLD | NEW |