diff --git a/js/src/jit/Bailouts.cpp b/js/src/jit/Bailouts.cpp index a55bd49e64b..16d3fc8460d 100644 --- a/js/src/jit/Bailouts.cpp +++ b/js/src/jit/Bailouts.cpp @@ -37,10 +37,10 @@ using namespace js::jit; // bailed out frame. SnapshotIterator::SnapshotIterator(const IonBailoutIterator &iter) - : SnapshotReader(iter.ionScript()->snapshots(), - iter.snapshotOffset(), - iter.ionScript()->snapshotsRVATableSize(), - iter.ionScript()->snapshotsListSize()), + : snapshot_(iter.ionScript()->snapshots(), + iter.snapshotOffset(), + iter.ionScript()->snapshotsRVATableSize(), + iter.ionScript()->snapshotsListSize()), fp_(iter.jsFrame()), machine_(iter.machineState()), ionScript_(iter.ionScript()) diff --git a/js/src/jit/IonFrameIterator.h b/js/src/jit/IonFrameIterator.h index 62d986d5586..59ee0ec51ee 100644 --- a/js/src/jit/IonFrameIterator.h +++ b/js/src/jit/IonFrameIterator.h @@ -246,8 +246,9 @@ class IonBailoutIterator; // Reads frame information in snapshot-encoding order (that is, outermost frame // to innermost frame). -class SnapshotIterator : public SnapshotReader +class SnapshotIterator { + SnapshotReader snapshot_; IonJSFrameLayout *fp_; MachineState machine_; IonScript *ionScript_; @@ -279,16 +280,56 @@ class SnapshotIterator : public SnapshotReader void warnUnreadableAllocation(); public: + // Handle iterating over RValueAllocations of the snapshots. + inline RValueAllocation readAllocation() { + return snapshot_.readAllocation(); + } + Value skip() { + readAllocation(); + return UndefinedValue(); + } + + inline uint32_t allocations() const { + return snapshot_.allocations(); + } + inline bool moreAllocations() const { + return snapshot_.moreAllocations(); + } + + public: + // Exhibits frame properties contained in the snapshot. + inline uint32_t pcOffset() const { + return snapshot_.pcOffset(); + } + inline bool resumeAfter() const { + return snapshot_.resumeAfter(); + } + inline BailoutKind bailoutKind() const { + return snapshot_.bailoutKind(); + } + + public: + // Handle iterating over frames of the snapshots. + inline void nextFrame() { + snapshot_.nextFrame(); + } + inline bool moreFrames() const { + return snapshot_.moreFrames(); + } + inline uint32_t frameCount() const { + return snapshot_.frameCount(); + } + + public: + // Connect all informations about the current script in order to recover the + // content of baseline frames. + SnapshotIterator(IonScript *ionScript, SnapshotOffset snapshotOffset, IonJSFrameLayout *fp, const MachineState &machine); SnapshotIterator(const IonFrameIterator &iter); SnapshotIterator(const IonBailoutIterator &iter); SnapshotIterator(); - Value skip() { - readAllocation(); - return UndefinedValue(); - } Value read() { return allocationValue(readAllocation()); } diff --git a/js/src/jit/IonFrames.cpp b/js/src/jit/IonFrames.cpp index f6b19d0b6a6..41399134690 100644 --- a/js/src/jit/IonFrames.cpp +++ b/js/src/jit/IonFrames.cpp @@ -1291,10 +1291,10 @@ OsiIndex::returnPointDisplacement() const SnapshotIterator::SnapshotIterator(IonScript *ionScript, SnapshotOffset snapshotOffset, IonJSFrameLayout *fp, const MachineState &machine) - : SnapshotReader(ionScript->snapshots(), - snapshotOffset, - ionScript->snapshotsRVATableSize(), - ionScript->snapshotsListSize()), + : snapshot_(ionScript->snapshots(), + snapshotOffset, + ionScript->snapshotsRVATableSize(), + ionScript->snapshotsListSize()), fp_(fp), machine_(machine), ionScript_(ionScript) @@ -1303,10 +1303,10 @@ SnapshotIterator::SnapshotIterator(IonScript *ionScript, SnapshotOffset snapshot } SnapshotIterator::SnapshotIterator(const IonFrameIterator &iter) - : SnapshotReader(iter.ionScript()->snapshots(), - iter.osiIndex()->snapshotOffset(), - iter.ionScript()->snapshotsRVATableSize(), - iter.ionScript()->snapshotsListSize()), + : snapshot_(iter.ionScript()->snapshots(), + iter.osiIndex()->snapshotOffset(), + iter.ionScript()->snapshotsRVATableSize(), + iter.ionScript()->snapshotsListSize()), fp_(iter.jsFrame()), machine_(iter.machineState()), ionScript_(iter.ionScript()) @@ -1314,7 +1314,7 @@ SnapshotIterator::SnapshotIterator(const IonFrameIterator &iter) } SnapshotIterator::SnapshotIterator() - : SnapshotReader(nullptr, 0, 0, 0), + : snapshot_(nullptr, 0, 0, 0), fp_(nullptr), ionScript_(nullptr) { diff --git a/js/src/jit/Snapshots.h b/js/src/jit/Snapshots.h index 6cbd541af51..726e1458540 100644 --- a/js/src/jit/Snapshots.h +++ b/js/src/jit/Snapshots.h @@ -394,12 +394,18 @@ class SnapshotReader SnapshotReader(const uint8_t *snapshots, uint32_t offset, uint32_t RVATableSize, uint32_t listSize); - uint32_t pcOffset() const { - return pcOffset_; - } uint32_t allocations() const { return allocCount_; } + RValueAllocation readAllocation(); + + bool moreAllocations() const { + return allocRead_ < allocCount_; + } + + uint32_t pcOffset() const { + return pcOffset_; + } BailoutKind bailoutKind() const { return bailoutKind_; } @@ -408,17 +414,13 @@ class SnapshotReader return false; return resumeAfter_; } + bool moreFrames() const { return framesRead_ < frameCount_; } void nextFrame() { readFrameHeader(); } - RValueAllocation readAllocation(); - - bool moreAllocations() const { - return allocRead_ < allocCount_; - } uint32_t frameCount() const { return frameCount_; }