diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-07-14 19:04:34 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:45 -0400 |
commit | f0ce3141c931b253b3d76a7e480445456e7a5613 (patch) | |
tree | 7e22a358e60b66fd67e838416210d727d83a030d /js/public | |
parent | 13ed6bb9ec3bfd2a3887a891ef5eb29da71d1bde (diff) | |
download | aura-central-f0ce3141c931b253b3d76a7e480445456e7a5613.tar.gz |
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.h | 22 |
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 |