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

Side by Side Diff: frog/world.dart

Issue 8463027: Optimize boolean asserts (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: co19 status Created 9 years, 1 month 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
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 /** The one true [World]. */ 5 /** The one true [World]. */
6 World world; 6 World world;
7 7
8 /** 8 /**
9 * Should be called exactly once to setup singleton world. 9 * Should be called exactly once to setup singleton world.
10 * Can use world.reset() to reinitialize. 10 * Can use world.reset() to reinitialize.
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 DefinedType objectType; 93 DefinedType objectType;
94 DefinedType numType; 94 DefinedType numType;
95 DefinedType intType; 95 DefinedType intType;
96 DefinedType doubleType; 96 DefinedType doubleType;
97 DefinedType boolType; 97 DefinedType boolType;
98 DefinedType stringType; 98 DefinedType stringType;
99 DefinedType listType; 99 DefinedType listType;
100 DefinedType mapType; 100 DefinedType mapType;
101 DefinedType functionType; 101 DefinedType functionType;
102 102
103 NonNullableType nonNullBool;
104
103 World(this.files) 105 World(this.files)
104 : libraries = {}, _todo = [], _members = {}, _topNames = {}, 106 : libraries = {}, _todo = [], _members = {}, _topNames = {},
105 // TODO(jmesserly): these two types don't actually back our Date and 107 // TODO(jmesserly): these two types don't actually back our Date and
106 // RegExp yet, so we need to add them manually. 108 // RegExp yet, so we need to add them manually.
107 reader = new LibraryReader() { 109 reader = new LibraryReader() {
108 } 110 }
109 111
110 void reset() { 112 void reset() {
111 // TODO(jimhug): Use a smaller hammer in the future. 113 // TODO(jimhug): Use a smaller hammer in the future.
112 libraries = {}; _todo = []; _members = {}; _topNames = {}; 114 libraries = {}; _todo = []; _members = {}; _topNames = {};
(...skipping 14 matching lines...) Expand all
127 129
128 objectType = _addToCoreLib('Object', true); 130 objectType = _addToCoreLib('Object', true);
129 numType = _addToCoreLib('num', false); 131 numType = _addToCoreLib('num', false);
130 intType = _addToCoreLib('int', false); 132 intType = _addToCoreLib('int', false);
131 doubleType = _addToCoreLib('double', false); 133 doubleType = _addToCoreLib('double', false);
132 boolType = _addToCoreLib('bool', false); 134 boolType = _addToCoreLib('bool', false);
133 stringType = _addToCoreLib('String', false); 135 stringType = _addToCoreLib('String', false);
134 listType = _addToCoreLib('List', false); 136 listType = _addToCoreLib('List', false);
135 mapType = _addToCoreLib('Map', false); 137 mapType = _addToCoreLib('Map', false);
136 functionType = _addToCoreLib('Function', false); 138 functionType = _addToCoreLib('Function', false);
139
140 nonNullBool = new NonNullableType(boolType);
137 } 141 }
138 142
139 _addMember(Member member) { 143 _addMember(Member member) {
140 // Private members are only visible in their own library. 144 // Private members are only visible in their own library.
141 assert(!member.isPrivate); 145 assert(!member.isPrivate);
142 if (member.isStatic) { 146 if (member.isStatic) {
143 if (member.declaringType.isTop) { 147 if (member.declaringType.isTop) {
144 _addTopName(member); 148 _addTopName(member);
145 } 149 }
146 return; 150 return;
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 438
435 withTiming(String name, f()) { 439 withTiming(String name, f()) {
436 final sw = new StopWatch(); 440 final sw = new StopWatch();
437 sw.start(); 441 sw.start();
438 var result = f(); 442 var result = f();
439 sw.stop(); 443 sw.stop();
440 info('$name in ${sw.elapsedInMs()}msec'); 444 info('$name in ${sw.elapsedInMs()}msec');
441 return result; 445 return result;
442 } 446 }
443 } 447 }
OLDNEW
« frog/value.dart ('K') | « frog/value.dart ('k') | tests/co19/co19-frog.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698