Bug 1022891 - Part 3: Fix instantiating InlineFrameIterator from inside InlineFrameIterator when settled on a bailout frame. (r=nbp)

This commit is contained in:
Shu-yu Guo 2014-06-12 12:46:17 -07:00
Родитель a09ed4d7c2
Коммит d4bc71c172
7 изменённых файлов: 57 добавлений и 15 удалений

Просмотреть файл

@ -192,6 +192,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
: JitFrameIterator(activations),
machine_(frame.machineState())
{
kind_ = Kind_BailoutIterator;
returnAddressToFp_ = frame.returnAddressToFp();
topIonScript_ = frame.ionScript();
const OsiIndex *osiIndex = frame.osiIndex();

Просмотреть файл

@ -83,20 +83,23 @@ JitFrameIterator::JitFrameIterator(ThreadSafeContext *cx)
type_(JitFrame_Exit),
returnAddressToFp_(nullptr),
frameSize_(0),
mode_(cx->isForkJoinContext() ? ParallelExecution : SequentialExecution),
kind_(Kind_FrameIterator),
cachedSafepointIndex_(nullptr),
activation_(nullptr),
mode_(cx->isForkJoinContext() ? ParallelExecution : SequentialExecution)
activation_(nullptr)
{
}
JitFrameIterator::JitFrameIterator(const ActivationIterator &activations)
: current_(activations.jitTop()),
type_(JitFrame_Exit),
returnAddressToFp_(nullptr),
frameSize_(0),
cachedSafepointIndex_(nullptr),
activation_(activations->asJit()),
mode_(activation_->cx()->isForkJoinContext() ? ParallelExecution : SequentialExecution)
: current_(activations.jitTop()),
type_(JitFrame_Exit),
returnAddressToFp_(nullptr),
frameSize_(0),
mode_(activations->asJit()->cx()->isForkJoinContext() ? ParallelExecution
: SequentialExecution),
kind_(Kind_FrameIterator),
cachedSafepointIndex_(nullptr),
activation_(activations->asJit())
{
}
@ -105,10 +108,25 @@ JitFrameIterator::JitFrameIterator(IonJSFrameLayout *fp, ExecutionMode mode)
type_(JitFrame_IonJS),
returnAddressToFp_(fp->returnAddress()),
frameSize_(fp->prevFrameLocalSize()),
mode_(mode)
mode_(mode),
kind_(Kind_FrameIterator)
{
}
IonBailoutIterator *
JitFrameIterator::asBailoutIterator()
{
MOZ_ASSERT(isBailoutIterator());
return static_cast<IonBailoutIterator *>(this);
}
const IonBailoutIterator *
JitFrameIterator::asBailoutIterator() const
{
MOZ_ASSERT(isBailoutIterator());
return static_cast<const IonBailoutIterator *>(this);
}
bool
JitFrameIterator::checkInvalidation() const
{
@ -1761,7 +1779,11 @@ InlineFrameIterator::InlineFrameIterator(ThreadSafeContext *cx, const InlineFram
script_(cx)
{
if (frame_) {
start_ = SnapshotIterator(*frame_);
if (frame_->isBailoutIterator())
start_ = SnapshotIterator(*frame_->asBailoutIterator());
else
start_ = SnapshotIterator(*frame_);
// findNextFrame will iterate to the next frame and init. everything.
// Therefore to settle on the same frame, we report one frame less readed.
framesRead_ = iter->framesRead_ - 1;

Просмотреть файл

@ -76,6 +76,7 @@ enum ReadFrameArgsBehavior {
class IonCommonFrameLayout;
class IonJSFrameLayout;
class IonExitFrameLayout;
class IonBailoutIterator;
class BaselineFrame;
@ -88,11 +89,15 @@ class JitFrameIterator
FrameType type_;
uint8_t *returnAddressToFp_;
size_t frameSize_;
ExecutionMode mode_;
enum Kind {
Kind_FrameIterator,
Kind_BailoutIterator
} kind_;
private:
mutable const SafepointIndex *cachedSafepointIndex_;
const JitActivation *activation_;
ExecutionMode mode_;
void dumpBaseline() const;
@ -102,15 +107,22 @@ class JitFrameIterator
type_(JitFrame_Exit),
returnAddressToFp_(nullptr),
frameSize_(0),
mode_(mode),
kind_(Kind_FrameIterator),
cachedSafepointIndex_(nullptr),
activation_(nullptr),
mode_(mode)
activation_(nullptr)
{ }
explicit JitFrameIterator(ThreadSafeContext *cx);
explicit JitFrameIterator(const ActivationIterator &activations);
explicit JitFrameIterator(IonJSFrameLayout *fp, ExecutionMode mode);
bool isBailoutIterator() const {
return kind_ == Kind_BailoutIterator;
}
IonBailoutIterator *asBailoutIterator();
const IonBailoutIterator *asBailoutIterator() const;
// Current frame information.
FrameType type() const {
return type_;
@ -247,7 +259,6 @@ class JitFrameIterator
};
class IonJSFrameLayout;
class IonBailoutIterator;
class RResumePoint;

Просмотреть файл

@ -76,6 +76,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
uint8_t *sp = bailout->parentStackPointer();
uint8_t *fp = sp + bailout->frameSize();
kind_ = Kind_BailoutIterator;
current_ = fp;
type_ = JitFrame_IonJS;
topFrameSize_ = current_ - sp;
@ -112,6 +113,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
: JitFrameIterator(activations),
machine_(bailout->machine())
{
kind_ = Kind_BailoutIterator;
returnAddressToFp_ = bailout->osiPointReturnAddress();
topIonScript_ = bailout->ionScript();
const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_);

Просмотреть файл

@ -20,6 +20,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
uint8_t *sp = bailout->parentStackPointer();
uint8_t *fp = sp + bailout->frameSize();
kind_ = Kind_BailoutIterator;
current_ = fp;
type_ = JitFrame_IonJS;
topFrameSize_ = current_ - sp;
@ -56,6 +57,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
: JitFrameIterator(activations),
machine_(bailout->machine())
{
kind_ = Kind_BailoutIterator;
returnAddressToFp_ = bailout->osiPointReturnAddress();
topIonScript_ = bailout->ionScript();
const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_);

Просмотреть файл

@ -53,6 +53,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
uint8_t *sp = bailout->parentStackPointer();
uint8_t *fp = sp + bailout->frameSize();
kind_ = Kind_BailoutIterator;
current_ = fp;
type_ = JitFrame_IonJS;
topFrameSize_ = current_ - sp;
@ -69,6 +70,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
: JitFrameIterator(activations),
machine_(bailout->machine())
{
kind_ = Kind_BailoutIterator;
returnAddressToFp_ = bailout->osiPointReturnAddress();
topIonScript_ = bailout->ionScript();
const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_);

Просмотреть файл

@ -73,6 +73,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
uint8_t *sp = bailout->parentStackPointer();
uint8_t *fp = sp + bailout->frameSize();
kind_ = Kind_BailoutIterator;
current_ = fp;
type_ = JitFrame_IonJS;
topFrameSize_ = current_ - sp;
@ -109,6 +110,7 @@ IonBailoutIterator::IonBailoutIterator(const JitActivationIterator &activations,
: JitFrameIterator(activations),
machine_(bailout->machine())
{
kind_ = Kind_BailoutIterator;
returnAddressToFp_ = bailout->osiPointReturnAddress();
topIonScript_ = bailout->ionScript();
const OsiIndex *osiIndex = topIonScript_->getOsiIndex(returnAddressToFp_);