OLD | NEW |
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; |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // if (a0 >>> 0 === a0 && a0 < receiver.length) { | 241 // if (a0 >>> 0 === a0 && a0 < receiver.length) { |
242 // return receiver[a0] = a1; | 242 // return receiver[a0] = a1; |
243 // } | 243 // } |
244 // } | 244 // } |
245 // } | 245 // } |
246 bool containsArray = classes.contains(helpers.jsArrayClass); | 246 bool containsArray = classes.contains(helpers.jsArrayClass); |
247 bool containsString = classes.contains(helpers.jsStringClass); | 247 bool containsString = classes.contains(helpers.jsStringClass); |
248 bool containsJsIndexable = | 248 bool containsJsIndexable = |
249 helpers.jsIndexingBehaviorInterface.isResolved && | 249 helpers.jsIndexingBehaviorInterface.isResolved && |
250 classes.any((cls) { | 250 classes.any((cls) { |
251 return compiler.world | 251 return compiler.closedWorld |
252 .isSubtypeOf(cls, helpers.jsIndexingBehaviorInterface); | 252 .isSubtypeOf(cls, helpers.jsIndexingBehaviorInterface); |
253 }); | 253 }); |
254 // The index set operator requires a check on its set value in | 254 // The index set operator requires a check on its set value in |
255 // checked mode, so we don't optimize the interceptor if the | 255 // checked mode, so we don't optimize the interceptor if the |
256 // compiler has type assertions enabled. | 256 // compiler has type assertions enabled. |
257 if (selector.isIndexSet && | 257 if (selector.isIndexSet && |
258 (compiler.options.enableTypeAssertions || !containsArray)) { | 258 (compiler.options.enableTypeAssertions || !containsArray)) { |
259 return null; | 259 return null; |
260 } | 260 } |
261 if (!containsArray && !containsString) { | 261 if (!containsArray && !containsString) { |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 | 390 |
391 var map = new jsAst.ObjectInitializer(properties); | 391 var map = new jsAst.ObjectInitializer(properties); |
392 elements.add(map); | 392 elements.add(map); |
393 } | 393 } |
394 } | 394 } |
395 } | 395 } |
396 | 396 |
397 return new jsAst.ArrayInitializer(elements); | 397 return new jsAst.ArrayInitializer(elements); |
398 } | 398 } |
399 } | 399 } |
OLD | NEW |