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

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

Issue 1145283002: Use short array syntax in method signatures (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Address comments Created 5 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/browser/runtime_tests.js ('k') | test/codegen/expect/DeltaBlue.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 var BenchmarkBase = dart.defineLibrary(BenchmarkBase, {}); 1 var BenchmarkBase = dart.defineLibrary(BenchmarkBase, {});
2 var core = dart.import(core); 2 var core = dart.import(core);
3 (function(exports, core) { 3 (function(exports, core) {
4 'use strict'; 4 'use strict';
5 class Expect extends core.Object { 5 class Expect extends core.Object {
6 static equals(expected, actual) { 6 static equals(expected, actual) {
7 if (!dart.equals(expected, actual)) { 7 if (!dart.equals(expected, actual)) {
8 throw `Values not equal: ${expected} vs ${actual}`; 8 throw `Values not equal: ${expected} vs ${actual}`;
9 } 9 }
10 } 10 }
11 static listEquals(expected, actual) { 11 static listEquals(expected, actual) {
12 if (expected[core.$length] != actual[core.$length]) { 12 if (expected[core.$length] != actual[core.$length]) {
13 throw `Lists have different lengths: ${expected[core.$length]} vs ${actu al[core.$length]}`; 13 throw `Lists have different lengths: ${expected[core.$length]} vs ${actu al[core.$length]}`;
14 } 14 }
15 for (let i = 0; dart.notNull(i) < dart.notNull(actual[core.$length]); i = dart.notNull(i) + 1) { 15 for (let i = 0; dart.notNull(i) < dart.notNull(actual[core.$length]); i = dart.notNull(i) + 1) {
16 Expect.equals(expected[core.$get](i), actual[core.$get](i)); 16 Expect.equals(expected[core.$get](i), actual[core.$get](i));
17 } 17 }
18 } 18 }
19 fail(message) { 19 fail(message) {
20 throw message; 20 throw message;
21 } 21 }
22 } 22 }
23 dart.setSignature(Expect, { 23 dart.setSignature(Expect, {
24 methods: () => ({fail: dart.functionType(dart.dynamic, [dart.dynamic])}), 24 methods: () => ({fail: [dart.dynamic, [dart.dynamic]]}),
25 statics: () => ({ 25 statics: () => ({
26 equals: dart.functionType(dart.void, [dart.dynamic, dart.dynamic]), 26 equals: [dart.void, [dart.dynamic, dart.dynamic]],
27 listEquals: dart.functionType(dart.void, [core.List, core.List]) 27 listEquals: [dart.void, [core.List, core.List]]
28 }), 28 }),
29 names: ['equals', 'listEquals'] 29 names: ['equals', 'listEquals']
30 }); 30 });
31 class BenchmarkBase extends core.Object { 31 class BenchmarkBase extends core.Object {
32 BenchmarkBase(name) { 32 BenchmarkBase(name) {
33 this.name = name; 33 this.name = name;
34 } 34 }
35 run() {} 35 run() {}
36 warmup() { 36 warmup() {
37 this.run(); 37 this.run();
(...skipping 29 matching lines...) Expand all
67 this.teardown(); 67 this.teardown();
68 return result; 68 return result;
69 } 69 }
70 report() { 70 report() {
71 let score = this.measure(); 71 let score = this.measure();
72 core.print(`${this.name}(RunTime): ${score} us.`); 72 core.print(`${this.name}(RunTime): ${score} us.`);
73 } 73 }
74 } 74 }
75 dart.setSignature(BenchmarkBase, { 75 dart.setSignature(BenchmarkBase, {
76 methods: () => ({ 76 methods: () => ({
77 run: dart.functionType(dart.void, []), 77 run: [dart.void, []],
78 warmup: dart.functionType(dart.void, []), 78 warmup: [dart.void, []],
79 exercise: dart.functionType(dart.void, []), 79 exercise: [dart.void, []],
80 setup: dart.functionType(dart.void, []), 80 setup: [dart.void, []],
81 teardown: dart.functionType(dart.void, []), 81 teardown: [dart.void, []],
82 measure: dart.functionType(core.double, []), 82 measure: [core.double, []],
83 report: dart.functionType(dart.void, []) 83 report: [dart.void, []]
84 }), 84 }),
85 statics: () => ({measureFor: dart.functionType(core.double, [core.Function, core.int])}), 85 statics: () => ({measureFor: [core.double, [core.Function, core.int]]}),
86 names: ['measureFor'] 86 names: ['measureFor']
87 }); 87 });
88 // Exports: 88 // Exports:
89 exports.Expect = Expect; 89 exports.Expect = Expect;
90 exports.BenchmarkBase = BenchmarkBase; 90 exports.BenchmarkBase = BenchmarkBase;
91 })(BenchmarkBase, core); 91 })(BenchmarkBase, core);
OLDNEW
« no previous file with comments | « test/browser/runtime_tests.js ('k') | test/codegen/expect/DeltaBlue.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698