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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/type_propagation.dart

Issue 1315083002: dart2js: Use the NoInline annotation on getInterceptor in the JS runtime. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 3 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'optimizers.dart'; 5 import 'optimizers.dart';
6 6
7 import '../common/names.dart' show 7 import '../common/names.dart' show
8 Selectors; 8 Selectors;
9 import '../compiler.dart' as dart2js show 9 import '../compiler.dart' as dart2js show
10 Compiler; 10 Compiler;
(...skipping 1654 matching lines...) Expand 10 before | Expand all | Expand 10 after
1665 if (!node.target.hasNode) return false; 1665 if (!node.target.hasNode) return false;
1666 1666
1667 // An expression is non-expansive (in a sense) if it is just a call to 1667 // An expression is non-expansive (in a sense) if it is just a call to
1668 // a foreign function. 1668 // a foreign function.
1669 bool isNonExpansive(ast.Expression expr) { 1669 bool isNonExpansive(ast.Expression expr) {
1670 if (expr is ast.Send) { 1670 if (expr is ast.Send) {
1671 SendStructure structure = 1671 SendStructure structure =
1672 node.target.treeElements.getSendStructure(expr); 1672 node.target.treeElements.getSendStructure(expr);
1673 if (structure is InvokeStructure) { 1673 if (structure is InvokeStructure) {
1674 return structure.semantics.kind == AccessKind.TOPLEVEL_METHOD && 1674 return structure.semantics.kind == AccessKind.TOPLEVEL_METHOD &&
1675 compiler.backend.isForeign(structure.semantics.element); 1675 backend.isForeign(structure.semantics.element);
1676 } 1676 }
1677 } 1677 }
1678 return false; 1678 return false;
1679 } 1679 }
1680 1680
1681 ast.Statement body = node.target.node.body; 1681 ast.Statement body = node.target.node.body;
1682 bool shouldInline() { 1682 bool shouldInline() {
1683 // At compile time, 'getInterceptor' from the Javascript runtime has a 1683 if (backend.annotations.noInline(node.target)) {
1684 // foreign body that returns undefined. It is later mutated by replacing 1684 return false;
1685 // it with a specialized version. Inlining undefined would be wrong. 1685 }
1686 // TODO(kmillikin): matching the name prevents inlining other functions
1687 // with the same name.
1688 if (node.target.name == 'getInterceptor') return false;
1689 1686
1690 // Inline functions that are a single return statement, expression 1687 // Inline functions that are a single return statement, expression
1691 // statement, or block containing a return statement or expression 1688 // statement, or block containing a return statement or expression
1692 // statement. 1689 // statement.
1693 if (body is ast.Return) { 1690 if (body is ast.Return) {
1694 return isNonExpansive(body.expression); 1691 return isNonExpansive(body.expression);
1695 } else if (body is ast.ExpressionStatement) { 1692 } else if (body is ast.ExpressionStatement) {
1696 return isNonExpansive(body.expression); 1693 return isNonExpansive(body.expression);
1697 } else if (body is ast.Block) { 1694 } else if (body is ast.Block) {
1698 var link = body.statements.nodes; 1695 var link = body.statements.nodes;
(...skipping 973 matching lines...) Expand 10 before | Expand all | Expand 10 after
2672 } 2669 }
2673 2670
2674 processLetPrim(LetPrim node) { 2671 processLetPrim(LetPrim node) {
2675 values.remove(node.primitive); 2672 values.remove(node.primitive);
2676 } 2673 }
2677 2674
2678 processLetMutable(LetMutable node) { 2675 processLetMutable(LetMutable node) {
2679 values.remove(node.variable); 2676 values.remove(node.variable);
2680 } 2677 }
2681 } 2678 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698