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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 108553006: Dummy receiver optimization (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add DummyReceiverConstant 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) 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 */ 9 */
10 class Namer implements ClosureNamer { 10 class Namer implements ClosureNamer {
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 DartType type = constant.representedType; 1174 DartType type = constant.representedType;
1175 JavaScriptBackend backend = compiler.backend; 1175 JavaScriptBackend backend = compiler.backend;
1176 String name = backend.rti.getRawTypeRepresentation(type); 1176 String name = backend.rti.getRawTypeRepresentation(type);
1177 addIdentifier(name); 1177 addIdentifier(name);
1178 } 1178 }
1179 1179
1180 visitInterceptor(InterceptorConstant constant) { 1180 visitInterceptor(InterceptorConstant constant) {
1181 addRoot(constant.dispatchedType.element.name); 1181 addRoot(constant.dispatchedType.element.name);
1182 add('methods'); 1182 add('methods');
1183 } 1183 }
1184
1185 visitDummyReceiver(DummyReceiverConstant constant) {
1186 add('dummy_receiver');
1187 }
1184 } 1188 }
1185 1189
1186 /** 1190 /**
1187 * Generates canonical hash values for [Constant]s. 1191 * Generates canonical hash values for [Constant]s.
1188 * 1192 *
1189 * Unfortunately, [Constant.hashCode] is not stable under minor perturbations, 1193 * Unfortunately, [Constant.hashCode] is not stable under minor perturbations,
1190 * so it can't be used for generating names. This hasher keeps consistency 1194 * so it can't be used for generating names. This hasher keeps consistency
1191 * between runs by basing hash values of the names of elements, rather than 1195 * between runs by basing hash values of the names of elements, rather than
1192 * their hashCodes. 1196 * their hashCodes.
1193 */ 1197 */
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
1382 if (!first) { 1386 if (!first) {
1383 sb.write('_'); 1387 sb.write('_');
1384 } 1388 }
1385 sb.write('_'); 1389 sb.write('_');
1386 visit(link.head); 1390 visit(link.head);
1387 first = true; 1391 first = true;
1388 } 1392 }
1389 } 1393 }
1390 } 1394 }
1391 } 1395 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698