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 524214 8e4f92791cd32d131e6dbf9648fe1b7cd564d0e8
parent 524213 3e43e15218d95eecc53546fe299373826cc66aaa
child 524215 4e633d85d45d339637a1fcee54e825d3fe1e0839
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [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) {