| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.ir_nodes; | 4 library dart2js.ir_nodes; |
| 5 | 5 |
| 6 import 'dart:collection'; | 6 import 'dart:collection'; |
| 7 import '../constants/values.dart' as values; | 7 import '../constants/values.dart' as values; |
| 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; | 8 import '../dart_types.dart' show DartType, InterfaceType, TypeVariableType; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import '../io/source_information.dart' show SourceInformation; | 10 import '../io/source_information.dart' show SourceInformation; |
| (...skipping 572 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 /// Note that [InvokeConstructor] does it itself allocate an object. | 583 /// Note that [InvokeConstructor] does it itself allocate an object. |
| 584 /// The invoked constructor will do that using [CreateInstance]. | 584 /// The invoked constructor will do that using [CreateInstance]. |
| 585 class InvokeConstructor extends CallExpression { | 585 class InvokeConstructor extends CallExpression { |
| 586 final DartType dartType; | 586 final DartType dartType; |
| 587 final ConstructorElement target; | 587 final ConstructorElement target; |
| 588 final List<Reference<Primitive>> arguments; | 588 final List<Reference<Primitive>> arguments; |
| 589 final Reference<Continuation> continuation; | 589 final Reference<Continuation> continuation; |
| 590 final Selector selector; | 590 final Selector selector; |
| 591 final SourceInformation sourceInformation; | 591 final SourceInformation sourceInformation; |
| 592 | 592 |
| 593 /// If non-null, this is an allocation site-specific type that is potentially |
| 594 /// better than the inferred return type of [target]. |
| 595 /// |
| 596 /// In particular, container type masks depend on the allocation site and |
| 597 /// can therefore not be inferred solely based on the call target. |
| 598 TypeMask allocationSiteType; |
| 599 |
| 593 InvokeConstructor(this.dartType, | 600 InvokeConstructor(this.dartType, |
| 594 this.target, | 601 this.target, |
| 595 this.selector, | 602 this.selector, |
| 596 List<Primitive> args, | 603 List<Primitive> args, |
| 597 Continuation cont, | 604 Continuation cont, |
| 598 this.sourceInformation) | 605 this.sourceInformation, |
| 606 {this.allocationSiteType}) |
| 599 : arguments = _referenceList(args), | 607 : arguments = _referenceList(args), |
| 600 continuation = new Reference<Continuation>(cont); | 608 continuation = new Reference<Continuation>(cont); |
| 601 | 609 |
| 602 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); | 610 accept(Visitor visitor) => visitor.visitInvokeConstructor(this); |
| 603 | 611 |
| 604 void setParentPointers() { | 612 void setParentPointers() { |
| 605 _setParentsOnList(arguments, this); | 613 _setParentsOnList(arguments, this); |
| 606 continuation.parent = this; | 614 continuation.parent = this; |
| 607 } | 615 } |
| 608 } | 616 } |
| (...skipping 721 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1330 bool get isSafeForReordering => true; | 1338 bool get isSafeForReordering => true; |
| 1331 | 1339 |
| 1332 void setParentPointers() {} | 1340 void setParentPointers() {} |
| 1333 } | 1341 } |
| 1334 | 1342 |
| 1335 class LiteralList extends Primitive { | 1343 class LiteralList extends Primitive { |
| 1336 /// The List type being created; this is not the type argument. | 1344 /// The List type being created; this is not the type argument. |
| 1337 final InterfaceType dartType; | 1345 final InterfaceType dartType; |
| 1338 final List<Reference<Primitive>> values; | 1346 final List<Reference<Primitive>> values; |
| 1339 | 1347 |
| 1340 LiteralList(this.dartType, List<Primitive> values) | 1348 /// If non-null, this is an allocation site-specific type for the list |
| 1349 /// created here. |
| 1350 TypeMask allocationSiteType; |
| 1351 |
| 1352 LiteralList(this.dartType, List<Primitive> values, {this.allocationSiteType}) |
| 1341 : this.values = _referenceList(values); | 1353 : this.values = _referenceList(values); |
| 1342 | 1354 |
| 1343 accept(Visitor visitor) => visitor.visitLiteralList(this); | 1355 accept(Visitor visitor) => visitor.visitLiteralList(this); |
| 1344 | 1356 |
| 1345 bool get isSafeForElimination => true; | 1357 bool get isSafeForElimination => true; |
| 1346 bool get isSafeForReordering => true; | 1358 bool get isSafeForReordering => true; |
| 1347 | 1359 |
| 1348 void setParentPointers() { | 1360 void setParentPointers() { |
| 1349 _setParentsOnList(values, this); | 1361 _setParentsOnList(values, this); |
| 1350 } | 1362 } |
| (...skipping 786 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2137 /// Visit a just-deleted subterm and unlink all [Reference]s in it. | 2149 /// Visit a just-deleted subterm and unlink all [Reference]s in it. |
| 2138 class RemovalVisitor extends TrampolineRecursiveVisitor { | 2150 class RemovalVisitor extends TrampolineRecursiveVisitor { |
| 2139 processReference(Reference reference) { | 2151 processReference(Reference reference) { |
| 2140 reference.unlink(); | 2152 reference.unlink(); |
| 2141 } | 2153 } |
| 2142 | 2154 |
| 2143 static void remove(Node node) { | 2155 static void remove(Node node) { |
| 2144 (new RemovalVisitor()).visit(node); | 2156 (new RemovalVisitor()).visit(node); |
| 2145 } | 2157 } |
| 2146 } | 2158 } |
| OLD | NEW |