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

Side by Side Diff: dart/frog/leg/emitter.dart

Issue 9419009: Use shared implementation of Stopwatch. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: address review comments Created 8 years, 10 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
« no previous file with comments | « dart/frog/leg/elements/elements.dart ('k') | dart/frog/leg/lib/clock.dart » ('j') | 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 /** 5 /**
6 * Generates the code for all used classes in the program. Static fields (even 6 * Generates the code for all used classes in the program. Static fields (even
7 * in classes) are ignored, since they can be treated as non-class elements. 7 * in classes) are ignored, since they can be treated as non-class elements.
8 * 8 *
9 * The code for the containing (used) methods must exist in the [:universe:]. 9 * The code for the containing (used) methods must exist in the [:universe:].
10 */ 10 */
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 for (Element member in classElement.backendMembers) { 232 for (Element member in classElement.backendMembers) {
233 if (member.isInstanceMember()) { 233 if (member.isInstanceMember()) {
234 addInstanceMember(member, prototype, buffer); 234 addInstanceMember(member, prototype, buffer);
235 } 235 }
236 } 236 }
237 buffer.add('$prototype.${namer.operatorIs(classElement)} = true;\n'); 237 buffer.add('$prototype.${namer.operatorIs(classElement)} = true;\n');
238 for (Type ifc in classElement.interfaces) { 238 for (Type ifc in classElement.interfaces) {
239 buffer.add('$prototype.${namer.operatorIs(ifc.element)} = true;\n'); 239 buffer.add('$prototype.${namer.operatorIs(ifc.element)} = true;\n');
240 } 240 }
241 if (superclass === null) {
242 // JS "toString" wrapper. This gives better exceptions.
243 buffer.add('$prototype.toString = function() {\n');
244 buffer.add(' try {');
245 buffer.add(' return ${namer.CURRENT_ISOLATE}');
246 buffer.add('.builtin\$toString\$0\$1(this);');
247 buffer.add(' } catch (ex) {');
248 buffer.add(' return "uncaught exception in toString";');
249 buffer.add(' }');
250 buffer.add('};\n');
251 }
241 } 252 }
242 253
243 void emitClasses(StringBuffer buffer) { 254 void emitClasses(StringBuffer buffer) {
244 Set seenClasses = new Set<ClassElement>(); 255 Set seenClasses = new Set<ClassElement>();
245 for (ClassElement element in compiler.universe.instantiatedClasses) { 256 for (ClassElement element in compiler.universe.instantiatedClasses) {
246 generateClass(element, buffer, seenClasses); 257 generateClass(element, buffer, seenClasses);
247 } 258 }
248 } 259 }
249 260
250 void emitStaticFunctionsWithNamer(StringBuffer buffer, 261 void emitStaticFunctionsWithNamer(StringBuffer buffer,
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 emitDynamicFunctionGetters(buffer); 476 emitDynamicFunctionGetters(buffer);
466 emitStaticFinalFieldInitializations(buffer); 477 emitStaticFinalFieldInitializations(buffer);
467 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 478 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
468 Element main = compiler.mainApp.find(Compiler.MAIN); 479 Element main = compiler.mainApp.find(Compiler.MAIN);
469 buffer.add('${namer.isolateAccess(main)}();\n'); 480 buffer.add('${namer.isolateAccess(main)}();\n');
470 compiler.assembledCode = buffer.toString(); 481 compiler.assembledCode = buffer.toString();
471 }); 482 });
472 return compiler.assembledCode; 483 return compiler.assembledCode;
473 } 484 }
474 } 485 }
OLDNEW
« no previous file with comments | « dart/frog/leg/elements/elements.dart ('k') | dart/frog/leg/lib/clock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698