| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 10 |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 return [helpers.closureClass, helpers.jsIndexableClass]; | 317 return [helpers.closureClass, helpers.jsIndexableClass]; |
| 318 } | 318 } |
| 319 | 319 |
| 320 FunctionCompiler functionCompiler; | 320 FunctionCompiler functionCompiler; |
| 321 | 321 |
| 322 CodeEmitterTask emitter; | 322 CodeEmitterTask emitter; |
| 323 | 323 |
| 324 /** | 324 /** |
| 325 * The generated code as a js AST for compiled methods. | 325 * The generated code as a js AST for compiled methods. |
| 326 */ | 326 */ |
| 327 Map<Element, jsAst.Expression> get generatedCode { | 327 final Map<Element, jsAst.Expression> generatedCode = |
| 328 return codegenEnqueuer.generatedCode; | 328 <Element, jsAst.Expression>{}; |
| 329 } | |
| 330 | 329 |
| 331 FunctionInlineCache inlineCache = new FunctionInlineCache(); | 330 FunctionInlineCache inlineCache = new FunctionInlineCache(); |
| 332 | 331 |
| 333 /// If [true], the compiler will emit code that logs whenever a method is | 332 /// If [true], the compiler will emit code that logs whenever a method is |
| 334 /// called. When TRACE_METHOD is 'console' this will be logged | 333 /// called. When TRACE_METHOD is 'console' this will be logged |
| 335 /// directly in the JavaScript console. When TRACE_METHOD is 'post' the | 334 /// directly in the JavaScript console. When TRACE_METHOD is 'post' the |
| 336 /// information will be sent to a server via a POST request. | 335 /// information will be sent to a server via a POST request. |
| 337 static const String TRACE_METHOD = const String.fromEnvironment('traceCalls'); | 336 static const String TRACE_METHOD = const String.fromEnvironment('traceCalls'); |
| 338 static const bool TRACE_CALLS = | 337 static const bool TRACE_CALLS = |
| 339 TRACE_METHOD == 'post' || TRACE_METHOD == 'console'; | 338 TRACE_METHOD == 'post' || TRACE_METHOD == 'console'; |
| (...skipping 2154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2494 FunctionElement helperForBadMain() => helpers.badMain; | 2493 FunctionElement helperForBadMain() => helpers.badMain; |
| 2495 | 2494 |
| 2496 FunctionElement helperForMissingMain() => helpers.missingMain; | 2495 FunctionElement helperForMissingMain() => helpers.missingMain; |
| 2497 | 2496 |
| 2498 FunctionElement helperForMainArity() => helpers.mainHasTooManyParameters; | 2497 FunctionElement helperForMainArity() => helpers.mainHasTooManyParameters; |
| 2499 | 2498 |
| 2500 void forgetElement(Element element) { | 2499 void forgetElement(Element element) { |
| 2501 constants.forgetElement(element); | 2500 constants.forgetElement(element); |
| 2502 constantCompilerTask.dartConstantCompiler.forgetElement(element); | 2501 constantCompilerTask.dartConstantCompiler.forgetElement(element); |
| 2503 aliasedSuperMembers.remove(element); | 2502 aliasedSuperMembers.remove(element); |
| 2503 generatedCode.remove(element); |
| 2504 if (element is MemberElement) { |
| 2505 for (Element closure in element.nestedClosures) { |
| 2506 generatedCode.remove(closure); |
| 2507 } |
| 2508 } |
| 2504 } | 2509 } |
| 2505 | 2510 |
| 2506 @override | 2511 @override |
| 2507 WorldImpact computeMainImpact(MethodElement mainMethod, | 2512 WorldImpact computeMainImpact(MethodElement mainMethod, |
| 2508 {bool forResolution}) { | 2513 {bool forResolution}) { |
| 2509 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); | 2514 WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl(); |
| 2510 if (mainMethod.parameters.isNotEmpty) { | 2515 if (mainMethod.parameters.isNotEmpty) { |
| 2511 impactTransformer.registerBackendImpact( | 2516 impactTransformer.registerBackendImpact( |
| 2512 mainImpact, impacts.mainWithArguments); | 2517 mainImpact, impacts.mainWithArguments); |
| 2513 mainImpact.registerStaticUse( | 2518 mainImpact.registerStaticUse( |
| (...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3264 @override | 3269 @override |
| 3265 bool isInterceptorClass(ClassElement cls) { | 3270 bool isInterceptorClass(ClassElement cls) { |
| 3266 return helpers.backend.isInterceptorClass(cls); | 3271 return helpers.backend.isInterceptorClass(cls); |
| 3267 } | 3272 } |
| 3268 | 3273 |
| 3269 @override | 3274 @override |
| 3270 bool isNative(Element element) { | 3275 bool isNative(Element element) { |
| 3271 return helpers.backend.isNative(element); | 3276 return helpers.backend.isNative(element); |
| 3272 } | 3277 } |
| 3273 } | 3278 } |
| OLD | NEW |