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

Side by Side Diff: runtime/vm/snapshot_test.dart

Issue 10883071: - Change "static final" to "static const" in the runtime/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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 | Annotate | Revision Log
« runtime/vm/parser.cc ('K') | « runtime/vm/snapshot_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #import("dart:isolate"); 5 #import("dart:isolate");
6 6
7 class Fields { 7 class Fields {
8 Fields(int i, int j) : fld1 = i, fld2 = j, fld5 = true {} 8 Fields(int i, int j) : fld1 = i, fld2 = j, fld5 = true {}
9 int fld1; 9 int fld1;
10 final int fld2; 10 final int fld2;
11 static int fld3; 11 static int fld3;
12 static final int fld4 = 10; 12 static const int fld4 = 10;
13 bool fld5; 13 bool fld5;
14 } 14 }
15 class FieldsTest { 15 class FieldsTest {
16 static Fields testMain() { 16 static Fields testMain() {
17 Fields obj = new Fields(10, 20); 17 Fields obj = new Fields(10, 20);
18 Expect.equals(10, obj.fld1); 18 Expect.equals(10, obj.fld1);
19 Expect.equals(20, obj.fld2); 19 Expect.equals(20, obj.fld2);
20 Expect.equals(10, Fields.fld4); 20 Expect.equals(10, Fields.fld4);
21 Expect.equals(true, obj.fld5); 21 Expect.equals(true, obj.fld5);
22 return obj; 22 return obj;
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
381 } 381 }
382 382
383 static void main() { 383 static void main() {
384 new SumBenchmark().report(); 384 new SumBenchmark().report();
385 } 385 }
386 } 386 }
387 387
388 388
389 // H e l p e r f u n c t i o n s f o r s o r t s 389 // H e l p e r f u n c t i o n s f o r s o r t s
390 class Random { 390 class Random {
391 static final int INITIAL_SEED = 74755; 391 static const int INITIAL_SEED = 74755;
392 int seed; 392 int seed;
393 Random() : seed = INITIAL_SEED {} 393 Random() : seed = INITIAL_SEED {}
394 394
395 int random() { 395 int random() {
396 seed = ((seed * 1309) + 13849) % 65536; 396 seed = ((seed * 1309) + 13849) % 65536;
397 return seed; 397 return seed;
398 } 398 }
399 } 399 }
400 400
401 // 401 //
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1051 res = (tmp.compareTo(tmp2) > 0); 1051 res = (tmp.compareTo(tmp2) > 0);
1052 } 1052 }
1053 return res; 1053 return res;
1054 } 1054 }
1055 } 1055 }
1056 1056
1057 // Benchmarks basic message communication between two isolates. 1057 // Benchmarks basic message communication between two isolates.
1058 1058
1059 class Benchmark1 { 1059 class Benchmark1 {
1060 1060
1061 static final MESSAGES = 10000; 1061 static const MESSAGES = 10000;
1062 static final INIT_MESSAGE = 0; 1062 static const INIT_MESSAGE = 0;
1063 static final TERMINATION_MESSAGE = -1; 1063 static const TERMINATION_MESSAGE = -1;
1064 static final WARMUP_TIME = 1000; 1064 static const WARMUP_TIME = 1000;
1065 static final RUN_TIME = 1000; 1065 static const RUN_TIME = 1000;
1066 static final RUNS = 5; 1066 static const RUNS = 5;
1067 1067
1068 1068
1069 static int run() { 1069 static int run() {
1070 return _run; 1070 return _run;
1071 } 1071 }
1072 1072
1073 static void add_result(var opsms) { 1073 static void add_result(var opsms) {
1074 _run++; 1074 _run++;
1075 _opsms += opsms; 1075 _opsms += opsms;
1076 } 1076 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 1224
1225 // --------------------------------------------------------------------------- 1225 // ---------------------------------------------------------------------------
1226 // tests/isolate/message_test.dart 1226 // tests/isolate/message_test.dart
1227 // --------------------------------------------------------------------------- 1227 // ---------------------------------------------------------------------------
1228 1228
1229 // --------------------------------------------------------------------------- 1229 // ---------------------------------------------------------------------------
1230 // Message passing test. 1230 // Message passing test.
1231 // --------------------------------------------------------------------------- 1231 // ---------------------------------------------------------------------------
1232 1232
1233 class MessageTest { 1233 class MessageTest {
1234 static final List list1 = const ["Hello", "World", "Hello", 0xfffffffffff]; 1234 static const List list1 = const ["Hello", "World", "Hello", 0xfffffffffff];
1235 static final List list2 = const [null, list1, list1, list1, list1]; 1235 static const List list2 = const [null, list1, list1, list1, list1];
1236 static final List list3 = const [list2, 2.0, true, false, 0xfffffffffff]; 1236 static const List list3 = const [list2, 2.0, true, false, 0xfffffffffff];
1237 static final Map map1 = const { 1237 static const Map map1 = const {
1238 "a=1" : 1, "b=2" : 2, "c=3" : 3, 1238 "a=1" : 1, "b=2" : 2, "c=3" : 3,
1239 }; 1239 };
1240 static final Map map2 = const { 1240 static const Map map2 = const {
1241 "list1" : list1, "list2" : list2, "list3" : list3, 1241 "list1" : list1, "list2" : list2, "list3" : list3,
1242 }; 1242 };
1243 static final List list4 = const [map1, map2]; 1243 static const List list4 = const [map1, map2];
1244 static final List elms = const [ 1244 static const List elms = const [
1245 list1, list2, list3, list4, 1245 list1, list2, list3, list4,
1246 ]; 1246 ];
1247 1247
1248 static void VerifyMap(Map expected, Map actual) { 1248 static void VerifyMap(Map expected, Map actual) {
1249 Expect.equals(true, expected is Map); 1249 Expect.equals(true, expected is Map);
1250 Expect.equals(true, actual is Map); 1250 Expect.equals(true, actual is Map);
1251 Expect.equals(expected.length, actual.length); 1251 Expect.equals(expected.length, actual.length);
1252 testForEachMap(key, value) { 1252 testForEachMap(key, value) {
1253 if (value is List) { 1253 if (value is List) {
1254 VerifyList(value, actual[key]); 1254 VerifyList(value, actual[key]);
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 }, count: 11)); 1415 }, count: 11));
1416 remote.send(count++, reply); 1416 remote.send(count++, reply);
1417 }); 1417 });
1418 } 1418 }
1419 1419
1420 1420
1421 // --------------------------------------------------------------------------- 1421 // ---------------------------------------------------------------------------
1422 // tests/isolate/mandel_isolate_test.dart 1422 // tests/isolate/mandel_isolate_test.dart
1423 // --------------------------------------------------------------------------- 1423 // ---------------------------------------------------------------------------
1424 1424
1425 final TERMINATION_MESSAGE = -1; 1425 const TERMINATION_MESSAGE = -1;
1426 final N = 100; 1426 const N = 100;
1427 final ISOLATES = 20; 1427 const ISOLATES = 20;
1428 1428
1429 mandel_main() { 1429 mandel_main() {
1430 test("Render Mandelbrot in parallel", () { 1430 test("Render Mandelbrot in parallel", () {
1431 final state = new MandelbrotState(); 1431 final state = new MandelbrotState();
1432 state._validated.future.then(expectAsync1((result) { 1432 state._validated.future.then(expectAsync1((result) {
1433 expect(result, isTrue); 1433 expect(result, isTrue);
1434 })); 1434 }));
1435 for (int i = 0; i < Math.min(ISOLATES, N); i++) state.startClient(i); 1435 for (int i = 0; i < Math.min(ISOLATES, N); i++) state.startClient(i);
1436 }); 1436 });
1437 } 1437 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 void processLines() { 1548 void processLines() {
1549 port.receive((message, SendPort replyTo) { 1549 port.receive((message, SendPort replyTo) {
1550 if (message == TERMINATION_MESSAGE) { 1550 if (message == TERMINATION_MESSAGE) {
1551 assert(replyTo == null); 1551 assert(replyTo == null);
1552 port.close(); 1552 port.close();
1553 } else { 1553 } else {
1554 replyTo.send(processLine(message), null); 1554 replyTo.send(processLine(message), null);
1555 } 1555 }
1556 }); 1556 });
1557 } 1557 }
OLDNEW
« runtime/vm/parser.cc ('K') | « runtime/vm/snapshot_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698