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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1299413002: Move common identifiers, names and selectors to a separate library. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index e777b41825af3c1b07c4a6d55470967a986b3387..2a485c3a50dcce2a14634ac6b303c8a63ed3d549 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -4,6 +4,8 @@
import 'optimizers.dart';
+import '../common/names.dart' show
+ Selectors;
import '../compiler.dart' as dart2js show
Compiler;
import '../constants/constant_system.dart';
@@ -1102,7 +1104,7 @@ class TransformingVisitor extends LeafVisitor {
}
/// Tries to replace [node] with a direct `length` or index access.
- ///
+ ///
/// Returns `true` if the node was replaced.
bool specializeIndexableAccess(InvokeMethod node) {
Primitive receiver = getDartReceiver(node);
@@ -1214,7 +1216,7 @@ class TransformingVisitor extends LeafVisitor {
return true;
case 'elementAt':
- if (!node.selector.isCall ||
+ if (!node.selector.isCall ||
node.selector.positionalArgumentCount != 1 ||
node.selector.namedArgumentCount != 0) {
return false;
@@ -1272,16 +1274,14 @@ class TransformingVisitor extends LeafVisitor {
Continuation iteratorCont = cont;
// Check that all uses of the iterator are 'moveNext' and 'current'.
- Selector moveNextSelector = new Selector.call('moveNext', null, 0);
- Selector currentSelector = new Selector.getter('current', null);
- assert(!isInterceptedSelector(moveNextSelector));
- assert(!isInterceptedSelector(currentSelector));
+ assert(!isInterceptedSelector(Selectors.moveNext));
+ assert(!isInterceptedSelector(Selectors.current));
for (Reference ref = iterator.firstRef; ref != null; ref = ref.next) {
if (ref.parent is! InvokeMethod) return false;
InvokeMethod use = ref.parent;
if (ref != use.receiver) return false;
- if (use.selector != moveNextSelector &&
- use.selector != currentSelector) {
+ if (use.selector != Selectors.moveNext &&
+ use.selector != Selectors.current) {
return false;
}
}
@@ -1296,7 +1296,7 @@ class TransformingVisitor extends LeafVisitor {
while (iterator.firstRef != null) {
InvokeMethod use = iterator.firstRef.parent;
Continuation useCont = use.continuation.definition;
- if (use.selector == currentSelector) {
+ if (use.selector == Selectors.current) {
// Rewrite iterator.current to a use of the 'current' variable.
Parameter result = useCont.parameters.single;
if (result.hint != null) {
@@ -1307,7 +1307,7 @@ class TransformingVisitor extends LeafVisitor {
LetPrim let = makeLetPrimInvoke(new GetMutable(current), useCont);
replaceSubtree(use, let);
} else {
- assert (use.selector == moveNextSelector);
+ assert (use.selector == Selectors.moveNext);
// Rewrite iterator.moveNext() to:
//
// if (index < list.length) {
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_builder_task.dart ('k') | pkg/compiler/lib/src/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698