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

Unified Diff: pkg/compiler/lib/src/ssa/builder.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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | pkg/compiler/lib/src/ssa/optimize.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index d5e4c29d6953f6f8c23e4bef9cbf64bced6a001b..8d1ef6989ee6712db21b9c8e060b8b32e2c74818 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -5630,6 +5630,7 @@ class SsaBuilder extends NewResolvedVisitor {
//
// array.length == _end || throwConcurrentModificationError(array)
//
+ /*
SsaBranchBuilder branchBuilder = new SsaBranchBuilder(this, node);
branchBuilder.handleLogicalAndOr(
() {
@@ -5643,6 +5644,13 @@ class SsaBuilder extends NewResolvedVisitor {
},
isAnd: false);
pop();
+ */
+ HInstruction length = buildGetLength();
+ push(new HIdentity(length, originalLength, null, boolType));
+ pushInvokeStatic(node,
+ backend.getThrowConcurrentModificationError(),
+ [pop(), array]);
+ pop();
}
void buildInitializer() {
@@ -5651,9 +5659,9 @@ class SsaBuilder extends NewResolvedVisitor {
isFixed = isFixedLength(array.instructionType, compiler);
localsHandler.updateLocal(indexVariable,
graph.addConstantInt(0, compiler));
- if (!isFixed) {
+ //if (!isFixed) {
sra1 2015/04/16 19:27:09 This will be changed back, was just for debugging
originalLength = buildGetLength();
- }
+ //}
}
HInstruction buildCondition() {
@@ -5673,7 +5681,7 @@ class SsaBuilder extends NewResolvedVisitor {
//
// For now we will put the check in the body, which will miss a
// modification on the last iteration.
- buildConcurrentModificationErrorCheck();
+ //buildConcurrentModificationErrorCheck();
// Find a type for the element.
// Use the element type of the indexer into the array.
@@ -5713,6 +5721,7 @@ class SsaBuilder extends NewResolvedVisitor {
visit(node.body);
}
void buildUpdate() {
+ buildConcurrentModificationErrorCheck();
// TODO(sra): It would be slightly shorter to generate `a[i++]` in the
// body (and that more closely follows what an inlined iterator would do)
// but the code is horrible as `i+1` is carried around the loop in an
« no previous file with comments | « no previous file | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | pkg/compiler/lib/src/ssa/optimize.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698