Bug 983598 part 1 - Remove inheritance of the SnapshotReader. r=jandem

This commit is contained in:
Nicolas B. Pierron 2014-03-28 00:17:28 -07:00
parent 30312de3dd
commit 0374ea00bb
4 changed files with 69 additions and 26 deletions

View File

@ -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())

View File

@ -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());
}

View File

@ -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)
{

View File

@ -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_;
}