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

Side by Side Diff: pkg/compiler/lib/src/ssa/nodes.dart

Issue 2674813004: dart2js: Keep refined type for type checks (Closed)
Patch Set: Created 3 years, 10 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
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 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 2821 matching lines...) Expand 10 before | Expand all | Expand 10 after
2832 final int kind; 2832 final int kind;
2833 // [receiverTypeCheckSelector] is the selector used for a receiver type check 2833 // [receiverTypeCheckSelector] is the selector used for a receiver type check
2834 // on open-coded operators, e.g. the not-null check on `x` in `x + 1` would be 2834 // on open-coded operators, e.g. the not-null check on `x` in `x + 1` would be
2835 // compiled to the following, for which we need the selector `$add`. 2835 // compiled to the following, for which we need the selector `$add`.
2836 // 2836 //
2837 // if (typeof x != "number") x.$add(); 2837 // if (typeof x != "number") x.$add();
2838 // 2838 //
2839 final Selector receiverTypeCheckSelector; 2839 final Selector receiverTypeCheckSelector;
2840 2840
2841 TypeMask checkedType; // Not final because we refine it. 2841 TypeMask checkedType; // Not final because we refine it.
2842 TypeMask inputType; // Holds input type for codegen after HTypeKnown removal.
2842 2843
2843 HTypeConversion( 2844 HTypeConversion(
2844 this.typeExpression, this.kind, TypeMask type, HInstruction input, 2845 this.typeExpression, this.kind, TypeMask type, HInstruction input,
2845 {this.receiverTypeCheckSelector}) 2846 {this.receiverTypeCheckSelector})
2846 : checkedType = type, 2847 : checkedType = type,
2847 super(<HInstruction>[input], type) { 2848 super(<HInstruction>[input], type) {
2848 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null); 2849 assert(!isReceiverTypeCheck || receiverTypeCheckSelector != null);
2849 assert(typeExpression == null || !typeExpression.isTypedef); 2850 assert(typeExpression == null || !typeExpression.isTypedef);
2850 sourceElement = input.sourceElement; 2851 sourceElement = input.sourceElement;
2851 } 2852 }
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
3499 class HDynamicType extends HRuntimeType { 3500 class HDynamicType extends HRuntimeType {
3500 HDynamicType(DynamicType dartType, TypeMask instructionType) 3501 HDynamicType(DynamicType dartType, TypeMask instructionType)
3501 : super(const <HInstruction>[], dartType, instructionType); 3502 : super(const <HInstruction>[], dartType, instructionType);
3502 3503
3503 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3504 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3504 3505
3505 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3506 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3506 3507
3507 bool typeEquals(HInstruction other) => other is HDynamicType; 3508 bool typeEquals(HInstruction other) => other is HDynamicType;
3508 } 3509 }
OLDNEW
« pkg/compiler/lib/src/ssa/codegen.dart ('K') | « pkg/compiler/lib/src/ssa/codegen_helpers.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698