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 part of js_backend; | 5 part of js_backend; |
6 | 6 |
7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
8 | 8 |
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
(...skipping 1433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1444 } | 1444 } |
1445 } else { | 1445 } else { |
1446 // If the constant-handler was not able to produce a result we have to | 1446 // If the constant-handler was not able to produce a result we have to |
1447 // go through the builder (below) to generate the lazy initializer for | 1447 // go through the builder (below) to generate the lazy initializer for |
1448 // the static variable. | 1448 // the static variable. |
1449 // We also need to register the use of the cyclic-error helper. | 1449 // We also need to register the use of the cyclic-error helper. |
1450 compiler.enqueuer.codegen.registerStaticUse(getCyclicThrowHelper()); | 1450 compiler.enqueuer.codegen.registerStaticUse(getCyclicThrowHelper()); |
1451 } | 1451 } |
1452 } | 1452 } |
1453 | 1453 |
1454 generatedCode[element] = functionCompiler.compile(work); | 1454 jsAst.Fun code = functionCompiler.compile(work); |
| 1455 if (const bool.fromEnvironment('instrumentForCoverage') |
| 1456 && compiler.dumpInfo) { |
| 1457 // TODO(sigmund): do this properly (e.g. add an embedded global, etc). |
| 1458 code.body.statements.insert(0, js.statement( |
| 1459 '__record_use("${element.hashCode}", "${element.name}")')); |
| 1460 } |
| 1461 |
| 1462 generatedCode[element] = code; |
1455 return const WorldImpact(); | 1463 return const WorldImpact(); |
1456 } | 1464 } |
1457 | 1465 |
1458 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { | 1466 native.NativeEnqueuer nativeResolutionEnqueuer(Enqueuer world) { |
1459 return new native.NativeResolutionEnqueuer(world, compiler); | 1467 return new native.NativeResolutionEnqueuer(world, compiler); |
1460 } | 1468 } |
1461 | 1469 |
1462 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { | 1470 native.NativeEnqueuer nativeCodegenEnqueuer(Enqueuer world) { |
1463 return new native.NativeCodegenEnqueuer(world, compiler, emitter); | 1471 return new native.NativeCodegenEnqueuer(world, compiler, emitter); |
1464 } | 1472 } |
(...skipping 1604 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3069 } | 3077 } |
3070 } | 3078 } |
3071 | 3079 |
3072 /// Records that [constant] is used by the element behind [registry]. | 3080 /// Records that [constant] is used by the element behind [registry]. |
3073 class Dependency { | 3081 class Dependency { |
3074 final ConstantValue constant; | 3082 final ConstantValue constant; |
3075 final Element annotatedElement; | 3083 final Element annotatedElement; |
3076 | 3084 |
3077 const Dependency(this.constant, this.annotatedElement); | 3085 const Dependency(this.constant, this.annotatedElement); |
3078 } | 3086 } |
OLD | NEW |