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

Side by Side Diff: frog/world.dart

Issue 8999030: frog isolate fixes: minor changes to the isolate library + architecture.py (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: '' Created 8 years, 12 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
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 * Experimental phase to enable await, only set when using the 9 * Experimental phase to enable await, only set when using the
10 * await/awaitc.dart entrypoint. 10 * await/awaitc.dart entrypoint.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 // resolve conflicts based on priority 208 // resolve conflicts based on priority
209 int existingPri = existing.jsnamePriority; 209 int existingPri = existing.jsnamePriority;
210 int namedPri = named.jsnamePriority; 210 int namedPri = named.jsnamePriority;
211 if (existingPri > namedPri || namedPri == 0) { 211 if (existingPri > namedPri || namedPri == 0) {
212 // Either existing was higher priority, or they're both 0 so first one 212 // Either existing was higher priority, or they're both 0 so first one
213 // wins. 213 // wins.
214 _renameJavascriptTopName(named); 214 _renameJavascriptTopName(named);
215 } else if (namedPri > existingPri) { 215 } else if (namedPri > existingPri) {
216 // New one takes priority over existing 216 // New one takes priority over existing
217 _renameJavascriptTopName(existing); 217 _renameJavascriptTopName(existing);
218 } else { 218 } else if ((!_isDomWorker(named) || !_isIsolateWorker(existing))
219 && (!_isDomWorker(existing) || !_isIsolateWorker(named))) {
mattsh 2011/12/22 01:55:15 is there a way to simplify this? (Read a few time
Siggi Cherem (dart-lang) 2011/12/22 18:51:15 How about this (not-normalized form is a bit easie
Jennifer Messerly 2011/12/22 19:49:44 How about: } else if (!named.isWebWorker && !exis
219 // Two conflicting native names or names in corelib. Libraries need 220 // Two conflicting native names or names in corelib. Libraries need
220 // to be fixed. 221 // to be fixed. We exclude the case when isolate defines Worker, so that
222 // corelib doesn't depend on the dom lib.
221 world.internalError('conflicting JS name "$name" of same ' 223 world.internalError('conflicting JS name "$name" of same '
222 + 'priority $existingPri: (already defined in) ' 224 + 'priority $existingPri: (already defined in) '
223 + '${existing.span.locationText} with priority $namedPri)', 225 + '${existing.span.locationText} with priority $namedPri)',
224 named.span, existing.span); 226 named.span, existing.span);
225 } 227 }
226 } else { 228 } else {
227 // No one was using the name. Take it for ourselves. 229 // No one was using the name. Take it for ourselves.
228 _topNames[name] = named; 230 _topNames[name] = named;
229 } 231 }
230 } 232 }
231 233
234 /** Whether element is the dom definition of Worker. */
235 _isDomWorker(Element e) {
Jennifer Messerly 2011/12/22 19:49:44 personally I'd put this as a getter on Element. Ev
Siggi Cherem (dart-lang) 2011/12/22 21:17:23 Seems really strange to add this on Element. I don
236 return e.library == dom && e.nativeName == 'Worker';
237 }
238
239 /** Whether element is the isolate (corelib) definition of Worker. */
240 _isIsolateWorker(Element e) {
241 return e.library == coreimpl && e.nativeName == 'Worker';
242 }
243
232 /** Renames an [Element] that had a name conflict in the generated JS. */ 244 /** Renames an [Element] that had a name conflict in the generated JS. */
233 _renameJavascriptTopName(Element named) { 245 _renameJavascriptTopName(Element named) {
234 named._jsname = '${named.library.jsname}_${named.jsname}'; 246 named._jsname = '${named.library.jsname}_${named.jsname}';
235 final existing = _topNames[named.jsname]; 247 final existing = _topNames[named.jsname];
236 if (existing != null && existing != named) { 248 if (existing != null && existing != named) {
237 // If this happens it means the library name wasn't unique enough. 249 // If this happens it means the library name wasn't unique enough.
238 world.internalError('name mangling failed for "${named.jsname}" ' 250 world.internalError('name mangling failed for "${named.jsname}" '
239 + '("${named.jsname}" defined also in ${existing.span.locationText})', 251 + '("${named.jsname}" defined also in ${existing.span.locationText})',
240 named.span); 252 named.span);
241 } 253 }
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 556
545 withTiming(String name, f()) { 557 withTiming(String name, f()) {
546 final sw = new Stopwatch(); 558 final sw = new Stopwatch();
547 sw.start(); 559 sw.start();
548 var result = f(); 560 var result = f();
549 sw.stop(); 561 sw.stop();
550 info('$name in ${sw.elapsedInMs()}msec'); 562 info('$name in ${sw.elapsedInMs()}msec');
551 return result; 563 return result;
552 } 564 }
553 } 565 }
OLDNEW
« frog/lib/isolate.dart ('K') | « frog/minfrog ('k') | tests/isolate/isolate.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698