| 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.js_emitter.full_emitter; | 5 library dart2js.js_emitter.full_emitter; |
| 6 | 6 |
| 7 import 'dart:convert'; | 7 import 'dart:convert'; |
| 8 import 'dart:collection' show HashMap; | 8 import 'dart:collection' show HashMap; |
| 9 | 9 |
| 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| (...skipping 830 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 841 buildMain(jsAst.Statement invokeMain) { | 841 buildMain(jsAst.Statement invokeMain) { |
| 842 if (compiler.isMockCompilation) return js.comment("Mock compilation"); | 842 if (compiler.isMockCompilation) return js.comment("Mock compilation"); |
| 843 | 843 |
| 844 List<jsAst.Statement> parts = <jsAst.Statement>[]; | 844 List<jsAst.Statement> parts = <jsAst.Statement>[]; |
| 845 | 845 |
| 846 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) { | 846 if (NativeGenerator.needsIsolateAffinityTagInitialization(backend)) { |
| 847 parts.add( | 847 parts.add( |
| 848 NativeGenerator.generateIsolateAffinityTagInitialization( | 848 NativeGenerator.generateIsolateAffinityTagInitialization( |
| 849 backend, | 849 backend, |
| 850 generateEmbeddedGlobalAccess, | 850 generateEmbeddedGlobalAccess, |
| 851 js("convertToFastObject", []))); | 851 js(""" |
| 852 // On V8, the 'intern' function converts a string to a symbol, which |
| 853 // makes property access much faster. |
| 854 function (s) { |
| 855 var o = {}; |
| 856 o[s] = 1; |
| 857 return Object.keys(convertToFastObject(o))[0]; |
| 858 }""", []))); |
| 852 } | 859 } |
| 853 | 860 |
| 854 parts..add(js.comment('BEGIN invoke [main].')) | 861 parts..add(js.comment('BEGIN invoke [main].')) |
| 855 ..add(invokeMain) | 862 ..add(invokeMain) |
| 856 ..add(js.comment('END invoke [main].')); | 863 ..add(js.comment('END invoke [main].')); |
| 857 | 864 |
| 858 return new jsAst.Block(parts); | 865 return new jsAst.Block(parts); |
| 859 } | 866 } |
| 860 | 867 |
| 861 jsAst.Statement buildInitFunction(bool outputContainsConstantList) { | 868 jsAst.Statement buildInitFunction(bool outputContainsConstantList) { |
| (...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2107 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2114 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2108 if (element.isInstanceMember) { | 2115 if (element.isInstanceMember) { |
| 2109 cachedClassBuilders.remove(element.enclosingClass); | 2116 cachedClassBuilders.remove(element.enclosingClass); |
| 2110 | 2117 |
| 2111 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2118 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2112 | 2119 |
| 2113 } | 2120 } |
| 2114 } | 2121 } |
| 2115 } | 2122 } |
| 2116 } | 2123 } |
| OLD | NEW |