| 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.interceptor_emitter; | 5 library dart2js.js_emitter.full_emitter.interceptor_emitter; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 8 import '../../elements/entities.dart'; | 8 import '../../elements/entities.dart'; |
| 9 import '../../js/js.dart' as jsAst; | 9 import '../../js/js.dart' as jsAst; |
| 10 import '../../js/js.dart' show js; | 10 import '../../js/js.dart' show js; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 } | 25 } |
| 26 } | 26 } |
| 27 | 27 |
| 28 jsAst.Expression buildGetInterceptorMethod( | 28 jsAst.Expression buildGetInterceptorMethod( |
| 29 jsAst.Name key, Set<ClassEntity> classes) { | 29 jsAst.Name key, Set<ClassEntity> classes) { |
| 30 InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator( | 30 InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator( |
| 31 compiler.options, | 31 compiler.options, |
| 32 compiler.commonElements, | 32 compiler.commonElements, |
| 33 backend.emitter, | 33 backend.emitter, |
| 34 backend.nativeCodegenEnqueuer, | 34 backend.nativeCodegenEnqueuer, |
| 35 backend.constants, | |
| 36 namer, | 35 namer, |
| 37 backend.oneShotInterceptorData, | 36 backend.oneShotInterceptorData, |
| 38 backend.customElementsCodegenAnalysis, | 37 backend.customElementsCodegenAnalysis, |
| 39 compiler.codegenWorldBuilder, | 38 compiler.codegenWorldBuilder, |
| 40 closedWorld); | 39 closedWorld); |
| 41 jsAst.Expression function = | 40 jsAst.Expression function = |
| 42 stubGenerator.generateGetInterceptorMethod(classes); | 41 stubGenerator.generateGetInterceptorMethod(classes); |
| 43 | 42 |
| 44 return function; | 43 return function; |
| 45 } | 44 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 71 jsAst.Statement buildOneShotInterceptors() { | 70 jsAst.Statement buildOneShotInterceptors() { |
| 72 List<jsAst.Statement> parts = <jsAst.Statement>[]; | 71 List<jsAst.Statement> parts = <jsAst.Statement>[]; |
| 73 Iterable<jsAst.Name> names = | 72 Iterable<jsAst.Name> names = |
| 74 backend.oneShotInterceptorData.oneShotInterceptorNames; | 73 backend.oneShotInterceptorData.oneShotInterceptorNames; |
| 75 | 74 |
| 76 InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator( | 75 InterceptorStubGenerator stubGenerator = new InterceptorStubGenerator( |
| 77 compiler.options, | 76 compiler.options, |
| 78 compiler.commonElements, | 77 compiler.commonElements, |
| 79 backend.emitter, | 78 backend.emitter, |
| 80 backend.nativeCodegenEnqueuer, | 79 backend.nativeCodegenEnqueuer, |
| 81 backend.constants, | |
| 82 namer, | 80 namer, |
| 83 backend.oneShotInterceptorData, | 81 backend.oneShotInterceptorData, |
| 84 backend.customElementsCodegenAnalysis, | 82 backend.customElementsCodegenAnalysis, |
| 85 compiler.codegenWorldBuilder, | 83 compiler.codegenWorldBuilder, |
| 86 closedWorld); | 84 closedWorld); |
| 87 String globalObject = namer | 85 String globalObject = namer |
| 88 .globalObjectForLibrary(backend.commonElements.interceptorsLibrary); | 86 .globalObjectForLibrary(backend.commonElements.interceptorsLibrary); |
| 89 for (jsAst.Name name in names) { | 87 for (jsAst.Name name in names) { |
| 90 jsAst.Expression function = | 88 jsAst.Expression function = |
| 91 stubGenerator.generateOneShotInterceptor(name); | 89 stubGenerator.generateOneShotInterceptor(name); |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 */ | 122 */ |
| 125 jsAst.Statement buildTypeToInterceptorMap(Program program) { | 123 jsAst.Statement buildTypeToInterceptorMap(Program program) { |
| 126 jsAst.Expression array = program.typeToInterceptorMap; | 124 jsAst.Expression array = program.typeToInterceptorMap; |
| 127 if (array == null) return js.comment("Empty type-to-interceptor map."); | 125 if (array == null) return js.comment("Empty type-to-interceptor map."); |
| 128 | 126 |
| 129 jsAst.Expression typeToInterceptorMap = emitter | 127 jsAst.Expression typeToInterceptorMap = emitter |
| 130 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); | 128 .generateEmbeddedGlobalAccess(embeddedNames.TYPE_TO_INTERCEPTOR_MAP); |
| 131 return js.statement('# = #', [typeToInterceptorMap, array]); | 129 return js.statement('# = #', [typeToInterceptorMap, array]); |
| 132 } | 130 } |
| 133 } | 131 } |
| OLD | NEW |