| 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 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 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 // If we need fewer than this many noSuchMethod handlers we can save space by | 29 // If we need fewer than this many noSuchMethod handlers we can save space by |
| 30 // just emitting them in JS, rather than emitting the JS needed to generate | 30 // just emitting them in JS, rather than emitting the JS needed to generate |
| 31 // them at run time. | 31 // them at run time. |
| 32 static const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10; | 32 static const VERY_FEW_NO_SUCH_METHOD_HANDLERS = 10; |
| 33 | 33 |
| 34 static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4; | 34 static const MAX_MINIFIED_LENGTH_FOR_DIFF_ENCODING = 4; |
| 35 | 35 |
| 36 void emitNoSuchMethodHandlers(AddPropertyFunction addProperty) { | 36 void emitNoSuchMethodHandlers(AddPropertyFunction addProperty) { |
| 37 ClassStubGenerator generator = new ClassStubGenerator( | 37 ClassStubGenerator generator = new ClassStubGenerator( |
| 38 namer, backend, codegenWorldBuilder, closedWorld, | 38 task.emitter, |
| 39 compiler.commonElements, |
| 40 namer, |
| 41 codegenWorldBuilder, |
| 42 backend.interceptorData, |
| 43 closedWorld, |
| 39 enableMinification: compiler.options.enableMinification); | 44 enableMinification: compiler.options.enableMinification); |
| 40 | 45 |
| 41 // Keep track of the JavaScript names we've already added so we | 46 // Keep track of the JavaScript names we've already added so we |
| 42 // do not introduce duplicates (bad for code size). | 47 // do not introduce duplicates (bad for code size). |
| 43 Map<jsAst.Name, Selector> addedJsNames = | 48 Map<jsAst.Name, Selector> addedJsNames = |
| 44 generator.computeSelectorsForNsmHandlers(); | 49 generator.computeSelectorsForNsmHandlers(); |
| 45 | 50 |
| 46 // Set flag used by generateMethod helper below. If we have very few | 51 // Set flag used by generateMethod helper below. If we have very few |
| 47 // handlers we use addProperty for them all, rather than try to generate | 52 // handlers we use addProperty for them all, rather than try to generate |
| 48 // them at runtime. | 53 // them at runtime. |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 403 } | 408 } |
| 404 | 409 |
| 405 String get value { | 410 String get value { |
| 406 if (_cachedValue == null) { | 411 if (_cachedValue == null) { |
| 407 _cachedValue = _computeDiffEncoding(); | 412 _cachedValue = _computeDiffEncoding(); |
| 408 } | 413 } |
| 409 | 414 |
| 410 return _cachedValue; | 415 return _cachedValue; |
| 411 } | 416 } |
| 412 } | 417 } |
| OLD | NEW |