| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.startup_emitter.model_emitter; | 5 part of dart2js.js_emitter.startup_emitter.model_emitter; |
| 6 | 6 |
| 7 /// The fast startup emitter's goal is to minimize the amount of work that the | 7 /// The fast startup emitter's goal is to minimize the amount of work that the |
| 8 /// JavaScript engine has to do before it can start running user code. | 8 /// JavaScript engine has to do before it can start running user code. |
| 9 /// | 9 /// |
| 10 /// Whenever possible, the emitter uses object literals instead of updating | 10 /// Whenever possible, the emitter uses object literals instead of updating |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 /// // Inheritance is achieved by updating the prototype objects (hidden in | 24 /// // Inheritance is achieved by updating the prototype objects (hidden in |
| 25 /// // a helper function): | 25 /// // a helper function): |
| 26 /// A.Point.prototype.__proto__ = H.Object.prototype; | 26 /// A.Point.prototype.__proto__ = H.Object.prototype; |
| 27 /// | 27 /// |
| 28 /// The emitter doesn't try to be clever and emits everything beforehand. This | 28 /// The emitter doesn't try to be clever and emits everything beforehand. This |
| 29 /// increases the output size, but improves performance. | 29 /// increases the output size, but improves performance. |
| 30 /// | 30 /// |
| 31 // The code relies on the fact that all Dart code is inside holders. As such | 31 // The code relies on the fact that all Dart code is inside holders. As such |
| 32 // we can use "global" names however we want. As long as we don't shadow | 32 // we can use "global" names however we want. As long as we don't shadow |
| 33 // JavaScript variables (like `Array`) we are free to chose whatever variable | 33 // JavaScript variables (like `Array`) we are free to chose whatever variable |
| 34 // names we want. Furthermore, the minifier reduces the names of the variables. | 34 // names we want. Furthermore, the pretty-printer minifies local variables, thus |
| 35 // reducing their size. |
| 35 const String mainBoilerplate = ''' | 36 const String mainBoilerplate = ''' |
| 36 { | 37 { |
| 37 // Declare deferred-initializer global, which is used to keep track of the | 38 // Declare deferred-initializer global, which is used to keep track of the |
| 38 // loaded fragments. | 39 // loaded fragments. |
| 39 #deferredInitializer; | 40 #deferredInitializer; |
| 40 | 41 |
| 41 (function() { | 42 (function() { |
| 42 // Copies the own properties from [from] to [to]. | 43 // Copies the own properties from [from] to [to]. |
| 43 function copyProperties(from, to) { | 44 function copyProperties(from, to) { |
| 44 var keys = Object.keys(from); | 45 var keys = Object.keys(from); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 MainFragment fragment = program.fragments.first; | 268 MainFragment fragment = program.fragments.first; |
| 268 throw new UnimplementedError('emitMain'); | 269 throw new UnimplementedError('emitMain'); |
| 269 } | 270 } |
| 270 | 271 |
| 271 js.Statement emitDeferredFragment(DeferredFragment fragment, | 272 js.Statement emitDeferredFragment(DeferredFragment fragment, |
| 272 js.Expression deferredTypes, | 273 js.Expression deferredTypes, |
| 273 List<Holder> holders) { | 274 List<Holder> holders) { |
| 274 throw new UnimplementedError('emitDeferred'); | 275 throw new UnimplementedError('emitDeferred'); |
| 275 } | 276 } |
| 276 } | 277 } |
| OLD | NEW |