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

Unified Diff: pkg/compiler/lib/src/js_backend/codegen/codegen.dart

Issue 1218843003: dart2js cps: Cleanup. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/js_backend/codegen/codegen.dart
diff --git a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
index cbead55caf9ad4dc6bb870c51f6671f27ce75523..8f795fffddabc5fd61acdae48180a414daaaaeab 100644
--- a/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen/codegen.dart
@@ -191,28 +191,13 @@ class CodeGenerator extends tree_ir.StatementVisitor
return buildConstant(glue.getConstantValueForVariable(parameter));
}
- // TODO(karlklose): get rid of the selector argument.
- js.Expression buildStaticInvoke(Selector selector,
- Element target,
+ js.Expression buildStaticInvoke(Element target,
List<js.Expression> arguments,
{SourceInformation sourceInformation}) {
registry.registerStaticInvocation(target.declaration);
- if (target == glue.getInterceptorMethod) {
- // This generates a call to the specialized interceptor function, which
- // does not have a specialized element yet, but is emitted as a stub from
- // the emitter in [InterceptorStubGenerator].
- // TODO(karlklose): Either change [InvokeStatic] to take an [Entity]
- // instead of an [Element] and model the getInterceptor functions as
- // [Entity]s or add a specialized Tree-IR node for interceptor calls.
- registry.registerUseInterceptor();
- js.VariableUse interceptorLibrary = glue.getInterceptorLibrary();
- return js.propertyCall(interceptorLibrary, js.string(selector.name),
- arguments);
- } else {
- js.Expression elementAccess = glue.staticFunctionAccess(target);
- return new js.Call(elementAccess, arguments,
- sourceInformation: sourceInformation);
- }
+ js.Expression elementAccess = glue.staticFunctionAccess(target);
+ return new js.Call(elementAccess, arguments,
+ sourceInformation: sourceInformation);
}
@override
@@ -223,7 +208,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
Selector selector = node.selector;
FunctionElement target = node.target;
List<js.Expression> arguments = visitExpressionList(node.arguments);
- return buildStaticInvoke(selector, target, arguments);
+ return buildStaticInvoke(target, arguments);
}
void registerMethodInvoke(tree_ir.InvokeMethod node) {
@@ -255,12 +240,10 @@ class CodeGenerator extends tree_ir.StatementVisitor
@override
js.Expression visitInvokeStatic(tree_ir.InvokeStatic node) {
- Selector selector = node.selector;
- assert(selector.isGetter || selector.isSetter || selector.isCall);
FunctionElement target = node.target;
List<js.Expression> arguments = visitExpressionList(node.arguments);
- return buildStaticInvoke(selector, target, arguments,
- sourceInformation: node.sourceInformation);
+ return buildStaticInvoke(target, arguments,
+ sourceInformation: node.sourceInformation);
}
@override
@@ -305,10 +288,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
List<js.Expression> args = entries.isEmpty
? <js.Expression>[]
: <js.Expression>[new js.ArrayInitializer(entries)];
- return buildStaticInvoke(
- new Selector.call(constructor.name, constructor.library, 2),
- constructor,
- args);
+ return buildStaticInvoke(constructor, args);
}
@override
@@ -683,8 +663,7 @@ class CodeGenerator extends tree_ir.StatementVisitor
js.Expression buildStaticHelperInvocation(FunctionElement helper,
List<js.Expression> arguments) {
registry.registerStaticUse(helper);
- return buildStaticInvoke(new Selector.fromElement(helper), helper,
- arguments);
+ return buildStaticInvoke(helper, arguments);
}
@override
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart ('k') | pkg/compiler/lib/src/tree_ir/optimization/statement_rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698