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

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: Filter out type info pseudofield when parsing fieldspec for mirrors 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
1507 /// If this field is not `null`, this call is from an inlined constructor and 1510 /// 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 1511 /// 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 1512 /// [instructionType] of this node is not enough, because we also need the
1510 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations]. 1513 /// type arguments. See also [SsaFromAstMixin.currentInlinedInstantiations].
1511 List<DartType> instantiatedTypes; 1514 List<DartType> instantiatedTypes;
1512 1515
1513 HCreate(this.element, List<HInstruction> inputs, TypeMask type, 1516 HCreate(this.element, List<HInstruction> inputs, TypeMask type,
1514 [this.instantiatedTypes]) 1517 {this.instantiatedTypes, this.hasRtiInput: false})
1515 : super(inputs, type); 1518 : super(inputs, type);
1516 1519
1520 bool get isAllocation => true;
1521
1522 HInstruction get rtiInput {
1523 assert(hasRtiInput);
1524 return inputs.last;
1525 }
1526
1517 accept(HVisitor visitor) => visitor.visitCreate(this); 1527 accept(HVisitor visitor) => visitor.visitCreate(this);
1518 1528
1519 bool get isAllocation => true; 1529 String toString() => 'HCreate($element, ${instantiatedTypes})';
1520
1521 String toString() => 'HCreate($element)';
1522 } 1530 }
1523 1531
1524 abstract class HInvoke extends HInstruction { 1532 abstract class HInvoke extends HInstruction {
1525 /** 1533 /**
1526 * The first argument must be the target: either an [HStatic] node, or 1534 * 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 1535 * the receiver of a method-call. The remaining inputs are the arguments
1528 * to the invocation. 1536 * to the invocation.
1529 */ 1537 */
1530 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) { 1538 HInvoke(List<HInstruction> inputs, type) : super(inputs, type) {
1531 sideEffects.setAllSideEffects(); 1539 sideEffects.setAllSideEffects();
(...skipping 1791 matching lines...) Expand 10 before | Expand all | Expand 10 after
3323 3331
3324 bool canThrow() => false; 3332 bool canThrow() => false;
3325 3333
3326 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE; 3334 int typeCode() => HInstruction.TYPE_INFO_EXPRESSION_TYPECODE;
3327 bool typeEquals(HInstruction other) => other is HTypeInfoExpression; 3335 bool typeEquals(HInstruction other) => other is HTypeInfoExpression;
3328 3336
3329 bool dataEquals(HTypeInfoExpression other) { 3337 bool dataEquals(HTypeInfoExpression other) {
3330 return kind == other.kind && dartType == other.dartType; 3338 return kind == other.kind && dartType == other.dartType;
3331 } 3339 }
3332 3340
3333 String toString() => 'HTypeInfoExpression $kindAsString $dartType'; 3341 String toString() => 'HTypeInfoExpression($kindAsString, $dartType)';
3334 3342
3335 String get kindAsString { 3343 String get kindAsString {
3336 switch (kind) { 3344 switch (kind) {
3337 case TypeInfoExpressionKind.COMPLETE: 3345 case TypeInfoExpressionKind.COMPLETE:
3338 return 'COMPLETE'; 3346 return 'COMPLETE';
3339 case TypeInfoExpressionKind.INSTANCE: 3347 case TypeInfoExpressionKind.INSTANCE:
3340 return 'INSTANCE'; 3348 return 'INSTANCE';
3341 } 3349 }
3342 } 3350 }
3343 } 3351 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
3437 class HDynamicType extends HRuntimeType { 3445 class HDynamicType extends HRuntimeType {
3438 HDynamicType(DynamicType dartType, TypeMask instructionType) 3446 HDynamicType(DynamicType dartType, TypeMask instructionType)
3439 : super(const <HInstruction>[], dartType, instructionType); 3447 : super(const <HInstruction>[], dartType, instructionType);
3440 3448
3441 accept(HVisitor visitor) => visitor.visitDynamicType(this); 3449 accept(HVisitor visitor) => visitor.visitDynamicType(this);
3442 3450
3443 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE; 3451 int typeCode() => HInstruction.DYNAMIC_TYPE_TYPECODE;
3444 3452
3445 bool typeEquals(HInstruction other) => other is HDynamicType; 3453 bool typeEquals(HInstruction other) => other is HDynamicType;
3446 } 3454 }
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