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

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

Issue 2568723007: Create Namer and Emitter on codegen start. (Closed)
Patch Set: Small fix. Created 4 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 class InterceptorStubGenerator { 7 class InterceptorStubGenerator {
8 final Compiler compiler; 8 final Compiler compiler;
9 final Namer namer; 9 final Namer namer;
10 final JavaScriptBackend backend; 10 final JavaScriptBackend backend;
11 final ClosedWorld closedWorld;
11 12
12 InterceptorStubGenerator(this.compiler, this.namer, this.backend); 13 InterceptorStubGenerator(
14 this.compiler, this.namer, this.backend, this.closedWorld);
13 15
14 Emitter get emitter => backend.emitter.emitter; 16 Emitter get emitter => backend.emitter.emitter;
15 17
16 BackendHelpers get helpers => backend.helpers; 18 BackendHelpers get helpers => backend.helpers;
17 19
18 jsAst.Expression generateGetInterceptorMethod(Set<ClassElement> classes) { 20 jsAst.Expression generateGetInterceptorMethod(Set<ClassElement> classes) {
19 jsAst.Expression interceptorFor(ClassElement cls) { 21 jsAst.Expression interceptorFor(ClassElement cls) {
20 return backend.emitter.interceptorPrototypeAccess(cls); 22 return backend.emitter.interceptorPrototypeAccess(cls);
21 } 23 }
22 24
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 // if (a0 >>> 0 === a0 && a0 < receiver.length) { 243 // if (a0 >>> 0 === a0 && a0 < receiver.length) {
242 // return receiver[a0] = a1; 244 // return receiver[a0] = a1;
243 // } 245 // }
244 // } 246 // }
245 // } 247 // }
246 bool containsArray = classes.contains(helpers.jsArrayClass); 248 bool containsArray = classes.contains(helpers.jsArrayClass);
247 bool containsString = classes.contains(helpers.jsStringClass); 249 bool containsString = classes.contains(helpers.jsStringClass);
248 bool containsJsIndexable = 250 bool containsJsIndexable =
249 helpers.jsIndexingBehaviorInterface.isResolved && 251 helpers.jsIndexingBehaviorInterface.isResolved &&
250 classes.any((cls) { 252 classes.any((cls) {
251 return compiler.closedWorld 253 return closedWorld.isSubtypeOf(
252 .isSubtypeOf(cls, helpers.jsIndexingBehaviorInterface); 254 cls, helpers.jsIndexingBehaviorInterface);
253 }); 255 });
254 // The index set operator requires a check on its set value in 256 // The index set operator requires a check on its set value in
255 // checked mode, so we don't optimize the interceptor if the 257 // checked mode, so we don't optimize the interceptor if the
256 // compiler has type assertions enabled. 258 // compiler has type assertions enabled.
257 if (selector.isIndexSet && 259 if (selector.isIndexSet &&
258 (compiler.options.enableTypeAssertions || !containsArray)) { 260 (compiler.options.enableTypeAssertions || !containsArray)) {
259 return null; 261 return null;
260 } 262 }
261 if (!containsArray && !containsString) { 263 if (!containsArray && !containsString) {
262 return null; 264 return null;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 392
391 var map = new jsAst.ObjectInitializer(properties); 393 var map = new jsAst.ObjectInitializer(properties);
392 elements.add(map); 394 elements.add(map);
393 } 395 }
394 } 396 }
395 } 397 }
396 398
397 return new jsAst.ArrayInitializer(elements); 399 return new jsAst.ArrayInitializer(elements);
398 } 400 }
399 } 401 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/full_emitter/nsm_emitter.dart ('k') | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698