| 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 name of the property that stores the tear-off getter on a static | 7 /// The name of the property that stores the tear-off getter on a static |
| 8 /// function. | 8 /// function. |
| 9 /// | 9 /// |
| 10 /// This property is only used when isolates are used. | 10 /// This property is only used when isolates are used. |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 class FragmentEmitter { | 440 class FragmentEmitter { |
| 441 final Compiler compiler; | 441 final Compiler compiler; |
| 442 final Namer namer; | 442 final Namer namer; |
| 443 final JavaScriptBackend backend; | 443 final JavaScriptBackend backend; |
| 444 final ConstantEmitter constantEmitter; | 444 final ConstantEmitter constantEmitter; |
| 445 final ModelEmitter modelEmitter; | 445 final ModelEmitter modelEmitter; |
| 446 | 446 |
| 447 FragmentEmitter(this.compiler, this.namer, this.backend, this.constantEmitter, | 447 FragmentEmitter(this.compiler, this.namer, this.backend, this.constantEmitter, |
| 448 this.modelEmitter); | 448 this.modelEmitter); |
| 449 | 449 |
| 450 InterceptorData get _interceptorData => |
| 451 // TODO(johnniwinther): Pass [InterceptorData] directly? |
| 452 modelEmitter.nativeEmitter.interceptorData; |
| 453 |
| 450 js.Expression generateEmbeddedGlobalAccess(String global) => | 454 js.Expression generateEmbeddedGlobalAccess(String global) => |
| 451 modelEmitter.generateEmbeddedGlobalAccess(global); | 455 modelEmitter.generateEmbeddedGlobalAccess(global); |
| 452 | 456 |
| 453 js.Expression generateConstantReference(ConstantValue value) => | 457 js.Expression generateConstantReference(ConstantValue value) => |
| 454 modelEmitter.generateConstantReference(value); | 458 modelEmitter.generateConstantReference(value); |
| 455 | 459 |
| 456 js.Expression classReference(Class cls) { | 460 js.Expression classReference(Class cls) { |
| 457 return js.js('#.#', [cls.holder.name, cls.name]); | 461 return js.js('#.#', [cls.holder.name, cls.name]); |
| 458 } | 462 } |
| 459 | 463 |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1022 addFunOrName(stubMethod); | 1026 addFunOrName(stubMethod); |
| 1023 } | 1027 } |
| 1024 | 1028 |
| 1025 js.ArrayInitializer callNameArray = | 1029 js.ArrayInitializer callNameArray = |
| 1026 new js.ArrayInitializer(callNames.map(js.quoteName).toList()); | 1030 new js.ArrayInitializer(callNames.map(js.quoteName).toList()); |
| 1027 js.ArrayInitializer funsOrNamesArray = new js.ArrayInitializer(funsOrNames); | 1031 js.ArrayInitializer funsOrNamesArray = new js.ArrayInitializer(funsOrNames); |
| 1028 | 1032 |
| 1029 bool isIntercepted = false; | 1033 bool isIntercepted = false; |
| 1030 if (method is InstanceMethod) { | 1034 if (method is InstanceMethod) { |
| 1031 MethodElement element = method.element; | 1035 MethodElement element = method.element; |
| 1032 isIntercepted = backend.interceptorData.isInterceptedMethod(element); | 1036 isIntercepted = _interceptorData.isInterceptedMethod(element); |
| 1033 } | 1037 } |
| 1034 int requiredParameterCount = 0; | 1038 int requiredParameterCount = 0; |
| 1035 js.Expression optionalParameterDefaultValues = new js.LiteralNull(); | 1039 js.Expression optionalParameterDefaultValues = new js.LiteralNull(); |
| 1036 if (method.canBeApplied) { | 1040 if (method.canBeApplied) { |
| 1037 requiredParameterCount = method.requiredParameterCount; | 1041 requiredParameterCount = method.requiredParameterCount; |
| 1038 optionalParameterDefaultValues = | 1042 optionalParameterDefaultValues = |
| 1039 _encodeOptionalParameterDefaultValues(method); | 1043 _encodeOptionalParameterDefaultValues(method); |
| 1040 } | 1044 } |
| 1041 | 1045 |
| 1042 return js.js.statement( | 1046 return js.js.statement( |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 } | 1470 } |
| 1467 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", | 1471 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", |
| 1468 js.objectLiteral(interceptorsByTag))); | 1472 js.objectLiteral(interceptorsByTag))); |
| 1469 statements.add( | 1473 statements.add( |
| 1470 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); | 1474 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); |
| 1471 statements.addAll(subclassAssignments); | 1475 statements.addAll(subclassAssignments); |
| 1472 | 1476 |
| 1473 return wrapPhase('nativeSupport', new js.Block(statements)); | 1477 return wrapPhase('nativeSupport', new js.Block(statements)); |
| 1474 } | 1478 } |
| 1475 } | 1479 } |
| OLD | NEW |