OLD | NEW |
---|---|
1 // Copyright (c) 2015, the Fletch project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Fletch 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.md file. | 3 // BSD-style license that can be found in the LICENSE.md file. |
4 | 4 |
5 library fletchc.debug_info_lazy_field_initializer_codegen; | 5 library fletchc.debug_info_lazy_field_initializer_codegen; |
6 | 6 |
7 import 'package:compiler/src/dart2jslib.dart' show | 7 import 'package:compiler/src/dart2jslib.dart' show |
8 MessageKind, | 8 MessageKind, |
9 Registry; | 9 Registry; |
10 | 10 |
11 import 'package:compiler/src/elements/elements.dart'; | 11 import 'package:compiler/src/elements/elements.dart'; |
12 import 'package:compiler/src/resolution/resolution.dart'; | 12 import 'package:compiler/src/resolution/resolution.dart'; |
13 import 'package:compiler/src/tree/tree.dart'; | 13 import 'package:compiler/src/tree/tree.dart'; |
14 import 'package:compiler/src/universe/universe.dart'; | 14 import 'package:compiler/src/universe/universe.dart'; |
15 | 15 |
16 import 'package:compiler/src/dart_types.dart' show | 16 import 'package:compiler/src/dart_types.dart' show |
17 DartType; | 17 DartType; |
18 | 18 |
19 import 'package:compiler/src/util/util.dart' show | 19 import 'package:compiler/src/util/util.dart' show |
20 Spannable; | 20 Spannable; |
21 | 21 |
22 import 'fletch_context.dart'; | 22 import 'fletch_context.dart'; |
23 | 23 |
24 import 'compiled_function.dart' show | 24 import 'fletch_function_builder.dart' show |
25 CompiledFunction; | 25 FletchFunctionBuilder; |
26 | 26 |
27 import 'closure_environment.dart'; | 27 import 'closure_environment.dart'; |
28 import 'codegen_visitor.dart'; | 28 import 'codegen_visitor.dart'; |
29 import 'lazy_field_initializer_codegen.dart'; | 29 import 'lazy_field_initializer_codegen.dart'; |
30 | 30 |
31 class DebugInfoLazyFieldInitializerCodegen | 31 class DebugInfoLazyFieldInitializerCodegen |
32 extends LazyFieldInitializerCodegen { | 32 extends LazyFieldInitializerCodegen { |
33 final FletchCompiler compiler; | 33 final FletchCompiler compiler; |
34 | 34 |
35 // Regenerate the bytecode in a fresh buffer separately from the compiled | 35 // Regenerate the bytecode in a fresh buffer separately from the compiled |
36 // function. If we did not create a separate buffer, the bytecode would | 36 // function. If we did not create a separate buffer, the bytecode would |
37 // be appended to the compiled function builder and we would get a compiled | 37 // be appended to the compiled function builder and we would get a compiled |
38 // function with incorrect bytecode. | 38 // function with incorrect bytecode. |
39 final BytecodeBuilder debugBuilder; | 39 final BytecodeBuilder debugBuilder; |
40 | 40 |
41 // TODO(ajohnsen): Consider creating a DebugCompiledFunction instead of only | 41 // TODO(ajohnsen): Consider creating a DebugFletchFunctionBuilder instead of o nly |
ahe
2015/06/09 09:14:56
Long line.
Anders Johnsen
2015/06/09 10:15:41
Done.
| |
42 // intercepting the BytecodeBuilder, or simply replace the BytecodeBuilder | 42 // intercepting the BytecodeBuilder, or simply replace the BytecodeBuilder |
43 // in the CompiledFunction. | 43 // in the FletchFunctionBuilder. |
44 DebugInfoLazyFieldInitializerCodegen(CompiledFunction compiledFunction, | 44 DebugInfoLazyFieldInitializerCodegen(FletchFunctionBuilder functionBuilder, |
45 FletchContext context, | 45 FletchContext context, |
46 TreeElements elements, | 46 TreeElements elements, |
47 Registry registry, | 47 Registry registry, |
48 ClosureEnvironment closureEnvironment, | 48 ClosureEnvironment closureEnvironment, |
49 FieldElement field, | 49 FieldElement field, |
50 this.compiler, | 50 this.compiler, |
51 [BytecodeBuilder builder]) | 51 [BytecodeBuilder builder]) |
52 : debugBuilder = (builder == null) | 52 : debugBuilder = (builder == null) |
53 ? new BytecodeBuilder(compiledFunction.arity) | 53 ? new BytecodeBuilder(functionBuilder.arity) |
54 : builder, | 54 : builder, |
55 super(compiledFunction, context, elements, registry, | 55 super(functionBuilder, context, elements, registry, |
56 closureEnvironment, field); | 56 closureEnvironment, field); |
57 | 57 |
58 BytecodeBuilder get builder => debugBuilder; | 58 BytecodeBuilder get builder => debugBuilder; |
59 | 59 |
60 void recordDebugInfo(Node node) { | 60 void recordDebugInfo(Node node) { |
61 compiledFunction.debugInfo.addLocation(compiler, builder.byteSize, node); | 61 functionBuilder.debugInfo.addLocation(compiler, builder.byteSize, node); |
62 } | 62 } |
63 | 63 |
64 void pushVariableDeclaration(LocalValue value) { | 64 void pushVariableDeclaration(LocalValue value) { |
65 super.pushVariableDeclaration(value); | 65 super.pushVariableDeclaration(value); |
66 compiledFunction.debugInfo.pushScope(builder.byteSize, value); | 66 functionBuilder.debugInfo.pushScope(builder.byteSize, value); |
67 } | 67 } |
68 | 68 |
69 void popVariableDeclaration(Element element) { | 69 void popVariableDeclaration(Element element) { |
70 super.popVariableDeclaration(element); | 70 super.popVariableDeclaration(element); |
71 compiledFunction.debugInfo.popScope(builder.byteSize); | 71 functionBuilder.debugInfo.popScope(builder.byteSize); |
72 } | 72 } |
73 | 73 |
74 void registerDynamicInvocation(Selector selector) { } | 74 void registerDynamicInvocation(Selector selector) { } |
75 void registerDynamicGetter(Selector selector) { } | 75 void registerDynamicGetter(Selector selector) { } |
76 void registerDynamicSetter(Selector selector) { } | 76 void registerDynamicSetter(Selector selector) { } |
77 void registerStaticInvocation(FunctionElement function) { } | 77 void registerStaticInvocation(FunctionElement function) { } |
78 void registerInstantiatedClass(ClassElement klass) { } | 78 void registerInstantiatedClass(ClassElement klass) { } |
79 | 79 |
80 void callIsSelector( | 80 void callIsSelector( |
81 Node node, | 81 Node node, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
135 void visitForValue(Node node) { | 135 void visitForValue(Node node) { |
136 recordDebugInfo(node); | 136 recordDebugInfo(node); |
137 super.visitForValue(node); | 137 super.visitForValue(node); |
138 } | 138 } |
139 | 139 |
140 void visitForEffect(Node node) { | 140 void visitForEffect(Node node) { |
141 recordDebugInfo(node); | 141 recordDebugInfo(node); |
142 super.visitForEffect(node); | 142 super.visitForEffect(node); |
143 } | 143 } |
144 } | 144 } |
OLD | NEW |