Closed Bug 960028 Opened 6 years ago Closed 6 years ago

Use UndefinedHandleValue rather than rooting UndefinedValue()

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: jonco, Assigned: jonco)

References

Details

Attachments

(1 file)

A quick grep finds a whole bunch of places where we do this.
Blocks: ExactRooting
So this changes places where we root just to get an undefined value with UndefinedHandleValue, and removes explicit initialization of a rooted to undefined as it's the default anyway.
Attachment #8372857 - Flags: review?(sphink)
Comment on attachment 8372857 [details] [diff] [review]
bug960028-undefined-value

Review of attachment 8372857 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/builtin/TestingFunctions.cpp
@@ +688,5 @@
>  CountHeap(JSContext *cx, unsigned argc, jsval *vp)
>  {
>      CallArgs args = CallArgsFromVp(argc, vp);
>  
> +    RootedValue startValue(cx);

I'd rather leave this one as-is. It's documentation for the initial value.

::: js/src/jsfun.cpp
@@ +887,5 @@
>          return false;
>      }
>  
>      Value *argv = vp + 2;
> +    RootedValue thisv(cx);

I'd leave this one alone too.

::: js/src/vm/Debugger.cpp
@@ +1235,5 @@
>       * pending exception for a 'catch' clause to handle. Don't let the
>       * onStep handlers mess with that (other than by returning a resumption
>       * value).
>       */
> +    RootedValue exception(cx);

Leave this one alone.

::: js/src/vm/OldDebugAPI.cpp
@@ +621,5 @@
>  
>      RootedObject obj(cx, obj_);
>  
>      bool wasThrowing = cx->isExceptionPending();
> +    RootedValue lastException(cx);

Leave this one alone.
Attachment #8372857 - Flags: review?(sphink) → review+
https://hg.mozilla.org/mozilla-central/rev/9bbd70722bde
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.