| OLD | NEW |
| 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 part of dart2js.js_emitter.full_emitter; | 5 part of dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 class NsmEmitter extends CodeEmitterHelper { | 7 class NsmEmitter extends CodeEmitterHelper { |
| 8 final List<Selector> trivialNsmHandlers = <Selector>[]; | 8 final List<Selector> trivialNsmHandlers = <Selector>[]; |
| 9 | 9 |
| 10 /// If this is true then we can generate the noSuchMethod handlers at startup | 10 /// If this is true then we can generate the noSuchMethod handlers at startup |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 * decoding the base 88 numbers would overflow JavaScript's puny integers. | 115 * decoding the base 88 numbers would overflow JavaScript's puny integers. |
| 116 * | 116 * |
| 117 * There are some selectors that have a special calling convention (because | 117 * There are some selectors that have a special calling convention (because |
| 118 * they are called with the receiver as the first argument). They need a | 118 * they are called with the receiver as the first argument). They need a |
| 119 * slightly different noSuchMethod handler, so we handle these first. | 119 * slightly different noSuchMethod handler, so we handle these first. |
| 120 */ | 120 */ |
| 121 List<jsAst.Statement> buildTrivialNsmHandlers() { | 121 List<jsAst.Statement> buildTrivialNsmHandlers() { |
| 122 List<jsAst.Statement> statements = <jsAst.Statement>[]; | 122 List<jsAst.Statement> statements = <jsAst.Statement>[]; |
| 123 if (trivialNsmHandlers.length == 0) return statements; | 123 if (trivialNsmHandlers.length == 0) return statements; |
| 124 | 124 |
| 125 bool minify = compiler.enableMinification; | 125 bool minify = compiler.options.enableMinification; |
| 126 bool useDiffEncoding = minify && trivialNsmHandlers.length > 30; | 126 bool useDiffEncoding = minify && trivialNsmHandlers.length > 30; |
| 127 | 127 |
| 128 // Find out how many selectors there are with the special calling | 128 // Find out how many selectors there are with the special calling |
| 129 // convention. | 129 // convention. |
| 130 Iterable<Selector> interceptedSelectors = trivialNsmHandlers.where( | 130 Iterable<Selector> interceptedSelectors = trivialNsmHandlers.where( |
| 131 (Selector s) => backend.isInterceptedName(s.name)); | 131 (Selector s) => backend.isInterceptedName(s.name)); |
| 132 Iterable<Selector> ordinarySelectors = trivialNsmHandlers.where( | 132 Iterable<Selector> ordinarySelectors = trivialNsmHandlers.where( |
| 133 (Selector s) => !backend.isInterceptedName(s.name)); | 133 (Selector s) => !backend.isInterceptedName(s.name)); |
| 134 | 134 |
| 135 // Get the short names (JS names, perhaps minified). | 135 // Get the short names (JS names, perhaps minified). |
| (...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 } | 382 } |
| 383 | 383 |
| 384 String get value { | 384 String get value { |
| 385 if (_cachedValue == null) { | 385 if (_cachedValue == null) { |
| 386 _cachedValue = _computeDiffEncoding(); | 386 _cachedValue = _computeDiffEncoding(); |
| 387 } | 387 } |
| 388 | 388 |
| 389 return _cachedValue; | 389 return _cachedValue; |
| 390 } | 390 } |
| 391 } | 391 } |
| OLD | NEW |