| Index: sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
|
| diff --git a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
|
| index 6b79cb780c543fec2e95fdec7f0ad98d89755fad..5e5ff6495b4c15b9f53c4050cadc37be85c2fed1 100644
|
| --- a/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
|
| +++ b/sdk/lib/_internal/compiler/implementation/js_emitter/code_emitter_task.dart
|
| @@ -975,14 +975,6 @@ class CodeEmitterTask extends CompilerTask {
|
| jsAst.Expression generateDispatchPropertyInitialization() {
|
| return js('!#', js.fun([], [
|
|
|
| - // On V8, the 'intern' function converts a string to a symbol, which
|
| - // makes property access much faster.
|
| - new jsAst.FunctionDeclaration(new jsAst.VariableDeclaration('intern'),
|
| - js.fun(['s'], [
|
| - js('var o = {}'),
|
| - js('o[s] = 1'),
|
| - js.return_(js('Object.keys(convertToFastObject(o))[0]'))])),
|
| -
|
| // To ensure that different programs loaded into the same context (page)
|
| // use distinct dispatch properies, we place an object on `Object` to
|
| // contain the names already in use.
|
| @@ -992,7 +984,7 @@ class CodeEmitterTask extends CompilerTask {
|
|
|
| js('var rootProperty = "${generateDispatchPropertyName()}"'),
|
| js.for_('var i = 0', null, 'i++', [
|
| - js('property = intern(rootProperty + "_" + i + "_")'),
|
| + js('property = convertToJSSymbol(rootProperty + "_" + i + "_")'),
|
| js.if_('!(property in usedProperties)', [
|
| js('usedProperties[property] = 1'),
|
| js.return_(
|
| @@ -1164,7 +1156,8 @@ class CodeEmitterTask extends CompilerTask {
|
| void emitConvertToFastObjectFunction() {
|
| // Create an instance that uses 'properties' as prototype. This should make
|
| // 'properties' a fast object.
|
| - mainBuffer.add(r'''function convertToFastObject(properties) {
|
| + mainBuffer.add(r'''
|
| +function convertToFastObject(properties) {
|
| function MyClass() {};
|
| MyClass.prototype = properties;
|
| new MyClass();
|
| @@ -1185,10 +1178,19 @@ if (typeof $printHelperName === "function") {
|
| }
|
| ''');
|
| }
|
| -mainBuffer.add(r'''
|
| + mainBuffer.add(r'''
|
| return properties;
|
| }
|
| ''');
|
| + // On V8, the 'intern' function converts a string to a symbol, which
|
| + // makes property access much faster.
|
| + mainBuffer.add(r'''
|
| +function convertToJSSymbol(s) {
|
| + var o = {};
|
| + o[s] = 1;
|
| + return Object.keys(convertToFastObject(o))[0];
|
| +}
|
| +''');
|
| }
|
|
|
| void writeLibraryDescriptors(LibraryElement library) {
|
|
|