Commit 05282795 authored by Boris Zbarsky's avatar Boris Zbarsky
Browse files

Bug 959927. Make AbstractFramePtr::returnValue return a HandleValue and make...

Bug 959927.  Make AbstractFramePtr::returnValue return a HandleValue and make receiveCompletionValue take a HandleValue to fix debugger unsafe address hazards.  r=terrence
parent 96c947e3
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ BaselineFrame::trace(JSTracer *trc)

    // Mark return value.
    if (hasReturnValue())
        gc::MarkValueRoot(trc, returnValue(), "baseline-rval");
        gc::MarkValueRoot(trc, returnValue().address(), "baseline-rval");

    if (isEvalFrame())
        gc::MarkScriptRoot(trc, &evalScript_, "baseline-evalscript");
+3 −3
Original line number Diff line number Diff line
@@ -200,12 +200,12 @@ class BaselineFrame
    bool hasReturnValue() const {
        return flags_ & HAS_RVAL;
    }
    Value *returnValue() {
        return reinterpret_cast<Value *>(&loReturnValue_);
    MutableHandleValue returnValue() {
        return MutableHandleValue::fromMarkedLocation(reinterpret_cast<Value *>(&loReturnValue_));
    }
    void setReturnValue(const Value &v) {
        flags_ |= HAS_RVAL;
        *returnValue() = v;
        returnValue().set(v);
    }
    inline Value *addressOfReturnValue() {
        return reinterpret_cast<Value *>(&loReturnValue_);
+2 −1
Original line number Diff line number Diff line
@@ -879,7 +879,8 @@ Debugger::newCompletionValue(JSContext *cx, JSTrapStatus status, Value value_,
}

bool
Debugger::receiveCompletionValue(Maybe<AutoCompartment> &ac, bool ok, Value val,
Debugger::receiveCompletionValue(Maybe<AutoCompartment> &ac, bool ok,
                                 HandleValue val,
                                 MutableHandleValue vp)
{
    JSContext *cx = ac.ref().context()->asJSContext();
+2 −1
Original line number Diff line number Diff line
@@ -531,7 +531,8 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
     * pending exception. (This ordinarily returns true even if the ok argument
     * is false.)
     */
    bool receiveCompletionValue(mozilla::Maybe<AutoCompartment> &ac, bool ok, Value val,
    bool receiveCompletionValue(mozilla::Maybe<AutoCompartment> &ac, bool ok,
                                HandleValue val,
                                MutableHandleValue vp);

    /*
+2 −2
Original line number Diff line number Diff line
@@ -363,13 +363,13 @@ AbstractFramePtr::setHookData(void *data) const
#endif
}

inline Value
inline HandleValue
AbstractFramePtr::returnValue() const
{
    if (isStackFrame())
        return asStackFrame()->returnValue();
#ifdef JS_ION
    return *asBaselineFrame()->returnValue();
    return asBaselineFrame()->returnValue();
#else
    MOZ_ASSUME_UNREACHABLE("Invalid frame");
#endif
Loading