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

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

Issue 746993002: Avoid patching in dart2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 6 years, 1 month 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 | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/js_backend/backend.dart
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index d4585d54373e2bc025277122f4076b8ed1f6117c..7d1859de6c7d8d1a8e6445d4ef45a5da3e0cce57 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -340,6 +340,7 @@ class JavaScriptBackend extends Backend {
List<CompilerTask> get tasks {
List<CompilerTask> result = functionCompiler.tasks;
result.add(emitter);
+ result.add(patchResolverTask);
return result;
}
@@ -447,6 +448,8 @@ class JavaScriptBackend extends Backend {
JavaScriptResolutionCallbacks resolutionCallbacks;
+ PatchResolverTask patchResolverTask;
+
JavaScriptBackend(Compiler compiler, bool generateSourceMap)
: namer = determineNamer(compiler),
oneShotInterceptors = new Map<String, Selector>(),
@@ -459,6 +462,7 @@ class JavaScriptBackend extends Backend {
customElementsAnalysis = new CustomElementsAnalysis(this);
constantCompilerTask = new JavaScriptConstantTask(compiler);
resolutionCallbacks = new JavaScriptResolutionCallbacks(this);
+ patchResolverTask = new PatchResolverTask(compiler);
functionCompiler = USE_CPS_IR
? new CspFunctionCompiler(compiler, this)
: new SsaFunctionCompiler(this, generateSourceMap);
@@ -472,6 +476,12 @@ class JavaScriptBackend extends Backend {
return constantCompilerTask.jsConstantCompiler;
}
+ FunctionElement resolveExternalFunction(FunctionElement element) {
+ return patchResolverTask.measure(() {
+ return patchResolverTask.resolveExternalFunction(element);
+ });
+ }
+
// TODO(karlklose): Split into findHelperFunction and findHelperClass and
// add a check that the element has the expected kind.
Element findHelper(String name) => find(jsHelperLibrary, name);
@@ -1697,6 +1707,14 @@ class JavaScriptBackend extends Backend {
Future onLibraryScanned(LibraryElement library, LibraryLoader loader) {
return super.onLibraryScanned(library, loader).then((_) {
+ if (library.isPlatformLibrary && !library.isPatched) {
+ // Apply patch, if any.
+ Uri patchUri = compiler.resolvePatchUri(library.canonicalUri.path);
+ if (patchUri != null) {
+ return compiler.patchParser.patchLibrary(loader, patchUri, library);
+ }
+ }
+ }).then((_) {
Uri uri = library.canonicalUri;
VariableElement findVariable(String name) {
« no previous file with comments | « pkg/compiler/lib/src/enqueue.dart ('k') | pkg/compiler/lib/src/js_backend/js_backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698