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

Side by Side Diff: pkg/kernel/testcases/closures/loop2.dart.expect

Issue 3008923002: Improve the performance of closure-converted code. (Closed)
Patch Set: Additional bug fixes. Created 3 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
OLDNEW
1 library; 1 library;
2 import self as self; 2 import self as self;
3 import "dart:core" as core; 3 import "dart:core" as core;
4 4
5 static method doit(core::int x) → void { 5 static method doit(core::int x) → void {
6 final dynamic #context = MakeVector(3); 6 final dynamic #context = MakeVector(3);
7 #context[2] = x; 7 #context[2] = x;
8 x = null;
8 final core::int max = 10; 9 final core::int max = 10;
9 final core::double expectedSum = max.-(1).*(max)./(2); 10 final core::double expectedSum = max.-(1).*(max)./(2);
10 core::int counter = 0; 11 core::int counter = 0;
11 dynamic calls = <dynamic>[]; 12 dynamic calls = <dynamic>[];
12 while (counter.<(max)) { 13 while (counter.<(max)) {
13 final dynamic #context = MakeVector(3); 14 final dynamic #context = MakeVector(3);
14 #context[1] = #context; 15 #context[1] = #context;
15 #context[2] = counter; 16 #context[2] = counter;
16 calls.add(MakeClosure<() → dynamic>(self::closure#doit#function, #context)); 17 calls.add(MakeClosure<() → dynamic>(self::closure#doit#function, #context));
17 counter = counter.+(1); 18 counter = counter.+(1);
18 } 19 }
19 core::double sum = 0.0; 20 core::double sum = 0.0;
20 for (dynamic c in calls) 21 for (dynamic c in calls)
21 sum = sum.+(c.call()); 22 sum = sum.+(c.call());
22 if(!sum.==(expectedSum)) 23 if(!sum.==(expectedSum))
23 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}"); 24 throw core::Exception::•("Unexpected sum = ${sum} != ${expectedSum}");
24 } 25 }
25 static method main() → void { 26 static method main() → void {
26 self::doit(0); 27 self::doit(0);
27 } 28 }
28 static method closure#doit#function(dynamic #contextParameter) → dynamic { 29 static method closure#doit#function(dynamic #contextParameter) → dynamic {
29 return (#contextParameter[2]).+(#contextParameter[1][2]); 30 return (#contextParameter[2]).+(#contextParameter[1][2]);
30 } 31 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698