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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart

Issue 102833009: Redo "Dummy receiver optimization" (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years 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 part of dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 /** 7 /**
8 * Generates the code for all used classes in the program. Static fields (even 8 * Generates the code for all used classes in the program. Static fields (even
9 * in classes) are ignored, since they can be treated as non-class elements. 9 * in classes) are ignored, since they can be treated as non-class elements.
10 * 10 *
(...skipping 891 matching lines...) Expand 10 before | Expand all | Expand 10 after
902 CodeBuffer buffer = bufferForConstant(constant, eagerBuffer); 902 CodeBuffer buffer = bufferForConstant(constant, eagerBuffer);
903 jsAst.Expression init = js( 903 jsAst.Expression init = js(
904 '${namer.globalObjectForConstant(constant)}.$name = #', 904 '${namer.globalObjectForConstant(constant)}.$name = #',
905 constantInitializerExpression(constant)); 905 constantInitializerExpression(constant));
906 buffer.write(jsAst.prettyPrint(init, compiler)); 906 buffer.write(jsAst.prettyPrint(init, compiler));
907 buffer.write('$N'); 907 buffer.write('$N');
908 } 908 }
909 } 909 }
910 910
911 bool isConstantInlinedOrAlreadyEmitted(Constant constant) { 911 bool isConstantInlinedOrAlreadyEmitted(Constant constant) {
912 if (constant.isFunction()) return true; // Already emitted. 912 if (constant.isFunction()) return true; // Already emitted.
913 if (constant.isPrimitive()) return true; // Inlined. 913 if (constant.isPrimitive()) return true; // Inlined.
914 if (constant.isDummyReceiver()) return true; // Inlined.
914 // The name is null when the constant is already a JS constant. 915 // The name is null when the constant is already a JS constant.
915 // TODO(floitsch): every constant should be registered, so that we can 916 // TODO(floitsch): every constant should be registered, so that we can
916 // share the ones that take up too much space (like some strings). 917 // share the ones that take up too much space (like some strings).
917 if (namer.constantName(constant) == null) return true; 918 if (namer.constantName(constant) == null) return true;
918 return false; 919 return false;
919 } 920 }
920 921
921 int compareConstants(Constant a, Constant b) { 922 int compareConstants(Constant a, Constant b) {
922 // Inlined constants don't affect the order and sometimes don't even have 923 // Inlined constants don't affect the order and sometimes don't even have
923 // names. 924 // names.
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after
1597 } 1598 }
1598 1599
1599 bool get areAnyElementsDeferred { 1600 bool get areAnyElementsDeferred {
1600 return compiler.deferredLoadTask.areAnyElementsDeferred; 1601 return compiler.deferredLoadTask.areAnyElementsDeferred;
1601 } 1602 }
1602 1603
1603 void registerReadTypeVariable(TypeVariableElement element) { 1604 void registerReadTypeVariable(TypeVariableElement element) {
1604 readTypeVariables.add(element); 1605 readTypeVariables.add(element);
1605 } 1606 }
1606 } 1607 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698