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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_helper.dart

Issue 1087973002: Rewrite for-in loop as indexing loop for JavaScript indexable arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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: sdk/lib/_internal/compiler/js_lib/js_helper.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_helper.dart b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
index 84213c6024e095d0edc19213ca57844db22ee29c..8b7ac87d4345b065af328b70e83be27be2a2086c 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_helper.dart
@@ -1435,8 +1435,23 @@ throwAbstractClassInstantiationError(className) {
throw new AbstractClassInstantiationError(className);
}
-throwConcurrentModificationError(collection) {
- throw new ConcurrentModificationError(collection);
+// Can be called
+//
+// throwConcurrentModificationError(a.length == startLength, a)
+//
+// or
+//
+// s.length == startLength || throwConcurrentModificationError(a)
+//
+@NoInline() @NoSideEffects()
+throwConcurrentModificationError(sameLength, [collection]) {
floitsch 2015/04/16 19:22:53 I would prefer a separate function which you then
sra1 2015/04/16 23:37:24 Done.
+ if (collection == null) {
+ collection = sameLength;
+ sameLength = false;
+ }
+ if (true != sameLength) {
+ throw new ConcurrentModificationError(collection);
+ }
}
/**
« pkg/compiler/lib/src/ssa/optimize.dart ('K') | « pkg/compiler/lib/src/ssa/optimize.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698