Chromium Code Reviews| 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 library dart2js.new_js_emitter.model_emitter; | 5 library dart2js.new_js_emitter.model_emitter; |
| 6 | 6 |
| 7 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; | 7 import '../../constants/values.dart' show ConstantValue, FunctionConstantValue; |
| 8 import '../../dart2jslib.dart' show Compiler; | 8 import '../../dart2jslib.dart' show Compiler; |
| 9 import '../../elements/elements.dart' show ClassElement, FunctionElement; | 9 import '../../elements/elements.dart' show ClassElement, FunctionElement; |
| 10 import '../../js/js.dart' as js; | 10 import '../../js/js.dart' as js; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 final NativeEmitter nativeEmitter; | 81 final NativeEmitter nativeEmitter; |
| 82 | 82 |
| 83 JavaScriptBackend get backend => compiler.backend; | 83 JavaScriptBackend get backend => compiler.backend; |
| 84 | 84 |
| 85 /// For deferred loading we communicate the initializers via this global var. | 85 /// For deferred loading we communicate the initializers via this global var. |
| 86 static const String deferredInitializersGlobal = | 86 static const String deferredInitializersGlobal = |
| 87 r"$__dart_deferred_initializers__"; | 87 r"$__dart_deferred_initializers__"; |
| 88 | 88 |
| 89 static const String deferredExtension = "part.js"; | 89 static const String deferredExtension = "part.js"; |
| 90 | 90 |
| 91 static const String typeNameProperty = r"builtin$cls"; | |
| 92 | |
| 93 ModelEmitter(Compiler compiler, Namer namer, this.nativeEmitter) | 91 ModelEmitter(Compiler compiler, Namer namer, this.nativeEmitter) |
| 94 : this.compiler = compiler, | 92 : this.compiler = compiler, |
| 95 this.namer = namer { | 93 this.namer = namer { |
| 96 // TODO(floitsch): remove hard-coded name. | 94 // TODO(floitsch): remove hard-coded name. |
| 97 // TODO(floitsch): there is no harm in caching the template. | 95 // TODO(floitsch): there is no harm in caching the template. |
| 98 js.Template makeConstantListTemplate = | 96 js.Template makeConstantListTemplate = |
| 99 js.js.uncachedExpressionTemplate('makeConstList(#)'); | 97 js.js.uncachedExpressionTemplate('makeConstList(#)'); |
| 100 | 98 |
| 101 this.constantEmitter = new ConstantEmitter( | 99 this.constantEmitter = new ConstantEmitter( |
| 102 compiler, namer, this.generateConstantReference, | 100 compiler, namer, this.generateConstantReference, |
| (...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1178 } else { | 1176 } else { |
| 1179 constructor = descriptor[2]; | 1177 constructor = descriptor[2]; |
| 1180 functionsIndex = 3; | 1178 functionsIndex = 3; |
| 1181 } | 1179 } |
| 1182 | 1180 |
| 1183 for (var i = functionsIndex; i < descriptor.length; i += 2) { | 1181 for (var i = functionsIndex; i < descriptor.length; i += 2) { |
| 1184 parseFunctionDescriptor(prototype, descriptor[i], descriptor[i + 1], | 1182 parseFunctionDescriptor(prototype, descriptor[i], descriptor[i + 1], |
| 1185 typesOffset); | 1183 typesOffset); |
| 1186 } | 1184 } |
| 1187 | 1185 |
| 1188 constructor.$typeNameProperty = name; // Needed for RTI. | 1186 if (typeof constructor.name != 'string') { |
|
sra1
2015/06/26 23:10:09
Use double quotes in JS for consistency with gener
floitsch
2015/07/01 17:00:14
done. also in other places.
| |
| 1187 // IE does not store the name, but allows to modify the property. | |
| 1188 constructor.name = name; | |
| 1189 } | |
| 1189 constructor.prototype = prototype; | 1190 constructor.prototype = prototype; |
| 1190 prototype[#operatorIsPrefix + name] = constructor; | 1191 prototype[#operatorIsPrefix + name] = constructor; |
| 1191 prototype.constructor = constructor; | 1192 prototype.constructor = constructor; |
| 1192 return constructor; | 1193 return constructor; |
| 1193 } | 1194 } |
| 1194 | 1195 |
| 1195 function fillPrototypeWithMixedIn(mixinName, mixinHolderIndex, prototype) { | 1196 function fillPrototypeWithMixedIn(mixinName, mixinHolderIndex, prototype) { |
| 1196 var mixin = holders[mixinHolderIndex][mixinName].ensureResolved(); | 1197 var mixin = holders[mixinHolderIndex][mixinName].ensureResolved(); |
| 1197 var mixinPrototype = mixin.prototype; | 1198 var mixinPrototype = mixin.prototype; |
| 1198 | 1199 |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1276 | 1277 |
| 1277 var end = Date.now(); | 1278 var end = Date.now(); |
| 1278 // print('Setup: ' + (end - start) + ' ms.'); | 1279 // print('Setup: ' + (end - start) + ' ms.'); |
| 1279 | 1280 |
| 1280 #invokeMain; // Start main. | 1281 #invokeMain; // Start main. |
| 1281 | 1282 |
| 1282 })(Date.now(), #code) | 1283 })(Date.now(), #code) |
| 1283 }"""; | 1284 }"""; |
| 1284 | 1285 |
| 1285 } | 1286 } |
| OLD | NEW |