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

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

Issue 1281523003: dart2js: Don't zone-register callbacks in async functions for every await. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Use origin instead of declaration. (already has the right type). Created 5 years, 4 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 | « pkg/compiler/lib/src/elements/modelx.dart ('k') | sdk/lib/_internal/js_runtime/lib/async_patch.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 882b80b7668a6e8059a89362f4b55a52390be771..5631c115265a687135bfd77473f7566618cd24ff 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -235,8 +235,8 @@ class JavaScriptBackend extends Backend {
new Uri(scheme: 'dart', path: '_js_embedded_names');
static final Uri DART_ISOLATE_HELPER =
new Uri(scheme: 'dart', path: '_isolate_helper');
- static final Uri DART_HTML =
- new Uri(scheme: 'dart', path: 'html');
+ static final Uri DART_ASYNC = new Uri(scheme: 'dart', path: 'async');
+ static final Uri DART_HTML = new Uri(scheme: 'dart', path: 'html');
static const String INVOKE_ON = '_getCachedInvocation';
static const String START_ROOT_ISOLATE = 'startRootIsolate';
@@ -273,6 +273,7 @@ class JavaScriptBackend extends Backend {
FunctionInlineCache inlineCache = new FunctionInlineCache();
LibraryElement jsHelperLibrary;
+ LibraryElement asyncLibrary;
LibraryElement interceptorsLibrary;
LibraryElement foreignLibrary;
LibraryElement isolateHelperLibrary;
@@ -669,10 +670,11 @@ class JavaScriptBackend extends Backend {
// 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);
+ Element findAsyncHelper(String name) => find(asyncLibrary, name);
Element findInterceptor(String name) => find(interceptorsLibrary, name);
Element find(LibraryElement library, String name) {
- Element element = library.findLocal(name);
+ Element element = library.implementation.findLocal(name);
assert(invariant(library, element != null,
message: "Element '$name' not found in '${library.canonicalUri}'."));
return element;
@@ -1850,47 +1852,47 @@ class JavaScriptBackend extends Backend {
}
Element getAsyncHelper() {
- return findHelper("asyncHelper");
+ return findAsyncHelper("_asyncHelper");
}
Element getWrapBody() {
- return findHelper("_wrapJsFunctionForAsync");
+ return findAsyncHelper("_wrapJsFunctionForAsync");
}
Element getYieldStar() {
- ClassElement classElement = findHelper("IterationMarker");
+ ClassElement classElement = findAsyncHelper("_IterationMarker");
classElement.ensureResolved(compiler);
return classElement.lookupLocalMember("yieldStar");
}
Element getYieldSingle() {
- ClassElement classElement = findHelper("IterationMarker");
+ ClassElement classElement = findAsyncHelper("_IterationMarker");
classElement.ensureResolved(compiler);
return classElement.lookupLocalMember("yieldSingle");
}
Element getSyncStarUncaughtError() {
- ClassElement classElement = findHelper("IterationMarker");
+ ClassElement classElement = findAsyncHelper("_IterationMarker");
classElement.ensureResolved(compiler);
return classElement.lookupLocalMember("uncaughtError");
}
Element getAsyncStarHelper() {
- return findHelper("asyncStarHelper");
+ return findAsyncHelper("_asyncStarHelper");
}
Element getStreamOfController() {
- return findHelper("streamOfController");
+ return findAsyncHelper("_streamOfController");
}
Element getEndOfIteration() {
- ClassElement classElement = findHelper("IterationMarker");
+ ClassElement classElement = findAsyncHelper("_IterationMarker");
classElement.ensureResolved(compiler);
return classElement.lookupLocalMember("endOfIteration");
}
Element getSyncStarIterable() {
- ClassElement classElement = findHelper("SyncStarIterable");
+ ClassElement classElement = findAsyncHelper("_SyncStarIterable");
classElement.ensureResolved(compiler);
return classElement;
}
@@ -1908,7 +1910,8 @@ class JavaScriptBackend extends Backend {
}
Element getASyncStarController() {
- ClassElement classElement = findHelper("AsyncStarStreamController");
+ ClassElement classElement =
+ findAsyncHelper("_AsyncStarStreamController");
classElement.ensureResolved(compiler);
return classElement;
}
@@ -2022,6 +2025,8 @@ class JavaScriptBackend extends Backend {
Uri uri = library.canonicalUri;
if (uri == DART_JS_HELPER) {
jsHelperLibrary = library;
+ } else if (uri == DART_ASYNC) {
+ asyncLibrary = library;
} else if (uri == DART_INTERNAL) {
internalLibrary = library;
} else if (uri == DART_INTERCEPTORS) {
« no previous file with comments | « pkg/compiler/lib/src/elements/modelx.dart ('k') | sdk/lib/_internal/js_runtime/lib/async_patch.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698