Bug 1530745 - Part 1: Make JSFunction::asyncKind() work with native and self-hosted functions. r=arai
authorAndré Bargull <andre.bargull@gmail.com>
Fri, 08 Mar 2019 12:33:56 +0000
changeset 521216 8e4f92791cd3
parent 521215 3e43e15218d9
child 521217 4e633d85d45d
push id10862
push userffxbld-merge
push dateMon, 11 Mar 2019 13:01:11 +0000
treeherdermozilla-beta@a2e7f5c935da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersarai
bugs1530745
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1530745 - Part 1: Make JSFunction::asyncKind() work with native and self-hosted functions. r=arai Differential Revision: https://phabricator.services.mozilla.com/D22665
js/src/vm/JSFunction.h
--- a/js/src/vm/JSFunction.h
+++ b/js/src/vm/JSFunction.h
@@ -631,28 +631,31 @@ class JSFunction : public js::NativeObje
     return js::GeneratorKind::NotGenerator;
   }
 
   bool isGenerator() const {
     return generatorKind() == js::GeneratorKind::Generator;
   }
 
   js::FunctionAsyncKind asyncKind() const {
-    return isInterpretedLazy() ? lazyScript()->asyncKind()
-                               : nonLazyScript()->asyncKind();
+    if (!isInterpreted()) {
+      return js::FunctionAsyncKind::SyncFunction;
+    }
+    if (hasScript()) {
+      return nonLazyScript()->asyncKind();
+    }
+    if (js::LazyScript* lazy = lazyScriptOrNull()) {
+      return lazy->asyncKind();
+    }
+    MOZ_ASSERT(isSelfHostedBuiltin());
+    return js::FunctionAsyncKind::SyncFunction;
   }
 
   bool isAsync() const {
-    if (isInterpretedLazy()) {
-      return lazyScript()->isAsync();
-    }
-    if (hasScript()) {
-      return nonLazyScript()->isAsync();
-    }
-    return false;
+    return asyncKind() == js::FunctionAsyncKind::AsyncFunction;
   }
 
   void setScript(JSScript* script) {
     MOZ_ASSERT(realm() == script->realm());
     mutableScript() = script;
   }
 
   void initScript(JSScript* script) {