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

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

Issue 2310573002: dart2js: Pass type information to constructor rather than add later. (Closed)
Patch Set: remove debug print Created 4 years, 3 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 '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../constants/constant_system.dart'; 8 import '../constants/constant_system.dart';
9 import '../constants/values.dart'; 9 import '../constants/values.dart';
10 import '../dart_types.dart'; 10 import '../dart_types.dart';
(...skipping 1485 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 1496
1497 abstract class HControlFlow extends HInstruction { 1497 abstract class HControlFlow extends HInstruction {
1498 HControlFlow(inputs) : super(inputs, const TypeMask.nonNullEmpty()); 1498 HControlFlow(inputs) : super(inputs, const TypeMask.nonNullEmpty());
1499 bool isControlFlow() => true; 1499 bool isControlFlow() => true;
1500 bool isJsStatement() => true; 1500 bool isJsStatement() => true;
1501 } 1501 }
1502 1502
1503 // Allocates and initializes an instance. 1503 // Allocates and initializes an instance.
1504 class HCreate extends HInstruction { 1504 class HCreate extends HInstruction {
1505 final ClassElement element; 1505 final ClassElement element;
1506 final bool hasRtiInput; // Is one of the inputs a reified type?
Siggi Cherem (dart-lang) 2016/09/07 17:49:38 nit: move this into a dart doc. I'd also highlight
sra1 2016/09/07 18:16:06 Done.
1506 1507
1507 /// If this field is not `null`, this call is from an inlined constructor and 1508 /// If this field is not `null`, this call is from an inlined constructor and
1508 /// we have to register the instantiated type in the code generator. The 1509 /// we have to register the instantiated type in the code generator. The
1509 /// [instructionType] of this node is not enough, because we also need the 1510 /// [instructionType] of this node is not enough, because we also need the
1510 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations]. 1511 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1511 List<DartType> instantiatedTypes; 1512 List<DartType> instantiatedTypes;
1512 1513
1513 HCreate(this.element, List<HInstruction> inputs, TypeMask type, 1514 HCreate(this.element, List<HInstruction> inputs, TypeMask type,
1514 [this.instantiatedTypes]) 1515 {this.instantiatedTypes, this.hasRtiInput: false})
1515 : super(inputs, type); 1516 : super(inputs, type);
1516 1517
1518 bool get isAllocation => true;
1519
1520 HInstruction get rtiInput {
1521 assert(hasRtiInput);
1522 return inputs.last;
1523 }
1524
1517 accept(HVisitor visitor) => visitor.visitCreate(this); 1525 accept(HVisitor visitor) => visitor.visitCreate(this);
1518 1526
1519 bool get isAllocation => true; 1527 String toString() => 'HCreate($element, ${instantiatedTypes})';
1520
1521 String toString() => 'HCreate($element)';
1522 } 1528 }
1523 1529
1524 abstract class HInvoke extends HInstruction { 1530 abstract class HInvoke extends HInstruction {
1525 /** 1531 /**
1526 * The first argument must be the target: either an [HStatic] node, or 1532 * The first argument must be the target: either an [HStatic] node, or
1527 * the receiver of a method-call. The remaining inputs are the arguments 1533 * the receiver of a method-call. The remaining inputs are the arguments
1528 * to the invocation. 1534 * to the invocation.
1529 */ 1535 */
1530 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) { 1536 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) {
1531 sideEffects.setAllSideEffects(); 1537 sideEffects.setAllSideEffects();
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 3329
3324 bool canThrow() => false; 3330 bool canThrow() => false;
3325 3331
3326 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE; 3332 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE;
3327 bool typeEquals(HInstruction other) => other is HTypeInfoExpression; 3333 bool typeEquals(HInstruction other) => other is HTypeInfoExpression;
3328 3334
3329 bool dataEquals(HTypeInfoExpression other) { 3335 bool dataEquals(HTypeInfoExpression other) {
3330 return kind == other.kind && dartType == other.dartType; 3336 return kind == other.kind && dartType == other.dartType;
3331 } 3337 }
3332 3338
3333 String toString() => 'HTypeInfoExpression $kindAsString $dartType'; 3339 String toString() => 'HTypeInfoExpression($kindAsString, $dartType)';
3334 3340
3335 String get kindAsString { 3341 String get kindAsString {
3336 switch (kind) { 3342 switch (kind) {
3337 case TypeInfoExpressionKind.COMPLETE: 3343 case TypeInfoExpressionKind.COMPLETE:
3338 return 'COMPLETE'; 3344 return 'COMPLETE';
3339 case TypeInfoExpressionKind.INSTANCE: 3345 case TypeInfoExpressionKind.INSTANCE:
3340 return 'INSTANCE'; 3346 return 'INSTANCE';
3341 } 3347 }
3342 } 3348 }
3343 } 3349 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 class HDynamicType extends HRuntimeType { 3443 class HDynamicType extends HRuntimeType {
3438 HDynamicType(DynamicType dartType, TypeMask instructionType) 3444 HDynamicType(DynamicType dartType, TypeMask instructionType)
3439 : super(const <HInstruction>[], dartType, instructionType); 3445 : super(const <HInstruction>[], dartType, instructionType);
3440 3446
3441 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3447 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3442 3448
3443 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3449 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3444 3450
3445 bool typeEquals(HInstruction other) => other is HDynamicType; 3451 bool typeEquals(HInstruction other) => other is HDynamicType;
3446 } 3452 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698