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

Side by Side Diff: lib/compiler/implementation/namer.dart

Issue 10052020: Reduce size by emitting $.foo instead of Isolate.prototype.foo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 8 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 /** 5 /**
6 * Assigns JavaScript identifiers to Dart variables, class-names and members. 6 * Assigns JavaScript identifiers to Dart variables, class-names and members.
7 */ 7 */
8 class Namer { 8 class Namer {
9 final Compiler compiler; 9 final Compiler compiler;
10 10
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 } 189 }
190 190
191 String isolateAccess(Element element) { 191 String isolateAccess(Element element) {
192 return "$CURRENT_ISOLATE.${getName(element)}"; 192 return "$CURRENT_ISOLATE.${getName(element)}";
193 } 193 }
194 194
195 String isolatePropertyAccess(Element element) { 195 String isolatePropertyAccess(Element element) {
196 return "$ISOLATE.prototype.${getName(element)}"; 196 return "$ISOLATE.prototype.${getName(element)}";
197 } 197 }
198 198
199 String isolateBailoutPropertyAccess(Element element) {
200 return '${isolatePropertyAccess(element)}\$bailout';
201 }
202
203 String isolateBailoutAccess(Element element) { 199 String isolateBailoutAccess(Element element) {
204 return '${isolateAccess(element)}\$bailout'; 200 return '${isolateAccess(element)}\$bailout';
205 } 201 }
206 202
207 String operatorIs(Element element) { 203 String operatorIs(Element element) {
208 return 'is\$${getName(element)}'; 204 return 'is\$${getName(element)}';
209 } 205 }
210 206
211 String safeName(String name) { 207 String safeName(String name) {
212 if (jsReserved.contains(name) || name.startsWith('\$')) { 208 if (jsReserved.contains(name) || name.startsWith('\$')) {
213 name = "\$$name"; 209 name = "\$$name";
214 assert(!jsReserved.contains(name)); 210 assert(!jsReserved.contains(name));
215 } 211 }
216 return name; 212 return name;
217 } 213 }
218 } 214 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/compiler/implementation/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698