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

Side by Side Diff: test/codegen/expect/DeltaBlue.js

Issue 1011153002: js: fix core.Object, output order, static const fields (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 9 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 var DeltaBlue; 1 var DeltaBlue;
2 (function(exports) { 2 (function(exports) {
3 'use strict'; 3 'use strict';
4 // Function main: () → dynamic 4 // Function main: () → dynamic
5 function main() { 5 function main() {
6 new DeltaBlue().report(); 6 new DeltaBlue().report();
7 } 7 }
8 class DeltaBlue extends BenchmarkBase.BenchmarkBase { 8 class DeltaBlue extends BenchmarkBase.BenchmarkBase {
9 DeltaBlue() { 9 DeltaBlue() {
10 super.BenchmarkBase("DeltaBlue"); 10 super.BenchmarkBase("DeltaBlue");
11 } 11 }
12 run() { 12 run() {
13 chainTest(100); 13 chainTest(100);
14 projectionTest(100); 14 projectionTest(100);
15 } 15 }
16 } 16 }
17 class Strength extends dart.Object { 17 class Strength extends core.Object {
18 Strength(value, name) { 18 Strength(value, name) {
19 this.value = value; 19 this.value = value;
20 this.name = name; 20 this.name = name;
21 } 21 }
22 nextWeaker() { 22 nextWeaker() {
23 return /* Unimplemented const */new List.from([STRONG_PREFERRED, PREFERRED , STRONG_DEFAULT, NORMAL, WEAK_DEFAULT, WEAKEST]).get(this.value); 23 return /* Unimplemented const */new List.from([STRONG_PREFERRED, PREFERRED , STRONG_DEFAULT, NORMAL, WEAK_DEFAULT, WEAKEST]).get(this.value);
24 } 24 }
25 static stronger(s1, s2) { 25 static stronger(s1, s2) {
26 return dart.notNull(s1.value) < dart.notNull(s2.value); 26 return dart.notNull(s1.value) < dart.notNull(s2.value);
27 } 27 }
28 static weaker(s1, s2) { 28 static weaker(s1, s2) {
29 return dart.notNull(s1.value) > dart.notNull(s2.value); 29 return dart.notNull(s1.value) > dart.notNull(s2.value);
30 } 30 }
31 static weakest(s1, s2) { 31 static weakest(s1, s2) {
32 return weaker(s1, s2) ? s1 : s2; 32 return weaker(s1, s2) ? s1 : s2;
33 } 33 }
34 static strongest(s1, s2) { 34 static strongest(s1, s2) {
35 return stronger(s1, s2) ? s1 : s2; 35 return stronger(s1, s2) ? s1 : s2;
36 } 36 }
37 } 37 }
38 let REQUIRED = new Strength(0, "required"); 38 let REQUIRED = new Strength(0, "required");
39 let STRONG_PREFERRED = new Strength(1, "strongPreferred"); 39 let STRONG_PREFERRED = new Strength(1, "strongPreferred");
40 let PREFERRED = new Strength(2, "preferred"); 40 let PREFERRED = new Strength(2, "preferred");
41 let STRONG_DEFAULT = new Strength(3, "strongDefault"); 41 let STRONG_DEFAULT = new Strength(3, "strongDefault");
42 let NORMAL = new Strength(4, "normal"); 42 let NORMAL = new Strength(4, "normal");
43 let WEAK_DEFAULT = new Strength(5, "weakDefault"); 43 let WEAK_DEFAULT = new Strength(5, "weakDefault");
44 let WEAKEST = new Strength(6, "weakest"); 44 let WEAKEST = new Strength(6, "weakest");
45 class Constraint extends dart.Object { 45 class Constraint extends core.Object {
46 Constraint(strength) { 46 Constraint(strength) {
47 this.strength = strength; 47 this.strength = strength;
48 } 48 }
49 addConstraint() { 49 addConstraint() {
50 this.addToGraph(); 50 this.addToGraph();
51 exports.planner.incrementalAdd(this); 51 exports.planner.incrementalAdd(this);
52 } 52 }
53 satisfy(mark) { 53 satisfy(mark) {
54 this.chooseMethod(dart.as(mark, core.int)); 54 this.chooseMethod(dart.as(mark, core.int));
55 if (!dart.notNull(this.isSatisfied())) { 55 if (!dart.notNull(this.isSatisfied())) {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 } 233 }
234 } 234 }
235 class EqualityConstraint extends BinaryConstraint { 235 class EqualityConstraint extends BinaryConstraint {
236 EqualityConstraint(v1, v2, strength) { 236 EqualityConstraint(v1, v2, strength) {
237 super.BinaryConstraint(v1, v2, strength); 237 super.BinaryConstraint(v1, v2, strength);
238 } 238 }
239 execute() { 239 execute() {
240 this.output().value = this.input().value; 240 this.output().value = this.input().value;
241 } 241 }
242 } 242 }
243 class Variable extends dart.Object { 243 class Variable extends core.Object {
244 Variable(name, value) { 244 Variable(name, value) {
245 this.constraints = new List.from([]); 245 this.constraints = new List.from([]);
246 this.name = name; 246 this.name = name;
247 this.value = value; 247 this.value = value;
248 this.determinedBy = null; 248 this.determinedBy = null;
249 this.mark = 0; 249 this.mark = 0;
250 this.walkStrength = WEAKEST; 250 this.walkStrength = WEAKEST;
251 this.stay = true; 251 this.stay = true;
252 } 252 }
253 addConstraint(c) { 253 addConstraint(c) {
254 this.constraints.add(c); 254 this.constraints.add(c);
255 } 255 }
256 removeConstraint(c) { 256 removeConstraint(c) {
257 this.constraints.remove(c); 257 this.constraints.remove(c);
258 if (dart.equals(this.determinedBy, c)) 258 if (dart.equals(this.determinedBy, c))
259 this.determinedBy = null; 259 this.determinedBy = null;
260 } 260 }
261 } 261 }
262 class Planner extends dart.Object { 262 class Planner extends core.Object {
263 Planner() { 263 Planner() {
264 this.currentMark = 0; 264 this.currentMark = 0;
265 } 265 }
266 incrementalAdd(c) { 266 incrementalAdd(c) {
267 let mark = this.newMark(); 267 let mark = this.newMark();
268 for (let overridden = c.satisfy(mark); overridden !== null; overridden = o verridden.satisfy(mark)) 268 for (let overridden = c.satisfy(mark); overridden !== null; overridden = o verridden.satisfy(mark))
269 ; 269 ;
270 } 270 }
271 incrementalRemove(c) { 271 incrementalRemove(c) {
272 let out = c.output(); 272 let out = c.output();
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 } 348 }
349 addConstraintsConsumingTo(v, coll) { 349 addConstraintsConsumingTo(v, coll) {
350 let determining = v.determinedBy; 350 let determining = v.determinedBy;
351 for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints.length); i = dart.notNull(i) + 1) { 351 for (let i = 0; dart.notNull(i) < dart.notNull(v.constraints.length); i = dart.notNull(i) + 1) {
352 let c = v.constraints.get(i); 352 let c = v.constraints.get(i);
353 if (dart.notNull(!dart.equals(c, determining)) && dart.notNull(c.isSatis fied())) 353 if (dart.notNull(!dart.equals(c, determining)) && dart.notNull(c.isSatis fied()))
354 coll.add(c); 354 coll.add(c);
355 } 355 }
356 } 356 }
357 } 357 }
358 class Plan extends dart.Object { 358 class Plan extends core.Object {
359 Plan() { 359 Plan() {
360 this.list = new List.from([]); 360 this.list = new List.from([]);
361 } 361 }
362 addConstraint(c) { 362 addConstraint(c) {
363 this.list.add(c); 363 this.list.add(c);
364 } 364 }
365 size() { 365 size() {
366 return this.list.length; 366 return this.list.length;
367 } 367 }
368 execute() { 368 execute() {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 exports.BinaryConstraint = BinaryConstraint; 460 exports.BinaryConstraint = BinaryConstraint;
461 exports.ScaleConstraint = ScaleConstraint; 461 exports.ScaleConstraint = ScaleConstraint;
462 exports.EqualityConstraint = EqualityConstraint; 462 exports.EqualityConstraint = EqualityConstraint;
463 exports.Variable = Variable; 463 exports.Variable = Variable;
464 exports.Planner = Planner; 464 exports.Planner = Planner;
465 exports.Plan = Plan; 465 exports.Plan = Plan;
466 exports.chainTest = chainTest; 466 exports.chainTest = chainTest;
467 exports.projectionTest = projectionTest; 467 exports.projectionTest = projectionTest;
468 exports.change = change; 468 exports.change = change;
469 })(DeltaBlue || (DeltaBlue = {})); 469 })(DeltaBlue || (DeltaBlue = {}));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698