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

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

Issue 1965213003: simplify constructors, fixes #564 (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 years, 7 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
« no previous file with comments | « test/codegen/expect/BenchmarkBase.js ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('DeltaBlue', null, /* Imports */[ 1 dart_library.library('DeltaBlue', null, /* Imports */[
2 'dart_sdk' 2 'dart_sdk'
3 ], function(exports, dart_sdk) { 3 ], function(exports, dart_sdk) {
4 'use strict'; 4 'use strict';
5 const core = dart_sdk.core; 5 const core = dart_sdk.core;
6 const dart = dart_sdk.dart; 6 const dart = dart_sdk.dart;
7 const dartx = dart_sdk.dartx; 7 const dartx = dart_sdk.dartx;
8 const DeltaBlue$ = Object.create(null); 8 const DeltaBlue$ = Object.create(null);
9 const BenchmarkBase$ = Object.create(null); 9 const BenchmarkBase$ = Object.create(null);
10 DeltaBlue$.main = function() { 10 DeltaBlue$.main = function() {
11 new DeltaBlue$.DeltaBlue().report(); 11 new DeltaBlue$.DeltaBlue().report();
12 }; 12 };
13 dart.fn(DeltaBlue$.main); 13 dart.fn(DeltaBlue$.main);
14 BenchmarkBase$.BenchmarkBase = class BenchmarkBase extends core.Object { 14 BenchmarkBase$.BenchmarkBase = class BenchmarkBase extends core.Object {
15 BenchmarkBase(name) { 15 new(name) {
16 this.name = name; 16 this.name = name;
17 } 17 }
18 run() {} 18 run() {}
19 warmup() { 19 warmup() {
20 this.run(); 20 this.run();
21 } 21 }
22 exercise() { 22 exercise() {
23 for (let i = 0; i < 10; i++) { 23 for (let i = 0; i < 10; i++) {
24 this.run(); 24 this.run();
25 } 25 }
(...skipping 23 matching lines...) Expand all
49 }), 2000); 49 }), 2000);
50 this.teardown(); 50 this.teardown();
51 return result; 51 return result;
52 } 52 }
53 report() { 53 report() {
54 let score = this.measure(); 54 let score = this.measure();
55 core.print(`${this.name}(RunTime): ${score} us.`); 55 core.print(`${this.name}(RunTime): ${score} us.`);
56 } 56 }
57 }; 57 };
58 dart.setSignature(BenchmarkBase$.BenchmarkBase, { 58 dart.setSignature(BenchmarkBase$.BenchmarkBase, {
59 constructors: () => ({BenchmarkBase: [BenchmarkBase$.BenchmarkBase, [core.St ring]]}), 59 constructors: () => ({new: [BenchmarkBase$.BenchmarkBase, [core.String]]}),
60 methods: () => ({ 60 methods: () => ({
61 run: [dart.void, []], 61 run: [dart.void, []],
62 warmup: [dart.void, []], 62 warmup: [dart.void, []],
63 exercise: [dart.void, []], 63 exercise: [dart.void, []],
64 setup: [dart.void, []], 64 setup: [dart.void, []],
65 teardown: [dart.void, []], 65 teardown: [dart.void, []],
66 measure: [core.double, []], 66 measure: [core.double, []],
67 report: [dart.void, []] 67 report: [dart.void, []]
68 }), 68 }),
69 statics: () => ({measureFor: [core.double, [core.Function, core.int]]}), 69 statics: () => ({measureFor: [core.double, [core.Function, core.int]]}),
70 names: ['measureFor'] 70 names: ['measureFor']
71 }); 71 });
72 DeltaBlue$.DeltaBlue = class DeltaBlue extends BenchmarkBase$.BenchmarkBase { 72 DeltaBlue$.DeltaBlue = class DeltaBlue extends BenchmarkBase$.BenchmarkBase {
73 DeltaBlue() { 73 new() {
74 super.BenchmarkBase("DeltaBlue"); 74 super.new("DeltaBlue");
75 } 75 }
76 run() { 76 run() {
77 DeltaBlue$.chainTest(100); 77 DeltaBlue$.chainTest(100);
78 DeltaBlue$.projectionTest(100); 78 DeltaBlue$.projectionTest(100);
79 } 79 }
80 }; 80 };
81 dart.setSignature(DeltaBlue$.DeltaBlue, { 81 dart.setSignature(DeltaBlue$.DeltaBlue, {
82 constructors: () => ({DeltaBlue: [DeltaBlue$.DeltaBlue, []]}) 82 constructors: () => ({new: [DeltaBlue$.DeltaBlue, []]})
83 }); 83 });
84 let const$; 84 let const$;
85 DeltaBlue$.Strength = class Strength extends core.Object { 85 DeltaBlue$.Strength = class Strength extends core.Object {
86 Strength(value, name) { 86 new(value, name) {
87 this.value = value; 87 this.value = value;
88 this.name = name; 88 this.name = name;
89 } 89 }
90 nextWeaker() { 90 nextWeaker() {
91 return (const$ || (const$ = dart.const(dart.list([DeltaBlue$.STRONG_PREFER RED, DeltaBlue$.PREFERRED, DeltaBlue$.STRONG_DEFAULT, DeltaBlue$.NORMAL, DeltaBl ue$.WEAK_DEFAULT, DeltaBlue$.WEAKEST], DeltaBlue$.Strength))))[dartx.get](this.v alue); 91 return (const$ || (const$ = dart.const(dart.list([DeltaBlue$.STRONG_PREFER RED, DeltaBlue$.PREFERRED, DeltaBlue$.STRONG_DEFAULT, DeltaBlue$.NORMAL, DeltaBl ue$.WEAK_DEFAULT, DeltaBlue$.WEAKEST], DeltaBlue$.Strength))))[dartx.get](this.v alue);
92 } 92 }
93 static stronger(s1, s2) { 93 static stronger(s1, s2) {
94 return dart.notNull(s1.value) < dart.notNull(s2.value); 94 return dart.notNull(s1.value) < dart.notNull(s2.value);
95 } 95 }
96 static weaker(s1, s2) { 96 static weaker(s1, s2) {
97 return dart.notNull(s1.value) > dart.notNull(s2.value); 97 return dart.notNull(s1.value) > dart.notNull(s2.value);
98 } 98 }
99 static weakest(s1, s2) { 99 static weakest(s1, s2) {
100 return dart.notNull(DeltaBlue$.Strength.weaker(s1, s2)) ? s1 : s2; 100 return dart.notNull(DeltaBlue$.Strength.weaker(s1, s2)) ? s1 : s2;
101 } 101 }
102 static strongest(s1, s2) { 102 static strongest(s1, s2) {
103 return dart.notNull(DeltaBlue$.Strength.stronger(s1, s2)) ? s1 : s2; 103 return dart.notNull(DeltaBlue$.Strength.stronger(s1, s2)) ? s1 : s2;
104 } 104 }
105 }; 105 };
106 dart.setSignature(DeltaBlue$.Strength, { 106 dart.setSignature(DeltaBlue$.Strength, {
107 constructors: () => ({Strength: [DeltaBlue$.Strength, [core.int, core.String ]]}), 107 constructors: () => ({new: [DeltaBlue$.Strength, [core.int, core.String]]}),
108 methods: () => ({nextWeaker: [DeltaBlue$.Strength, []]}), 108 methods: () => ({nextWeaker: [DeltaBlue$.Strength, []]}),
109 statics: () => ({ 109 statics: () => ({
110 stronger: [core.bool, [DeltaBlue$.Strength, DeltaBlue$.Strength]], 110 stronger: [core.bool, [DeltaBlue$.Strength, DeltaBlue$.Strength]],
111 weaker: [core.bool, [DeltaBlue$.Strength, DeltaBlue$.Strength]], 111 weaker: [core.bool, [DeltaBlue$.Strength, DeltaBlue$.Strength]],
112 weakest: [DeltaBlue$.Strength, [DeltaBlue$.Strength, DeltaBlue$.Strength]] , 112 weakest: [DeltaBlue$.Strength, [DeltaBlue$.Strength, DeltaBlue$.Strength]] ,
113 strongest: [DeltaBlue$.Strength, [DeltaBlue$.Strength, DeltaBlue$.Strength ]] 113 strongest: [DeltaBlue$.Strength, [DeltaBlue$.Strength, DeltaBlue$.Strength ]]
114 }), 114 }),
115 names: ['stronger', 'weaker', 'weakest', 'strongest'] 115 names: ['stronger', 'weaker', 'weakest', 'strongest']
116 }); 116 });
117 DeltaBlue$.REQUIRED = dart.const(new DeltaBlue$.Strength(0, "required")); 117 DeltaBlue$.REQUIRED = dart.const(new DeltaBlue$.Strength(0, "required"));
118 DeltaBlue$.STRONG_PREFERRED = dart.const(new DeltaBlue$.Strength(1, "strongPre ferred")); 118 DeltaBlue$.STRONG_PREFERRED = dart.const(new DeltaBlue$.Strength(1, "strongPre ferred"));
119 DeltaBlue$.PREFERRED = dart.const(new DeltaBlue$.Strength(2, "preferred")); 119 DeltaBlue$.PREFERRED = dart.const(new DeltaBlue$.Strength(2, "preferred"));
120 DeltaBlue$.STRONG_DEFAULT = dart.const(new DeltaBlue$.Strength(3, "strongDefau lt")); 120 DeltaBlue$.STRONG_DEFAULT = dart.const(new DeltaBlue$.Strength(3, "strongDefau lt"));
121 DeltaBlue$.NORMAL = dart.const(new DeltaBlue$.Strength(4, "normal")); 121 DeltaBlue$.NORMAL = dart.const(new DeltaBlue$.Strength(4, "normal"));
122 DeltaBlue$.WEAK_DEFAULT = dart.const(new DeltaBlue$.Strength(5, "weakDefault") ); 122 DeltaBlue$.WEAK_DEFAULT = dart.const(new DeltaBlue$.Strength(5, "weakDefault") );
123 DeltaBlue$.WEAKEST = dart.const(new DeltaBlue$.Strength(6, "weakest")); 123 DeltaBlue$.WEAKEST = dart.const(new DeltaBlue$.Strength(6, "weakest"));
124 DeltaBlue$.Constraint = class Constraint extends core.Object { 124 DeltaBlue$.Constraint = class Constraint extends core.Object {
125 Constraint(strength) { 125 new(strength) {
126 this.strength = strength; 126 this.strength = strength;
127 } 127 }
128 addConstraint() { 128 addConstraint() {
129 this.addToGraph(); 129 this.addToGraph();
130 DeltaBlue$.planner.incrementalAdd(this); 130 DeltaBlue$.planner.incrementalAdd(this);
131 } 131 }
132 satisfy(mark) { 132 satisfy(mark) {
133 this.chooseMethod(dart.as(mark, core.int)); 133 this.chooseMethod(dart.as(mark, core.int));
134 if (!dart.notNull(this.isSatisfied())) { 134 if (!dart.notNull(this.isSatisfied())) {
135 if (dart.equals(this.strength, DeltaBlue$.REQUIRED)) { 135 if (dart.equals(this.strength, DeltaBlue$.REQUIRED)) {
(...skipping 12 matching lines...) Expand all
148 } 148 }
149 destroyConstraint() { 149 destroyConstraint() {
150 if (dart.notNull(this.isSatisfied())) DeltaBlue$.planner.incrementalRemove (this); 150 if (dart.notNull(this.isSatisfied())) DeltaBlue$.planner.incrementalRemove (this);
151 this.removeFromGraph(); 151 this.removeFromGraph();
152 } 152 }
153 isInput() { 153 isInput() {
154 return false; 154 return false;
155 } 155 }
156 }; 156 };
157 dart.setSignature(DeltaBlue$.Constraint, { 157 dart.setSignature(DeltaBlue$.Constraint, {
158 constructors: () => ({Constraint: [DeltaBlue$.Constraint, [DeltaBlue$.Streng th]]}), 158 constructors: () => ({new: [DeltaBlue$.Constraint, [DeltaBlue$.Strength]]}),
159 methods: () => ({ 159 methods: () => ({
160 addConstraint: [dart.void, []], 160 addConstraint: [dart.void, []],
161 satisfy: [DeltaBlue$.Constraint, [dart.dynamic]], 161 satisfy: [DeltaBlue$.Constraint, [dart.dynamic]],
162 destroyConstraint: [dart.void, []], 162 destroyConstraint: [dart.void, []],
163 isInput: [core.bool, []] 163 isInput: [core.bool, []]
164 }) 164 })
165 }); 165 });
166 DeltaBlue$.UnaryConstraint = class UnaryConstraint extends DeltaBlue$.Constrai nt { 166 DeltaBlue$.UnaryConstraint = class UnaryConstraint extends DeltaBlue$.Constrai nt {
167 UnaryConstraint(myOutput, strength) { 167 new(myOutput, strength) {
168 this.myOutput = myOutput; 168 this.myOutput = myOutput;
169 this.satisfied = false; 169 this.satisfied = false;
170 super.Constraint(strength); 170 super.new(strength);
171 this.addConstraint(); 171 this.addConstraint();
172 } 172 }
173 addToGraph() { 173 addToGraph() {
174 this.myOutput.addConstraint(this); 174 this.myOutput.addConstraint(this);
175 this.satisfied = false; 175 this.satisfied = false;
176 } 176 }
177 chooseMethod(mark) { 177 chooseMethod(mark) {
178 this.satisfied = this.myOutput.mark != mark && dart.notNull(DeltaBlue$.Str ength.stronger(this.strength, this.myOutput.walkStrength)); 178 this.satisfied = this.myOutput.mark != mark && dart.notNull(DeltaBlue$.Str ength.stronger(this.strength, this.myOutput.walkStrength));
179 } 179 }
180 isSatisfied() { 180 isSatisfied() {
(...skipping 13 matching lines...) Expand all
194 } 194 }
195 inputsKnown(mark) { 195 inputsKnown(mark) {
196 return true; 196 return true;
197 } 197 }
198 removeFromGraph() { 198 removeFromGraph() {
199 if (this.myOutput != null) this.myOutput.removeConstraint(this); 199 if (this.myOutput != null) this.myOutput.removeConstraint(this);
200 this.satisfied = false; 200 this.satisfied = false;
201 } 201 }
202 }; 202 };
203 dart.setSignature(DeltaBlue$.UnaryConstraint, { 203 dart.setSignature(DeltaBlue$.UnaryConstraint, {
204 constructors: () => ({UnaryConstraint: [DeltaBlue$.UnaryConstraint, [DeltaBl ue$.Variable, DeltaBlue$.Strength]]}), 204 constructors: () => ({new: [DeltaBlue$.UnaryConstraint, [DeltaBlue$.Variable , DeltaBlue$.Strength]]}),
205 methods: () => ({ 205 methods: () => ({
206 addToGraph: [dart.void, []], 206 addToGraph: [dart.void, []],
207 chooseMethod: [dart.void, [core.int]], 207 chooseMethod: [dart.void, [core.int]],
208 isSatisfied: [core.bool, []], 208 isSatisfied: [core.bool, []],
209 markInputs: [dart.void, [core.int]], 209 markInputs: [dart.void, [core.int]],
210 output: [DeltaBlue$.Variable, []], 210 output: [DeltaBlue$.Variable, []],
211 recalculate: [dart.void, []], 211 recalculate: [dart.void, []],
212 markUnsatisfied: [dart.void, []], 212 markUnsatisfied: [dart.void, []],
213 inputsKnown: [core.bool, [core.int]], 213 inputsKnown: [core.bool, [core.int]],
214 removeFromGraph: [dart.void, []] 214 removeFromGraph: [dart.void, []]
215 }) 215 })
216 }); 216 });
217 DeltaBlue$.StayConstraint = class StayConstraint extends DeltaBlue$.UnaryConst raint { 217 DeltaBlue$.StayConstraint = class StayConstraint extends DeltaBlue$.UnaryConst raint {
218 StayConstraint(v, str) { 218 new(v, str) {
219 super.UnaryConstraint(v, str); 219 super.new(v, str);
220 } 220 }
221 execute() {} 221 execute() {}
222 }; 222 };
223 dart.setSignature(DeltaBlue$.StayConstraint, { 223 dart.setSignature(DeltaBlue$.StayConstraint, {
224 constructors: () => ({StayConstraint: [DeltaBlue$.StayConstraint, [DeltaBlue $.Variable, DeltaBlue$.Strength]]}), 224 constructors: () => ({new: [DeltaBlue$.StayConstraint, [DeltaBlue$.Variable, DeltaBlue$.Strength]]}),
225 methods: () => ({execute: [dart.void, []]}) 225 methods: () => ({execute: [dart.void, []]})
226 }); 226 });
227 DeltaBlue$.EditConstraint = class EditConstraint extends DeltaBlue$.UnaryConst raint { 227 DeltaBlue$.EditConstraint = class EditConstraint extends DeltaBlue$.UnaryConst raint {
228 EditConstraint(v, str) { 228 new(v, str) {
229 super.UnaryConstraint(v, str); 229 super.new(v, str);
230 } 230 }
231 isInput() { 231 isInput() {
232 return true; 232 return true;
233 } 233 }
234 execute() {} 234 execute() {}
235 }; 235 };
236 dart.setSignature(DeltaBlue$.EditConstraint, { 236 dart.setSignature(DeltaBlue$.EditConstraint, {
237 constructors: () => ({EditConstraint: [DeltaBlue$.EditConstraint, [DeltaBlue $.Variable, DeltaBlue$.Strength]]}), 237 constructors: () => ({new: [DeltaBlue$.EditConstraint, [DeltaBlue$.Variable, DeltaBlue$.Strength]]}),
238 methods: () => ({execute: [dart.void, []]}) 238 methods: () => ({execute: [dart.void, []]})
239 }); 239 });
240 DeltaBlue$.NONE = 1; 240 DeltaBlue$.NONE = 1;
241 DeltaBlue$.FORWARD = 2; 241 DeltaBlue$.FORWARD = 2;
242 DeltaBlue$.BACKWARD = 0; 242 DeltaBlue$.BACKWARD = 0;
243 DeltaBlue$.BinaryConstraint = class BinaryConstraint extends DeltaBlue$.Constr aint { 243 DeltaBlue$.BinaryConstraint = class BinaryConstraint extends DeltaBlue$.Constr aint {
244 BinaryConstraint(v1, v2, strength) { 244 new(v1, v2, strength) {
245 this.v1 = v1; 245 this.v1 = v1;
246 this.v2 = v2; 246 this.v2 = v2;
247 this.direction = DeltaBlue$.NONE; 247 this.direction = DeltaBlue$.NONE;
248 super.Constraint(strength); 248 super.new(strength);
249 this.addConstraint(); 249 this.addConstraint();
250 } 250 }
251 chooseMethod(mark) { 251 chooseMethod(mark) {
252 if (this.v1.mark == mark) { 252 if (this.v1.mark == mark) {
253 this.direction = this.v2.mark != mark && dart.notNull(DeltaBlue$.Strengt h.stronger(this.strength, this.v2.walkStrength)) ? DeltaBlue$.FORWARD : DeltaBlu e$.NONE; 253 this.direction = this.v2.mark != mark && dart.notNull(DeltaBlue$.Strengt h.stronger(this.strength, this.v2.walkStrength)) ? DeltaBlue$.FORWARD : DeltaBlu e$.NONE;
254 } 254 }
255 if (this.v2.mark == mark) { 255 if (this.v2.mark == mark) {
256 this.direction = this.v1.mark != mark && dart.notNull(DeltaBlue$.Strengt h.stronger(this.strength, this.v1.walkStrength)) ? DeltaBlue$.BACKWARD : DeltaBl ue$.NONE; 256 this.direction = this.v1.mark != mark && dart.notNull(DeltaBlue$.Strengt h.stronger(this.strength, this.v1.walkStrength)) ? DeltaBlue$.BACKWARD : DeltaBl ue$.NONE;
257 } 257 }
258 if (dart.notNull(DeltaBlue$.Strength.weaker(this.v1.walkStrength, this.v2. walkStrength))) { 258 if (dart.notNull(DeltaBlue$.Strength.weaker(this.v1.walkStrength, this.v2. walkStrength))) {
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 let i = this.input(); 291 let i = this.input();
292 return i.mark == mark || dart.notNull(i.stay) || i.determinedBy == null; 292 return i.mark == mark || dart.notNull(i.stay) || i.determinedBy == null;
293 } 293 }
294 removeFromGraph() { 294 removeFromGraph() {
295 if (this.v1 != null) this.v1.removeConstraint(this); 295 if (this.v1 != null) this.v1.removeConstraint(this);
296 if (this.v2 != null) this.v2.removeConstraint(this); 296 if (this.v2 != null) this.v2.removeConstraint(this);
297 this.direction = DeltaBlue$.NONE; 297 this.direction = DeltaBlue$.NONE;
298 } 298 }
299 }; 299 };
300 dart.setSignature(DeltaBlue$.BinaryConstraint, { 300 dart.setSignature(DeltaBlue$.BinaryConstraint, {
301 constructors: () => ({BinaryConstraint: [DeltaBlue$.BinaryConstraint, [Delta Blue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Strength]]}), 301 constructors: () => ({new: [DeltaBlue$.BinaryConstraint, [DeltaBlue$.Variabl e, DeltaBlue$.Variable, DeltaBlue$.Strength]]}),
302 methods: () => ({ 302 methods: () => ({
303 chooseMethod: [dart.void, [core.int]], 303 chooseMethod: [dart.void, [core.int]],
304 addToGraph: [dart.void, []], 304 addToGraph: [dart.void, []],
305 isSatisfied: [core.bool, []], 305 isSatisfied: [core.bool, []],
306 markInputs: [dart.void, [core.int]], 306 markInputs: [dart.void, [core.int]],
307 input: [DeltaBlue$.Variable, []], 307 input: [DeltaBlue$.Variable, []],
308 output: [DeltaBlue$.Variable, []], 308 output: [DeltaBlue$.Variable, []],
309 recalculate: [dart.void, []], 309 recalculate: [dart.void, []],
310 markUnsatisfied: [dart.void, []], 310 markUnsatisfied: [dart.void, []],
311 inputsKnown: [core.bool, [core.int]], 311 inputsKnown: [core.bool, [core.int]],
312 removeFromGraph: [dart.void, []] 312 removeFromGraph: [dart.void, []]
313 }) 313 })
314 }); 314 });
315 DeltaBlue$.ScaleConstraint = class ScaleConstraint extends DeltaBlue$.BinaryCo nstraint { 315 DeltaBlue$.ScaleConstraint = class ScaleConstraint extends DeltaBlue$.BinaryCo nstraint {
316 ScaleConstraint(src, scale, offset, dest, strength) { 316 new(src, scale, offset, dest, strength) {
317 this.scale = scale; 317 this.scale = scale;
318 this.offset = offset; 318 this.offset = offset;
319 super.BinaryConstraint(src, dest, strength); 319 super.new(src, dest, strength);
320 } 320 }
321 addToGraph() { 321 addToGraph() {
322 super.addToGraph(); 322 super.addToGraph();
323 this.scale.addConstraint(this); 323 this.scale.addConstraint(this);
324 this.offset.addConstraint(this); 324 this.offset.addConstraint(this);
325 } 325 }
326 removeFromGraph() { 326 removeFromGraph() {
327 super.removeFromGraph(); 327 super.removeFromGraph();
328 if (this.scale != null) this.scale.removeConstraint(this); 328 if (this.scale != null) this.scale.removeConstraint(this);
329 if (this.offset != null) this.offset.removeConstraint(this); 329 if (this.offset != null) this.offset.removeConstraint(this);
(...skipping 10 matching lines...) Expand all
340 } 340 }
341 } 341 }
342 recalculate() { 342 recalculate() {
343 let ihn = this.input(), out = this.output(); 343 let ihn = this.input(), out = this.output();
344 out.walkStrength = DeltaBlue$.Strength.weakest(this.strength, ihn.walkStre ngth); 344 out.walkStrength = DeltaBlue$.Strength.weakest(this.strength, ihn.walkStre ngth);
345 out.stay = dart.notNull(ihn.stay) && dart.notNull(this.scale.stay) && dart .notNull(this.offset.stay); 345 out.stay = dart.notNull(ihn.stay) && dart.notNull(this.scale.stay) && dart .notNull(this.offset.stay);
346 if (dart.notNull(out.stay)) this.execute(); 346 if (dart.notNull(out.stay)) this.execute();
347 } 347 }
348 }; 348 };
349 dart.setSignature(DeltaBlue$.ScaleConstraint, { 349 dart.setSignature(DeltaBlue$.ScaleConstraint, {
350 constructors: () => ({ScaleConstraint: [DeltaBlue$.ScaleConstraint, [DeltaBl ue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Variable, Del taBlue$.Strength]]}), 350 constructors: () => ({new: [DeltaBlue$.ScaleConstraint, [DeltaBlue$.Variable , DeltaBlue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Stre ngth]]}),
351 methods: () => ({execute: [dart.void, []]}) 351 methods: () => ({execute: [dart.void, []]})
352 }); 352 });
353 DeltaBlue$.EqualityConstraint = class EqualityConstraint extends DeltaBlue$.Bi naryConstraint { 353 DeltaBlue$.EqualityConstraint = class EqualityConstraint extends DeltaBlue$.Bi naryConstraint {
354 EqualityConstraint(v1, v2, strength) { 354 new(v1, v2, strength) {
355 super.BinaryConstraint(v1, v2, strength); 355 super.new(v1, v2, strength);
356 } 356 }
357 execute() { 357 execute() {
358 this.output().value = this.input().value; 358 this.output().value = this.input().value;
359 } 359 }
360 }; 360 };
361 dart.setSignature(DeltaBlue$.EqualityConstraint, { 361 dart.setSignature(DeltaBlue$.EqualityConstraint, {
362 constructors: () => ({EqualityConstraint: [DeltaBlue$.EqualityConstraint, [D eltaBlue$.Variable, DeltaBlue$.Variable, DeltaBlue$.Strength]]}), 362 constructors: () => ({new: [DeltaBlue$.EqualityConstraint, [DeltaBlue$.Varia ble, DeltaBlue$.Variable, DeltaBlue$.Strength]]}),
363 methods: () => ({execute: [dart.void, []]}) 363 methods: () => ({execute: [dart.void, []]})
364 }); 364 });
365 DeltaBlue$.Variable = class Variable extends core.Object { 365 DeltaBlue$.Variable = class Variable extends core.Object {
366 Variable(name, value) { 366 new(name, value) {
367 this.constraints = dart.list([], DeltaBlue$.Constraint); 367 this.constraints = dart.list([], DeltaBlue$.Constraint);
368 this.name = name; 368 this.name = name;
369 this.value = value; 369 this.value = value;
370 this.determinedBy = null; 370 this.determinedBy = null;
371 this.mark = 0; 371 this.mark = 0;
372 this.walkStrength = DeltaBlue$.WEAKEST; 372 this.walkStrength = DeltaBlue$.WEAKEST;
373 this.stay = true; 373 this.stay = true;
374 } 374 }
375 addConstraint(c) { 375 addConstraint(c) {
376 this.constraints[dartx.add](c); 376 this.constraints[dartx.add](c);
377 } 377 }
378 removeConstraint(c) { 378 removeConstraint(c) {
379 this.constraints[dartx.remove](c); 379 this.constraints[dartx.remove](c);
380 if (dart.equals(this.determinedBy, c)) this.determinedBy = null; 380 if (dart.equals(this.determinedBy, c)) this.determinedBy = null;
381 } 381 }
382 }; 382 };
383 dart.setSignature(DeltaBlue$.Variable, { 383 dart.setSignature(DeltaBlue$.Variable, {
384 constructors: () => ({Variable: [DeltaBlue$.Variable, [core.String, core.int ]]}), 384 constructors: () => ({new: [DeltaBlue$.Variable, [core.String, core.int]]}),
385 methods: () => ({ 385 methods: () => ({
386 addConstraint: [dart.void, [DeltaBlue$.Constraint]], 386 addConstraint: [dart.void, [DeltaBlue$.Constraint]],
387 removeConstraint: [dart.void, [DeltaBlue$.Constraint]] 387 removeConstraint: [dart.void, [DeltaBlue$.Constraint]]
388 }) 388 })
389 }); 389 });
390 DeltaBlue$.Planner = class Planner extends core.Object { 390 DeltaBlue$.Planner = class Planner extends core.Object {
391 Planner() { 391 new() {
392 this.currentMark = 0; 392 this.currentMark = 0;
393 } 393 }
394 incrementalAdd(c) { 394 incrementalAdd(c) {
395 let mark = this.newMark(); 395 let mark = this.newMark();
396 for (let overridden = c.satisfy(mark); overridden != null; overridden = ov erridden.satisfy(mark)) 396 for (let overridden = c.satisfy(mark); overridden != null; overridden = ov erridden.satisfy(mark))
397 ; 397 ;
398 } 398 }
399 incrementalRemove(c) { 399 incrementalRemove(c) {
400 let out = c.output(); 400 let out = c.output();
401 c.markUnsatisfied(); 401 c.markUnsatisfied();
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
485 incrementalRemove: [dart.void, [DeltaBlue$.Constraint]], 485 incrementalRemove: [dart.void, [DeltaBlue$.Constraint]],
486 newMark: [core.int, []], 486 newMark: [core.int, []],
487 makePlan: [DeltaBlue$.Plan, [core.List$(DeltaBlue$.Constraint)]], 487 makePlan: [DeltaBlue$.Plan, [core.List$(DeltaBlue$.Constraint)]],
488 extractPlanFromConstraints: [DeltaBlue$.Plan, [core.List$(DeltaBlue$.Const raint)]], 488 extractPlanFromConstraints: [DeltaBlue$.Plan, [core.List$(DeltaBlue$.Const raint)]],
489 addPropagate: [core.bool, [DeltaBlue$.Constraint, core.int]], 489 addPropagate: [core.bool, [DeltaBlue$.Constraint, core.int]],
490 removePropagateFrom: [core.List$(DeltaBlue$.Constraint), [DeltaBlue$.Varia ble]], 490 removePropagateFrom: [core.List$(DeltaBlue$.Constraint), [DeltaBlue$.Varia ble]],
491 addConstraintsConsumingTo: [dart.void, [DeltaBlue$.Variable, core.List$(De ltaBlue$.Constraint)]] 491 addConstraintsConsumingTo: [dart.void, [DeltaBlue$.Variable, core.List$(De ltaBlue$.Constraint)]]
492 }) 492 })
493 }); 493 });
494 DeltaBlue$.Plan = class Plan extends core.Object { 494 DeltaBlue$.Plan = class Plan extends core.Object {
495 Plan() { 495 new() {
496 this.list = dart.list([], DeltaBlue$.Constraint); 496 this.list = dart.list([], DeltaBlue$.Constraint);
497 } 497 }
498 addConstraint(c) { 498 addConstraint(c) {
499 this.list[dartx.add](c); 499 this.list[dartx.add](c);
500 } 500 }
501 size() { 501 size() {
502 return this.list[dartx.length]; 502 return this.list[dartx.length];
503 } 503 }
504 execute() { 504 execute() {
505 for (let i = 0; i < dart.notNull(this.list[dartx.length]); i++) { 505 for (let i = 0; i < dart.notNull(this.list[dartx.length]); i++) {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 statics: () => ({ 598 statics: () => ({
599 equals: [dart.void, [dart.dynamic, dart.dynamic]], 599 equals: [dart.void, [dart.dynamic, dart.dynamic]],
600 listEquals: [dart.void, [core.List, core.List]] 600 listEquals: [dart.void, [core.List, core.List]]
601 }), 601 }),
602 names: ['equals', 'listEquals'] 602 names: ['equals', 'listEquals']
603 }); 603 });
604 // Exports: 604 // Exports:
605 exports.DeltaBlue = DeltaBlue$; 605 exports.DeltaBlue = DeltaBlue$;
606 exports.BenchmarkBase = BenchmarkBase$; 606 exports.BenchmarkBase = BenchmarkBase$;
607 }); 607 });
OLDNEW
« no previous file with comments | « test/codegen/expect/BenchmarkBase.js ('k') | test/codegen/expect/cascade.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698