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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1575103003: dart2js cps: Remove inlining from TypePropagator. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 294112fa9289524d56a0c2cdafb438ad96b14e8a..19e8c87d6a79f8d57f733e12d32ac049aa7c36ae 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -1942,94 +1942,8 @@ class TransformingVisitor extends DeepRecursiveVisitor {
return null;
}
- /// Try to inline static invocations.
- ///
- /// Performs the inlining and returns true if the call was inlined. Inlining
- /// uses a fixed heuristic:
- ///
- /// * Inline functions with a single expression statement or return statement
- /// provided that the subexpression is an invocation of foreign code.
- inlineInvokeStatic(InvokeStatic node) {
- // The target might not have an AST, for example if it deferred.
- if (!node.target.hasNode) return null;
-
- if (node.target.asyncMarker != AsyncMarker.SYNC) {
- // Inlining of async/sync*/async* methods is currently not supported.
- return null;
- }
-
- // True if an expression is non-expansive, in the sense defined by this
- // predicate.
- bool isNonExpansive(ast.Expression expr) {
- if (expr is ast.LiteralNull ||
- expr is ast.LiteralBool ||
- expr is ast.LiteralInt ||
- expr is ast.LiteralDouble) {
- return true;
- }
- if (expr is ast.Send) {
- SendStructure structure =
- node.target.treeElements.getSendStructure(expr);
- if (structure is InvokeStructure) {
- // Calls to foreign functions.
- return structure.semantics.kind == AccessKind.TOPLEVEL_METHOD &&
- backend.isForeign(structure.semantics.element);
- } else if (structure is IsStructure || structure is IsNotStructure) {
- // is and is! checks on nonexpansive expressions.
- return isNonExpansive(expr.receiver);
- } else if (structure is EqualsStructure ||
- structure is NotEqualsStructure) {
- // == and != on nonexpansive expressions.
- return isNonExpansive(expr.receiver) &&
- isNonExpansive(expr.argumentsNode.nodes.head);
- } else if (structure is GetStructure) {
- // Parameters.
- return structure.semantics.kind == AccessKind.PARAMETER;
- }
- }
- return false;
- }
-
- ast.Statement body = node.target.node.body;
- bool shouldInline() {
- if (backend.annotations.noInline(node.target)) return false;
- if (node.target.resolvedAst.elements.containsTryStatement) return false;
-
- // Inline functions that are a single return statement, expression
- // statement, or block containing a return statement or expression
- // statement.
- if (body is ast.Return) {
- return isNonExpansive(body.expression);
- } else if (body is ast.ExpressionStatement) {
- return isNonExpansive(body.expression);
- } else if (body is ast.Block) {
- var link = body.statements.nodes;
- if (link.isNotEmpty && link.tail.isEmpty) {
- if (link.head is ast.Return) {
- return isNonExpansive(link.head.expression);
- } else if (link.head is ast.ExpressionStatement) {
- return isNonExpansive(link.head.expression);
- }
- }
- }
- return false;
- }
-
- if (!shouldInline()) return null;
-
- FunctionDefinition target = functionCompiler.compileToCpsIr(node.target);
-
- CpsFragment cps = new CpsFragment(node.sourceInformation);
- Primitive result = cps.inlineFunction(target,
- null,
- node.arguments.map((ref) => ref.definition).toList(),
- hint: node.hint);
- node.replaceUsesWith(result);
- return cps;
- }
-
visitInvokeStatic(InvokeStatic node) {
- return specializeInternalMethodCall(node) ?? inlineInvokeStatic(node);
+ return specializeInternalMethodCall(node);
}
AbstractConstantValue getValue(Variable node) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698