summaryrefslogtreecommitdiffstats
path: root/js/public
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-14 19:04:34 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:45 -0400
commit449ea84dcc7dffb2f042fc414eb7238ae842d596 (patch)
tree7e22a358e60b66fd67e838416210d727d83a030d /js/public
parentaa65e8a189d81cba75f101d07ef591b751881fe8 (diff)
downloadUXP-449ea84dcc7dffb2f042fc414eb7238ae842d596.tar
UXP-449ea84dcc7dffb2f042fc414eb7238ae842d596.tar.gz
UXP-449ea84dcc7dffb2f042fc414eb7238ae842d596.tar.lz
UXP-449ea84dcc7dffb2f042fc414eb7238ae842d596.tar.xz
UXP-449ea84dcc7dffb2f042fc414eb7238ae842d596.zip
1344477 - Part 1: Add JSOP_CALL_IGNORES_RV for function call that ignores return value.
Diffstat (limited to 'js/public')
-rw-r--r--js/public/CallArgs.h22
1 files changed, 17 insertions, 5 deletions
diff --git a/js/public/CallArgs.h b/js/public/CallArgs.h
index a7774309a..aae7121ad 100644
--- a/js/public/CallArgs.h
+++ b/js/public/CallArgs.h
@@ -128,7 +128,10 @@ class MOZ_STACK_CLASS CallArgsBase : public WantUsedRval
protected:
Value* argv_;
unsigned argc_;
- bool constructing_;
+ bool constructing_:1;
+
+ // True if the caller does not use the return value.
+ bool ignoresReturnValue_:1;
public:
// CALLEE ACCESS
@@ -164,6 +167,10 @@ class MOZ_STACK_CLASS CallArgsBase : public WantUsedRval
return true;
}
+ bool ignoresReturnValue() const {
+ return ignoresReturnValue_;
+ }
+
MutableHandleValue newTarget() const {
MOZ_ASSERT(constructing_);
return MutableHandleValue::fromMarkedLocation(&this->argv_[argc_]);
@@ -280,14 +287,17 @@ class MOZ_STACK_CLASS CallArgs : public detail::CallArgsBase<detail::IncludeUsed
{
private:
friend CallArgs CallArgsFromVp(unsigned argc, Value* vp);
- friend CallArgs CallArgsFromSp(unsigned stackSlots, Value* sp, bool constructing);
+ friend CallArgs CallArgsFromSp(unsigned stackSlots, Value* sp, bool constructing,
+ bool ignoresReturnValue);
- static CallArgs create(unsigned argc, Value* argv, bool constructing) {
+ static CallArgs create(unsigned argc, Value* argv, bool constructing,
+ bool ignoresReturnValue = false) {
CallArgs args;
args.clearUsedRval();
args.argv_ = argv;
args.argc_ = argc;
args.constructing_ = constructing;
+ args.ignoresReturnValue_ = ignoresReturnValue;
#ifdef DEBUG
for (unsigned i = 0; i < argc; ++i)
MOZ_ASSERT_IF(argv[i].isGCThing(), !GCThingIsMarkedGray(GCCellPtr(argv[i])));
@@ -314,9 +324,11 @@ CallArgsFromVp(unsigned argc, Value* vp)
// eventually move it to an internal header. Embedders should use
// JS::CallArgsFromVp!
MOZ_ALWAYS_INLINE CallArgs
-CallArgsFromSp(unsigned stackSlots, Value* sp, bool constructing = false)
+CallArgsFromSp(unsigned stackSlots, Value* sp, bool constructing = false,
+ bool ignoresReturnValue = false)
{
- return CallArgs::create(stackSlots - constructing, sp - stackSlots, constructing);
+ return CallArgs::create(stackSlots - constructing, sp - stackSlots, constructing,
+ ignoresReturnValue);
}
} // namespace JS