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

Unified Diff: lib/compiler/implementation/ssa/builder.dart

Issue 10855146: Make the closure-to-class translator more accessible. It can now be (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: lib/compiler/implementation/ssa/builder.dart
diff --git a/lib/compiler/implementation/ssa/builder.dart b/lib/compiler/implementation/ssa/builder.dart
index e32848f3dfb0c82ec2c03c4d2592b04f94ecb2ad..261cd0f319817fe8f198bf1146aee1d26c87bf28 100644
--- a/lib/compiler/implementation/ssa/builder.dart
+++ b/lib/compiler/implementation/ssa/builder.dart
@@ -133,7 +133,6 @@ class Interceptors {
class SsaBuilderTask extends CompilerTask {
final Interceptors interceptors;
- final Map<Node, ClosureData> closureDataCache;
final CodeEmitterTask emitter;
// Loop tracking information.
final Set<FunctionElement> functionsCalledInLoop;
@@ -144,7 +143,6 @@ class SsaBuilderTask extends CompilerTask {
SsaBuilderTask(JavaScriptBackend backend)
: interceptors = new Interceptors(backend.compiler),
- closureDataCache = new HashMap<Node, ClosureData>(),
emitter = backend.emitter,
functionsCalledInLoop = new Set<FunctionElement>(),
selectorsCalledInLoop = new Map<SourceString, Selector>(),
@@ -226,7 +224,7 @@ class LocalsHandler {
Map<Element, HInstruction> directLocals;
Map<Element, Element> redirectionMapping;
SsaBuilder builder;
- ClosureData closureData;
+ ClosureToClassMapping closureData;
LocalsHandler(this.builder)
: directLocals = new Map<Element, HInstruction>(),
@@ -322,11 +320,11 @@ class LocalsHandler {
void startFunction(FunctionElement function,
FunctionExpression node) {
+ Compiler compiler = builder.compiler;
+ closureData = compiler.closureToClassMapper.computeClosureToClassMapping(
+ node, builder.elements);
- ClosureTranslator translator = new ClosureTranslator(builder);
- closureData = translator.translate(node);
-
- FunctionSignature signature = function.computeSignature(builder.compiler);
+ FunctionSignature signature = function.computeSignature(compiler);
signature.forEachParameter((Element element) {
HInstruction parameter = new HParameterValue(element);
builder.add(parameter);
@@ -1548,12 +1546,8 @@ class SsaBuilder extends ResolvedVisitor implements Visitor {
}
visitFunctionExpression(FunctionExpression node) {
- ClosureData nestedClosureData = builder.closureDataCache[node];
- if (nestedClosureData === null) {
- // TODO(floitsch): we can only assume that the reason for not having a
- // closure data here is, because the function is inside an initializer.
- compiler.unimplemented("Closures inside initializers", node: node);
- }
+ ClosureToClassMapping nestedClosureData =
+ compiler.closureToClassMapper.getMappingForNestedFunction(node);
assert(nestedClosureData !== null);
assert(nestedClosureData.closureClassElement !== null);
ClassElement closureClassElement =

Powered by Google App Engine
This is Rietveld 408576698