| 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.program_builder; | 5 library dart2js.js_emitter.program_builder; |
| 6 | 6 |
| 7 import 'js_emitter.dart' show computeMixinClass; | 7 import 'js_emitter.dart' show computeMixinClass; |
| 8 import 'model.dart'; | 8 import 'model.dart'; |
| 9 | 9 |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 /// HACK for Incremental Compilation. | 283 /// HACK for Incremental Compilation. |
| 284 /// | 284 /// |
| 285 /// Returns a class that contains the fields of a class. | 285 /// Returns a class that contains the fields of a class. |
| 286 Class buildFieldsHackForIncrementalCompilation(ClassElement element) { | 286 Class buildFieldsHackForIncrementalCompilation(ClassElement element) { |
| 287 assert(_compiler.hasIncrementalSupport); | 287 assert(_compiler.hasIncrementalSupport); |
| 288 | 288 |
| 289 List<Field> instanceFields = _buildFields(element, false); | 289 List<Field> instanceFields = _buildFields(element, false); |
| 290 String name = namer.getNameOfClass(element); | 290 String name = namer.getNameOfClass(element); |
| 291 | 291 |
| 292 return new Class( | 292 return new Class( |
| 293 element, name, null, [], instanceFields, [], [], [], [], null, | 293 element, name, null, [], instanceFields, [], [], [], [], [], null, |
| 294 isDirectlyInstantiated: true, | 294 isDirectlyInstantiated: true, |
| 295 onlyForRti: false, | 295 onlyForRti: false, |
| 296 isNative: element.isNative); | 296 isNative: element.isNative); |
| 297 } | 297 } |
| 298 | 298 |
| 299 Class _buildClass(ClassElement element) { | 299 Class _buildClass(ClassElement element) { |
| 300 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); | 300 bool onlyForRti = _task.typeTestRegistry.rtiNeededClasses.contains(element); |
| 301 | 301 |
| 302 List<Method> methods = []; | 302 List<Method> methods = []; |
| 303 List<StubMethod> callStubs = <StubMethod>[]; | 303 List<StubMethod> callStubs = <StubMethod>[]; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 322 | 322 |
| 323 Map<String, js.Expression> callStubsForMember = | 323 Map<String, js.Expression> callStubsForMember = |
| 324 classStubGenerator.generateCallStubsForGetter(member, selectors); | 324 classStubGenerator.generateCallStubsForGetter(member, selectors); |
| 325 callStubsForMember.forEach((String name, js.Expression code) { | 325 callStubsForMember.forEach((String name, js.Expression code) { |
| 326 callStubs.add(_buildStubMethod(name, code, element: member)); | 326 callStubs.add(_buildStubMethod(name, code, element: member)); |
| 327 }); | 327 }); |
| 328 } | 328 } |
| 329 } | 329 } |
| 330 } | 330 } |
| 331 | 331 |
| 332 List<StubMethod> typeVariableReaderStubs = |
| 333 classStubGenerator.generateTypeVariableReaderStubs(element); |
| 334 |
| 332 List<StubMethod> noSuchMethodStubs = <StubMethod>[]; | 335 List<StubMethod> noSuchMethodStubs = <StubMethod>[]; |
| 333 if (element == _compiler.objectClass) { | 336 if (element == _compiler.objectClass) { |
| 334 Map<String, Selector> selectors = | 337 Map<String, Selector> selectors = |
| 335 classStubGenerator.computeSelectorsForNsmHandlers(); | 338 classStubGenerator.computeSelectorsForNsmHandlers(); |
| 336 selectors.forEach((String name, Selector selector) { | 339 selectors.forEach((String name, Selector selector) { |
| 337 noSuchMethodStubs | 340 noSuchMethodStubs |
| 338 .add(classStubGenerator.generateStubForNoSuchMethod(name, | 341 .add(classStubGenerator.generateStubForNoSuchMethod(name, |
| 339 selector)); | 342 selector)); |
| 340 }); | 343 }); |
| 341 } | 344 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 Class result; | 377 Class result; |
| 375 if (element.isMixinApplication && !onlyForRti) { | 378 if (element.isMixinApplication && !onlyForRti) { |
| 376 assert(!element.isNative); | 379 assert(!element.isNative); |
| 377 assert(methods.isEmpty); | 380 assert(methods.isEmpty); |
| 378 | 381 |
| 379 result = new MixinApplication(element, | 382 result = new MixinApplication(element, |
| 380 name, holder, | 383 name, holder, |
| 381 instanceFields, | 384 instanceFields, |
| 382 staticFieldsForReflection, | 385 staticFieldsForReflection, |
| 383 callStubs, | 386 callStubs, |
| 387 typeVariableReaderStubs, |
| 384 isChecks, | 388 isChecks, |
| 385 typeTests.functionTypeIndex, | 389 typeTests.functionTypeIndex, |
| 386 isDirectlyInstantiated: isInstantiated, | 390 isDirectlyInstantiated: isInstantiated, |
| 387 onlyForRti: onlyForRti); | 391 onlyForRti: onlyForRti); |
| 388 } else { | 392 } else { |
| 389 result = new Class(element, | 393 result = new Class(element, |
| 390 name, holder, methods, instanceFields, | 394 name, holder, methods, instanceFields, |
| 391 staticFieldsForReflection, | 395 staticFieldsForReflection, |
| 392 callStubs, | 396 callStubs, |
| 397 typeVariableReaderStubs, |
| 393 noSuchMethodStubs, | 398 noSuchMethodStubs, |
| 394 isChecks, | 399 isChecks, |
| 395 typeTests.functionTypeIndex, | 400 typeTests.functionTypeIndex, |
| 396 isDirectlyInstantiated: isInstantiated, | 401 isDirectlyInstantiated: isInstantiated, |
| 397 onlyForRti: onlyForRti, | 402 onlyForRti: onlyForRti, |
| 398 isNative: element.isNative); | 403 isNative: element.isNative); |
| 399 } | 404 } |
| 400 _classes[element] = result; | 405 _classes[element] = result; |
| 401 return result; | 406 return result; |
| 402 } | 407 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 _registry.registerConstant(outputUnit, constantValue); | 650 _registry.registerConstant(outputUnit, constantValue); |
| 646 assert(!_constants.containsKey(constantValue)); | 651 assert(!_constants.containsKey(constantValue)); |
| 647 String name = namer.constantName(constantValue); | 652 String name = namer.constantName(constantValue); |
| 648 String constantObject = namer.globalObjectForConstant(constantValue); | 653 String constantObject = namer.globalObjectForConstant(constantValue); |
| 649 Holder holder = _registry.registerHolder(constantObject); | 654 Holder holder = _registry.registerHolder(constantObject); |
| 650 Constant constant = new Constant(name, holder, constantValue); | 655 Constant constant = new Constant(name, holder, constantValue); |
| 651 _constants[constantValue] = constant; | 656 _constants[constantValue] = constant; |
| 652 } | 657 } |
| 653 } | 658 } |
| 654 } | 659 } |
| OLD | NEW |