Backed out changeset 14212ea063c6 (bug 1271650)
authorSebastian Hengst <archaeopteryx@coole-files.de>
Tue, 05 Jul 2016 17:13:57 +0200
changeset 303710 a7a0676a43f2bb8b0693591ab75cd9cad36edbf1
parent 303709 7fbd728b1b01806d25fdea9c8dbb91fa7ef49b12
child 303711 a706323c0073b7cd72dc0c41a6601a91f15dea9b
push id79146
push userarchaeopteryx@coole-files.de
push dateTue, 05 Jul 2016 15:15:04 +0000
treeherdermozilla-inbound@a706323c0073 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1271650
milestone50.0a1
backs out14212ea063c65251bbaf8695636812cd6b245e0e
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 14212ea063c6 (bug 1271650)
js/src/vm/Debugger-inl.h
js/src/vm/Debugger.cpp
js/src/vm/Debugger.h
--- a/js/src/vm/Debugger-inl.h
+++ b/js/src/vm/Debugger-inl.h
@@ -81,34 +81,16 @@ js::Debugger::onNewWasmInstance(JSContex
 
 inline js::Debugger*
 js::DebuggerEnvironment::owner() const
 {
     JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
     return Debugger::fromJSObject(dbgobj);
 }
 
-inline js::AbstractFramePtr
-js::DebuggerFrame::referent() const
-{
-    AbstractFramePtr frame = AbstractFramePtr::FromRaw(getPrivate());
-    if (frame.isScriptFrameIterData()) {
-        ScriptFrameIter iter(*(ScriptFrameIter::Data*)(frame.raw()));
-        frame = iter.abstractFramePtr();
-    }
-    return frame;
-}
-
-inline js::Debugger*
-js::DebuggerFrame::owner() const
-{
-    JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
-    return Debugger::fromJSObject(dbgobj);
-}
-
 inline js::Debugger*
 js::DebuggerObject::owner() const
 {
     JSObject* dbgobj = &getReservedSlot(OWNER_SLOT).toObject();
     return Debugger::fromJSObject(dbgobj);
 }
 
 #endif /* vm_Debugger_inl_h */
--- a/js/src/vm/Debugger.cpp
+++ b/js/src/vm/Debugger.cpp
@@ -7034,32 +7034,16 @@ DebuggerFrame::create(JSContext* cx, Han
       frame.setPrivate(referent.raw());
   }
 
   frame.setReservedSlot(JSSLOT_DEBUGFRAME_OWNER, ObjectValue(*debugger));
 
   return &frame;
 }
 
-/* static */ bool
-DebuggerFrame::getCallee(JSContext* cx, Handle<DebuggerFrame*> frame,
-                         MutableHandle<DebuggerObject*> result)
-{
-    AbstractFramePtr referent = frame->referent();
-    if (!referent.isFunctionFrame()) {
-        result.set(nullptr);
-        return true;
-    }
-
-    Debugger* dbg = frame->owner();
-
-    RootedObject callee(cx, referent.callee());
-    return dbg->wrapDebuggeeObject(cx, callee, result);
-}
-
 static void
 UpdateFrameIterPc(FrameIter& iter)
 {
     if (iter.abstractFramePtr().isRematerializedFrame()) {
 #ifdef DEBUG
         // Rematerialized frames don't need their pc updated. The reason we
         // need to update pc is because we might get the same Debugger.Frame
         // object for multiple re-entries into debugger code from debuggee
@@ -7163,22 +7147,16 @@ DebuggerFrame::checkThis(JSContext* cx, 
  * by the AbstractFramePtr and cache its internal Data in the Debugger.Frame
  * object's private slot. Subsequent uses of the Debugger.Frame object will
  * always create a ScriptFrameIter from the cached Data.
  *
  * Methods that only need the AbstractFramePtr should use THIS_FRAME.
  * Methods that need a ScriptFrameIterator should use THIS_FRAME_ITER.
  */
 
-#define THIS_DEBUGGER_FRAME(cx, argc, vp, fnname, args, frame)                          \
-    CallArgs args = CallArgsFromVp(argc, vp);                                           \
-    Rooted<DebuggerFrame*> frame(cx, DebuggerFrame::checkThis(cx, args, fnname, true)); \
-    if (!frame)                                                                         \
-        return false;
-
 #define THIS_FRAME_THISOBJ(cx, argc, vp, fnname, args, thisobj)                       \
     CallArgs args = CallArgsFromVp(argc, vp);                                         \
     RootedNativeObject thisobj(cx, DebuggerFrame::checkThis(cx, args, fnname, true)); \
     if (!thisobj)                                                                     \
         return false
 
 #define THIS_FRAME(cx, argc, vp, fnname, args, thisobj, frame)                 \
     THIS_FRAME_THISOBJ(cx, argc, vp, fnname, args, thisobj);                   \
@@ -7273,26 +7251,24 @@ DebuggerFrame_getEnvironment(JSContext* 
         env = GetDebugScopeForFrame(cx, iter.abstractFramePtr(), iter.pc());
         if (!env)
             return false;
     }
 
     return dbg->wrapEnvironment(cx, env, args.rval());
 }
 
-/* static */ bool
-DebuggerFrame::calleeGetter(JSContext* cx, unsigned argc, Value* vp)
-{
-    THIS_DEBUGGER_FRAME(cx, argc, vp, "get callee", args, frame);
-
-    Rooted<DebuggerObject*> result(cx);
-    if (!DebuggerFrame::getCallee(cx, frame, &result))
-        return false;
-
-    args.rval().setObjectOrNull(result);
+static bool
+DebuggerFrame_getCallee(JSContext* cx, unsigned argc, Value* vp)
+{
+    THIS_FRAME(cx, argc, vp, "get callee", args, thisobj, frame);
+    RootedValue calleev(cx, frame.isFunctionFrame() ? frame.calleev() : NullValue());
+    if (!Debugger::fromChildJSObject(thisobj)->wrapDebuggeeValue(cx, &calleev))
+        return false;
+    args.rval().set(calleev);
     return true;
 }
 
 static bool
 DebuggerFrame_getGenerator(JSContext* cx, unsigned argc, Value* vp)
 {
     THIS_FRAME(cx, argc, vp, "get generator", args, thisobj, frame);
     args.rval().setBoolean(frame.script()->isGenerator());
@@ -7812,17 +7788,17 @@ DebuggerFrame::construct(JSContext* cx, 
 {
     JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
                          "Debugger.Frame");
     return false;
 }
 
 const JSPropertySpec DebuggerFrame::properties_[] = {
     JS_PSG("arguments", DebuggerFrame_getArguments, 0),
-    JS_PSG("callee", DebuggerFrame::calleeGetter, 0),
+    JS_PSG("callee", DebuggerFrame_getCallee, 0),
     JS_PSG("constructing", DebuggerFrame_getConstructing, 0),
     JS_PSG("environment", DebuggerFrame_getEnvironment, 0),
     JS_PSG("generator", DebuggerFrame_getGenerator, 0),
     JS_PSG("live", DebuggerFrame_getLive, 0),
     JS_PSG("offset", DebuggerFrame_getOffset, 0),
     JS_PSG("older", DebuggerFrame_getOlder, 0),
     JS_PSG("script", DebuggerFrame_getScript, 0),
     JS_PSG("this", DebuggerFrame_getThis, 0),
--- a/js/src/vm/Debugger.h
+++ b/js/src/vm/Debugger.h
@@ -1128,45 +1128,31 @@ class DebuggerEnvironment : public Nativ
     static MOZ_MUST_USE bool findMethod(JSContext* cx, unsigned argc, Value* vp);
     static MOZ_MUST_USE bool getVariableMethod(JSContext* cx, unsigned argc, Value* vp);
     static MOZ_MUST_USE bool setVariableMethod(JSContext* cx, unsigned argc, Value* vp);
 };
 
 class DebuggerFrame : public NativeObject
 {
   public:
-    enum {
-        OWNER_SLOT
-    };
-
-    static const unsigned RESERVED_SLOTS = 1;
-
     static const Class class_;
 
     static NativeObject* initClass(JSContext* cx, HandleObject dbgCtor, HandleObject objProto);
     static DebuggerFrame* create(JSContext* cx, HandleObject proto, AbstractFramePtr referent,
                                  const ScriptFrameIter* maybeIter, HandleNativeObject debugger);
     static DebuggerFrame* checkThis(JSContext* cx, const CallArgs& args, const char* fnname,
                                     bool checkLive);
 
-    static MOZ_MUST_USE bool getCallee(JSContext* cx, Handle<DebuggerFrame*> frame,
-                                       MutableHandle<DebuggerObject*> result);
-
   private:
     static const ClassOps classOps_;
 
     static const JSPropertySpec properties_[];
     static const JSFunctionSpec methods_[];
 
     static MOZ_MUST_USE bool construct(JSContext* cx, unsigned argc, Value* vp);
-
-    static MOZ_MUST_USE bool calleeGetter(JSContext* cx, unsigned argc, Value* vp);
-
-    AbstractFramePtr referent() const;
-    Debugger* owner() const;
 };
 
 class DebuggerObject : public NativeObject
 {
   public:
     static const Class class_;
 
     static NativeObject* initClass(JSContext* cx, HandleObject obj, HandleObject debugCtor);