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

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

Issue 2319863002: Revert "dart2js: Pass type information to constructor rather than add later." (Closed)
Patch Set: 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1486 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 1506
1507 /// Does this instruction have reified type information as the last input?
1508 final bool hasRtiInput;
1509
1510 /// If this field is not `null`, this call is from an inlined constructor and 1507 /// If this field is not `null`, this call is from an inlined constructor and
1511 /// we have to register the instantiated type in the code generator. The 1508 /// we have to register the instantiated type in the code generator. The
1512 /// [instructionType] of this node is not enough, because we also need the 1509 /// [instructionType] of this node is not enough, because we also need the
1513 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations]. 1510 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1514 List<DartType> instantiatedTypes; 1511 List<DartType> instantiatedTypes;
1515 1512
1516 HCreate(this.element, List<HInstruction> inputs, TypeMask type, 1513 HCreate(this.element, List<HInstruction> inputs, TypeMask type,
1517 {this.instantiatedTypes, this.hasRtiInput: false}) 1514 [this.instantiatedTypes])
1518 : super(inputs, type); 1515 : super(inputs, type);
1519 1516
1517 accept(HVisitor visitor) => visitor.visitCreate(this);
1518
1520 bool get isAllocation => true; 1519 bool get isAllocation => true;
1521 1520
1522 HInstruction get rtiInput { 1521 String toString() => 'HCreate($element)';
1523 assert(hasRtiInput);
1524 return inputs.last;
1525 }
1526
1527 accept(HVisitor visitor) => visitor.visitCreate(this);
1528
1529 String toString() => 'HCreate($element, ${instantiatedTypes})';
1530 } 1522 }
1531 1523
1532 abstract class HInvoke extends HInstruction { 1524 abstract class HInvoke extends HInstruction {
1533 /** 1525 /**
1534 * The first argument must be the target: either an [HStatic] node, or 1526 * The first argument must be the target: either an [HStatic] node, or
1535 * the receiver of a method-call. The remaining inputs are the arguments 1527 * the receiver of a method-call. The remaining inputs are the arguments
1536 * to the invocation. 1528 * to the invocation.
1537 */ 1529 */
1538 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) { 1530 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) {
1539 sideEffects.setAllSideEffects(); 1531 sideEffects.setAllSideEffects();
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3331 3323
3332 bool canThrow() => false; 3324 bool canThrow() => false;
3333 3325
3334 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE; 3326 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE;
3335 bool typeEquals(HInstruction other) => other is HTypeInfoExpression; 3327 bool typeEquals(HInstruction other) => other is HTypeInfoExpression;
3336 3328
3337 bool dataEquals(HTypeInfoExpression other) { 3329 bool dataEquals(HTypeInfoExpression other) {
3338 return kind == other.kind && dartType == other.dartType; 3330 return kind == other.kind && dartType == other.dartType;
3339 } 3331 }
3340 3332
3341 String toString() => 'HTypeInfoExpression($kindAsString, $dartType)'; 3333 String toString() => 'HTypeInfoExpression $kindAsString $dartType';
3342 3334
3343 String get kindAsString { 3335 String get kindAsString {
3344 switch (kind) { 3336 switch (kind) {
3345 case TypeInfoExpressionKind.COMPLETE: 3337 case TypeInfoExpressionKind.COMPLETE:
3346 return 'COMPLETE'; 3338 return 'COMPLETE';
3347 case TypeInfoExpressionKind.INSTANCE: 3339 case TypeInfoExpressionKind.INSTANCE:
3348 return 'INSTANCE'; 3340 return 'INSTANCE';
3349 } 3341 }
3350 } 3342 }
3351 } 3343 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3445 class HDynamicType extends HRuntimeType { 3437 class HDynamicType extends HRuntimeType {
3446 HDynamicType(DynamicType dartType, TypeMask instructionType) 3438 HDynamicType(DynamicType dartType, TypeMask instructionType)
3447 : super(const <HInstruction>[], dartType, instructionType); 3439 : super(const <HInstruction>[], dartType, instructionType);
3448 3440
3449 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3441 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3450 3442
3451 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3443 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3452 3444
3453 bool typeEquals(HInstruction other) => other is HDynamicType; 3445 bool typeEquals(HInstruction other) => other is HDynamicType;
3454 } 3446 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/codegen.dart ('k') | pkg/compiler/lib/src/ssa/optimize.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698