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

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

Issue 1608953002: dart2js: Turn the CPS inlining cache into a general compilation cache. (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 | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/inline.dart
diff --git a/pkg/compiler/lib/src/cps_ir/inline.dart b/pkg/compiler/lib/src/cps_ir/inline.dart
index 2771aefc89cef8aa6176d703f5beb7e88d28c4b2..b112aeeb5c8e7fefe2ebd632dce29de84a599ac6 100644
--- a/pkg/compiler/lib/src/cps_ir/inline.dart
+++ b/pkg/compiler/lib/src/cps_ir/inline.dart
@@ -86,6 +86,9 @@ class InliningCache {
static const int ABSENT = -1;
static const int NO_INLINE = 0;
+ final Map<ExecutableElement, FunctionDefinition> unoptimized =
+ <ExecutableElement, FunctionDefinition>{};
+
final Map<ExecutableElement, List<CacheEntry>> map =
<ExecutableElement, List<CacheEntry>>{};
@@ -144,6 +147,29 @@ class InliningCache {
}
return ABSENT;
}
+
+ /// Cache the unoptimized CPS term for a function.
+ ///
+ /// The unoptimized term should not have any inlining-context-specific
+ /// optimizations applied to it. It will be used to compile the
+ /// non-specialized version of the function.
+ void putUnoptimized(ExecutableElement element, FunctionDefinition function) {
+ unoptimized.putIfAbsent(element, () => copier.copy(function));
+ }
+
+ /// Look up the unoptimized CPS term for a function.
+ ///
+ /// The unoptimized term will not have any inlining-context-specific
+ /// optimizations applied to it. It can be used to compile the
+ /// non-specialized version of the function.
+ FunctionDefinition getUnoptimized(ExecutableElement element) {
+ FunctionDefinition function = unoptimized[element];
+ if (function != null) {
+ function = copier.copy(function);
+ ParentVisitor.setParents(function);
+ }
+ return function;
+ }
}
class Inliner implements Pass {
@@ -443,7 +469,7 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
// body.
function = buildAdapter(invoke, target);
} else {
- function = _inliner.functionCompiler.compileToCpsIr(target);
+ function = compileToCpsIr(target);
void setValue(Variable variable, Reference<Primitive> value) {
variable.type = value.definition.type;
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698