summaryrefslogtreecommitdiffstats
path: root/js/src/jsfun.h
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-12-13 11:34:00 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-12-13 11:34:00 +0100
commit42766ad06f7d37b507a500c8d78002d25fd804f8 (patch)
tree1dcebad9b2448090b626239104bc395d4d47d230 /js/src/jsfun.h
parentbc8a25f5e33700f700b1e07b238bef5dae22f1ad (diff)
downloadUXP-42766ad06f7d37b507a500c8d78002d25fd804f8.tar
UXP-42766ad06f7d37b507a500c8d78002d25fd804f8.tar.gz
UXP-42766ad06f7d37b507a500c8d78002d25fd804f8.tar.lz
UXP-42766ad06f7d37b507a500c8d78002d25fd804f8.tar.xz
UXP-42766ad06f7d37b507a500c8d78002d25fd804f8.zip
Use canonical function in TypeNewScript::rollbackPartiallyInitializedObjects.
Diffstat (limited to 'js/src/jsfun.h')
-rw-r--r--js/src/jsfun.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/js/src/jsfun.h b/js/src/jsfun.h
index 7da831aa2..1c7da57ec 100644
--- a/js/src/jsfun.h
+++ b/js/src/jsfun.h
@@ -460,6 +460,19 @@ class JSFunction : public js::NativeObject
return nonLazyScript();
}
+ // If this is a scripted function, returns its canonical function (the
+ // original function allocated by the frontend). Note that lazy self-hosted
+ // builtins don't have a lazy script so in that case we also return nullptr.
+ JSFunction* maybeCanonicalFunction() const {
+ if (hasScript()) {
+ return nonLazyScript()->functionNonDelazifying();
+ }
+ if (isInterpretedLazy() && !isSelfHostedBuiltin()) {
+ return lazyScript()->functionNonDelazifying();
+ }
+ return nullptr;
+ }
+
// The state of a JSFunction whose script errored out during bytecode
// compilation. Such JSFunctions are only reachable via GC iteration and
// not from script.