Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(154)

Side by Side Diff: pkg/fletchc/lib/src/debug_info_function_codegen.dart

Issue 1170123004: Rename CompiledFunction to FletchFunctionBuilder and CompiledClass to FletchClassBuilder. (Closed) Base URL: git@github.com:dart-lang/fletch.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_function_codegen; 5 library fletchc.debug_info_function_codegen;
6 6
7 import 'package:compiler/src/elements/elements.dart'; 7 import 'package:compiler/src/elements/elements.dart';
8 import 'package:compiler/src/resolution/resolution.dart'; 8 import 'package:compiler/src/resolution/resolution.dart';
9 import 'package:compiler/src/tree/tree.dart'; 9 import 'package:compiler/src/tree/tree.dart';
10 import 'package:compiler/src/universe/universe.dart'; 10 import 'package:compiler/src/universe/universe.dart';
11 11
12 import 'package:compiler/src/dart2jslib.dart' show 12 import 'package:compiler/src/dart2jslib.dart' show
13 Registry; 13 Registry;
14 14
15 import 'package:compiler/src/dart_types.dart' show 15 import 'package:compiler/src/dart_types.dart' show
16 DartType; 16 DartType;
17 17
18 import 'package:compiler/src/util/util.dart' show 18 import 'package:compiler/src/util/util.dart' show
19 Spannable; 19 Spannable;
20 20
21 import 'bytecode_builder.dart'; 21 import 'bytecode_builder.dart';
22 import 'closure_environment.dart'; 22 import 'closure_environment.dart';
23 import 'codegen_visitor.dart'; 23 import 'codegen_visitor.dart';
24 24
25 import 'compiled_function.dart' show 25 import 'fletch_function_builder.dart' show
26 CompiledFunction; 26 FletchFunctionBuilder;
27 27
28 import 'fletch_context.dart'; 28 import 'fletch_context.dart';
29 import 'function_codegen.dart'; 29 import 'function_codegen.dart';
30 30
31 class DebugInfoFunctionCodegen extends FunctionCodegen { 31 class DebugInfoFunctionCodegen extends FunctionCodegen {
32 final FletchCompiler compiler; 32 final FletchCompiler compiler;
33 33
34 // Regenerate the bytecode in a fresh buffer separately from the compiled 34 // Regenerate the bytecode in a fresh buffer separately from the compiled
35 // function. If we did not create a separate buffer, the bytecode would 35 // function. If we did not create a separate buffer, the bytecode would
36 // be appended to the compiled function builder and we would get a compiled 36 // be appended to the compiled function builder and we would get a compiled
37 // function with incorrect bytecode. 37 // function with incorrect bytecode.
38 final BytecodeBuilder debugBuilder; 38 final BytecodeBuilder debugBuilder;
39 39
40 DebugInfoFunctionCodegen(CompiledFunction compiledFunction, 40 DebugInfoFunctionCodegen(FletchFunctionBuilder functionBuilder,
41 FletchContext context, 41 FletchContext context,
42 TreeElements elements, 42 TreeElements elements,
43 Registry registry, 43 Registry registry,
44 ClosureEnvironment closureEnvironment, 44 ClosureEnvironment closureEnvironment,
45 FunctionElement function, 45 FunctionElement function,
46 this.compiler) 46 this.compiler)
47 : debugBuilder = new BytecodeBuilder(compiledFunction.arity), 47 : debugBuilder = new BytecodeBuilder(functionBuilder.arity),
48 super(compiledFunction, context, elements, registry, 48 super(functionBuilder, context, elements, registry,
49 closureEnvironment, function) { 49 closureEnvironment, function) {
50 if (compiledFunction.hasThisArgument) pushVariableDeclaration(thisValue); 50 if (functionBuilder.hasThisArgument) pushVariableDeclaration(thisValue);
51 } 51 }
52 52
53 BytecodeBuilder get builder => debugBuilder; 53 BytecodeBuilder get builder => debugBuilder;
54 54
55 void recordDebugInfo(Node node) { 55 void recordDebugInfo(Node node) {
56 compiledFunction.debugInfo.addLocation(compiler, builder.byteSize, node); 56 functionBuilder.debugInfo.addLocation(compiler, builder.byteSize, node);
57 } 57 }
58 58
59 void pushVariableDeclaration(LocalValue value) { 59 void pushVariableDeclaration(LocalValue value) {
60 super.pushVariableDeclaration(value); 60 super.pushVariableDeclaration(value);
61 compiledFunction.debugInfo.pushScope(builder.byteSize, value); 61 functionBuilder.debugInfo.pushScope(builder.byteSize, value);
62 } 62 }
63 63
64 void popVariableDeclaration(Element element) { 64 void popVariableDeclaration(Element element) {
65 super.popVariableDeclaration(element); 65 super.popVariableDeclaration(element);
66 compiledFunction.debugInfo.popScope(builder.byteSize); 66 functionBuilder.debugInfo.popScope(builder.byteSize);
67 } 67 }
68 68
69 void registerDynamicInvocation(Selector selector) { } 69 void registerDynamicInvocation(Selector selector) { }
70 void registerDynamicGetter(Selector selector) { } 70 void registerDynamicGetter(Selector selector) { }
71 void registerDynamicSetter(Selector selector) { } 71 void registerDynamicSetter(Selector selector) { }
72 void registerStaticInvocation(FunctionElement function) { } 72 void registerStaticInvocation(FunctionElement function) { }
73 void registerInstantiatedClass(ClassElement klass) { } 73 void registerInstantiatedClass(ClassElement klass) { }
74 74
75 void callIsSelector( 75 void callIsSelector(
76 Node node, 76 Node node,
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 void visitForValue(Node node) { 130 void visitForValue(Node node) {
131 recordDebugInfo(node); 131 recordDebugInfo(node);
132 super.visitForValue(node); 132 super.visitForValue(node);
133 } 133 }
134 134
135 void visitForEffect(Node node) { 135 void visitForEffect(Node node) {
136 recordDebugInfo(node); 136 recordDebugInfo(node);
137 super.visitForEffect(node); 137 super.visitForEffect(node);
138 } 138 }
139 } 139 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698