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

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

Issue 9355031: Improve List implementation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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
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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 // } 324 // }
325 325
326 // TODO(floitsch): share the closure classes with other classes 326 // TODO(floitsch): share the closure classes with other classes
327 // if they share methods with the same signature. 327 // if they share methods with the same signature.
328 328
329 // The closure class. 329 // The closure class.
330 SourceString name = const SourceString("BoundClosure"); 330 SourceString name = const SourceString("BoundClosure");
331 CompilationUnitElement compilationUnit = member.getCompilationUnit(); 331 CompilationUnitElement compilationUnit = member.getCompilationUnit();
332 ClassElement closureClassElement = new ClassElement(name, compilationUnit); 332 ClassElement closureClassElement = new ClassElement(name, compilationUnit);
333 String isolateAccess = namer.isolatePropertyAccess(closureClassElement); 333 String isolateAccess = namer.isolatePropertyAccess(closureClassElement);
334 buffer.add("$isolateAccess = function(self) { this.self = self; };\n"); 334 buffer.add("$isolateAccess = function $name(self) ");
335 buffer.add("{ this.self = self; };\n");
336 addInheritFunctionIfNecessary(buffer);
kasperl 2012/02/21 07:16:43 Maybe add a comment here that explains that you're
ahe 2012/02/21 23:03:25 Done.
337 ClassElement objectClass =
338 compiler.coreLibrary.find(const SourceString('Object'));
339 String superName = namer.isolatePropertyAccess(objectClass);
340 buffer.add('${inheritsName}($isolateAccess, $superName);\n');
kasperl 2012/02/21 07:16:43 Less indentation.
ahe 2012/02/21 23:03:25 Done.
341
335 String prototype = "$isolateAccess.prototype"; 342 String prototype = "$isolateAccess.prototype";
336 343
337 // Now add the methods on the closure class. The instance method does not 344 // Now add the methods on the closure class. The instance method does not
338 // have the correct name. Since [addParameterStubs] use the name to create 345 // have the correct name. Since [addParameterStubs] use the name to create
339 // its stubs we simply create a fake element with the correct name. 346 // its stubs we simply create a fake element with the correct name.
340 // Note: the callElement will not have the correct modifiers (in case 347 // Note: the callElement will not have the correct modifiers (in case
341 // of static functions) and will not have any enclosingElement. 348 // of static functions) and will not have any enclosingElement.
342 FunctionElement callElement = 349 FunctionElement callElement =
343 new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME, member, null); 350 new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME, member, null);
344 351
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
531 emitCallStubForGetters(buffer); 538 emitCallStubForGetters(buffer);
532 emitStaticFinalFieldInitializations(buffer); 539 emitStaticFinalFieldInitializations(buffer);
533 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n'); 540 buffer.add('var ${namer.CURRENT_ISOLATE} = new ${namer.ISOLATE}();\n');
534 Element main = compiler.mainApp.find(Compiler.MAIN); 541 Element main = compiler.mainApp.find(Compiler.MAIN);
535 buffer.add('${namer.isolateAccess(main)}();\n'); 542 buffer.add('${namer.isolateAccess(main)}();\n');
536 compiler.assembledCode = buffer.toString(); 543 compiler.assembledCode = buffer.toString();
537 }); 544 });
538 return compiler.assembledCode; 545 return compiler.assembledCode;
539 } 546 }
540 } 547 }
OLDNEW
« no previous file with comments | « dart/frog/frog.py ('k') | dart/frog/leg/lib/core.dart » ('j') | dart/frog/leg/lib/js_helper.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698