Bug 1381930: Use delegating ctors for JitFrameIterator; r=nbp
authorBenjamin Bouvier <benj@benj.me>
Tue, 18 Jul 2017 19:36:25 +0200
changeset 418446 33cf2dcc5aaf1819ee5099defab131afb51e76fd
parent 418445 6b8a76e20661787f7b17e3a4c8ff1f030c30529b
child 418447 f15bf893f71fb75f4c8c4b3a17994c5531408368
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnbp
bugs1381930
milestone56.0a1
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
Bug 1381930: Use delegating ctors for JitFrameIterator; r=nbp MozReview-Commit-ID: 1tmUQ9yPQSd
js/src/jit/JitFrameIterator.h
js/src/jit/JitFrames.cpp
--- a/js/src/jit/JitFrameIterator.h
+++ b/js/src/jit/JitFrameIterator.h
@@ -94,16 +94,18 @@ class JitFrameIterator
     size_t frameSize_;
 
   private:
     mutable const SafepointIndex* cachedSafepointIndex_;
     const JitActivation* activation_;
 
     void dumpBaseline() const;
 
+    explicit JitFrameIterator(const JitActivation* activation);
+
   public:
     explicit JitFrameIterator();
     explicit JitFrameIterator(JSContext* cx);
     explicit JitFrameIterator(const ActivationIterator& activations);
 
     // Current frame information.
     FrameType type() const {
         return type_;
--- a/js/src/jit/JitFrames.cpp
+++ b/js/src/jit/JitFrames.cpp
@@ -101,44 +101,39 @@ JitFrameIterator::JitFrameIterator()
     type_(JitFrame_Exit),
     returnAddressToFp_(nullptr),
     frameSize_(0),
     cachedSafepointIndex_(nullptr),
     activation_(nullptr)
 {
 }
 
-JitFrameIterator::JitFrameIterator(JSContext* cx)
-  : current_(cx->activation()->asJit()->exitFP()),
+JitFrameIterator::JitFrameIterator(const JitActivation* activation)
+  : current_(activation->exitFP()),
     type_(JitFrame_Exit),
     returnAddressToFp_(nullptr),
     frameSize_(0),
     cachedSafepointIndex_(nullptr),
-    activation_(cx->activation()->asJit())
+    activation_(activation)
 {
     if (activation_->bailoutData()) {
         current_ = activation_->bailoutData()->fp();
         frameSize_ = activation_->bailoutData()->topFrameSize();
         type_ = JitFrame_Bailout;
     }
 }
 
+JitFrameIterator::JitFrameIterator(JSContext* cx)
+  : JitFrameIterator(cx->activation()->asJit())
+{
+}
+
 JitFrameIterator::JitFrameIterator(const ActivationIterator& activations)
-  : current_(activations->asJit()->exitFP()),
-    type_(JitFrame_Exit),
-    returnAddressToFp_(nullptr),
-    frameSize_(0),
-    cachedSafepointIndex_(nullptr),
-    activation_(activations->asJit())
+  : JitFrameIterator(activations->asJit())
 {
-    if (activation_->bailoutData()) {
-        current_ = activation_->bailoutData()->fp();
-        frameSize_ = activation_->bailoutData()->topFrameSize();
-        type_ = JitFrame_Bailout;
-    }
 }
 
 bool
 JitFrameIterator::checkInvalidation() const
 {
     IonScript* dummy;
     return checkInvalidation(&dummy);
 }
@@ -343,17 +338,18 @@ CloseLiveIteratorIon(JSContext* cx, cons
     // the destructuring case, we also need to get the "done" value.
     uint32_t stackSlot = tn->stackDepth;
     uint32_t adjust = isDestructuring ? 2 : 1;
     uint32_t skipSlots = NumArgAndLocalSlots(frame) + stackSlot - adjust;
 
     for (unsigned i = 0; i < skipSlots; i++)
         si.skip();
 
-    MaybeReadFallback recover(cx, cx->activation()->asJit(), &frame.frame(), MaybeReadFallback::Fallback_DoNothing);
+    MaybeReadFallback recover(cx, cx->activation()->asJit(), &frame.frame(),
+                              MaybeReadFallback::Fallback_DoNothing);
     Value v = si.maybeRead(recover);
     RootedObject iterObject(cx, &v.toObject());
 
     if (isDestructuring) {
         RootedValue doneValue(cx, si.read());
         bool done = ToBoolean(doneValue);
         // Do not call IteratorClose if the destructuring iterator is already
         // done.