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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart

Issue 2680823002: Extract InterceptorData from JavaScriptBackend. (Closed)
Patch Set: Updated cf. comments Created 3 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dart2js.js_emitter.full_emitter.nsm_emitter; 5 library dart2js.js_emitter.full_emitter.nsm_emitter;
6 6
7 import '../../elements/entities.dart'; 7 import '../../elements/entities.dart';
8 import '../../js/js.dart' as jsAst; 8 import '../../js/js.dart' as jsAst;
9 import '../../js/js.dart' show js; 9 import '../../js/js.dart' show js;
10 import '../../js_backend/js_backend.dart' show GetterName, SetterName; 10 import '../../js_backend/js_backend.dart' show GetterName, SetterName;
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 */ 135 */
136 List<jsAst.Statement> buildTrivialNsmHandlers() { 136 List<jsAst.Statement> buildTrivialNsmHandlers() {
137 List<jsAst.Statement> statements = <jsAst.Statement>[]; 137 List<jsAst.Statement> statements = <jsAst.Statement>[];
138 if (trivialNsmHandlers.length == 0) return statements; 138 if (trivialNsmHandlers.length == 0) return statements;
139 139
140 bool minify = compiler.options.enableMinification; 140 bool minify = compiler.options.enableMinification;
141 bool useDiffEncoding = minify && trivialNsmHandlers.length > 30; 141 bool useDiffEncoding = minify && trivialNsmHandlers.length > 30;
142 142
143 // Find out how many selectors there are with the special calling 143 // Find out how many selectors there are with the special calling
144 // convention. 144 // convention.
145 Iterable<Selector> interceptedSelectors = trivialNsmHandlers 145 Iterable<Selector> interceptedSelectors = trivialNsmHandlers.where(
146 .where((Selector s) => backend.isInterceptedName(s.name)); 146 (Selector s) => backend.interceptorData.isInterceptedName(s.name));
147 Iterable<Selector> ordinarySelectors = trivialNsmHandlers 147 Iterable<Selector> ordinarySelectors = trivialNsmHandlers.where(
148 .where((Selector s) => !backend.isInterceptedName(s.name)); 148 (Selector s) => !backend.interceptorData.isInterceptedName(s.name));
149 149
150 // Get the short names (JS names, perhaps minified). 150 // Get the short names (JS names, perhaps minified).
151 Iterable<jsAst.Name> interceptedShorts = 151 Iterable<jsAst.Name> interceptedShorts =
152 interceptedSelectors.map(namer.invocationMirrorInternalName); 152 interceptedSelectors.map(namer.invocationMirrorInternalName);
153 Iterable<jsAst.Name> ordinaryShorts = 153 Iterable<jsAst.Name> ordinaryShorts =
154 ordinarySelectors.map(namer.invocationMirrorInternalName); 154 ordinarySelectors.map(namer.invocationMirrorInternalName);
155 155
156 jsAst.Expression sortedShorts; 156 jsAst.Expression sortedShorts;
157 Iterable<String> sortedLongs; 157 Iterable<String> sortedLongs;
158 if (useDiffEncoding) { 158 if (useDiffEncoding) {
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 } 403 }
404 404
405 String get value { 405 String get value {
406 if (_cachedValue == null) { 406 if (_cachedValue == null) {
407 _cachedValue = _computeDiffEncoding(); 407 _cachedValue = _computeDiffEncoding();
408 } 408 }
409 409
410 return _cachedValue; 410 return _cachedValue;
411 } 411 }
412 } 412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698