Bug 836742 part 2 - Move EnsureExitFrame to IonFrames.cpp, rename IonFrame_Bailed_*. r=nbp

This commit is contained in:
Jan de Mooij 2013-02-09 13:49:07 +01:00
Родитель bcbd213cc7
Коммит 45e4ad6dfd
8 изменённых файлов: 50 добавлений и 47 удалений

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

@ -344,28 +344,6 @@ ConvertFrames(JSContext *cx, IonActivation *activation, IonBailoutIterator &it)
return BAILOUT_RETURN_FATAL_ERROR;
}
static inline void
EnsureExitFrame(IonCommonFrameLayout *frame)
{
if (frame->prevType() == IonFrame_Entry) {
// The previous frame type is the entry frame, so there's no actual
// need for an exit frame.
return;
}
if (frame->prevType() == IonFrame_Rectifier) {
// The rectifier code uses the frame descriptor to discard its stack,
// so modifying its descriptor size here would be dangerous. Instead,
// we change the frame type, and teach the stack walking code how to
// deal with this edge case. bug 717297 would obviate the need
frame->changePrevType(IonFrame_Bailed_Rectifier);
return;
}
JS_ASSERT(frame->prevType() == IonFrame_OptimizedJS);
frame->changePrevType(IonFrame_Bailed_JS);
}
uint32_t
ion::Bailout(BailoutStack *sp)
{

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

@ -1897,11 +1897,11 @@ InvalidateActivation(FreeOp *fop, uint8_t *ionTop, bool invalidateAll)
case IonFrame_Rectifier:
IonSpew(IonSpew_Invalidate, "#%d rectifier frame @ %p", frameno, it.fp());
break;
case IonFrame_Bailed_JS:
case IonFrame_Unwound_OptimizedJS:
JS_NOT_REACHED("invalid");
break;
case IonFrame_Bailed_Rectifier:
IonSpew(IonSpew_Invalidate, "#%d bailed rectifier frame @ %p", frameno, it.fp());
case IonFrame_Unwound_Rectifier:
IonSpew(IonSpew_Invalidate, "#%d unwound rectifier frame @ %p", frameno, it.fp());
break;
case IonFrame_Osr:
IonSpew(IonSpew_Invalidate, "#%d osr frame @ %p", frameno, it.fp());

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

@ -32,13 +32,14 @@ enum FrameType
// mismatches in calls.
IonFrame_Rectifier,
// A bailed JS frame is a JS frame signalling that its callee has been
// bailed out.
IonFrame_Bailed_JS,
// An unwound JS frame is a JS frame signalling that its callee frame has been
// turned into an exit frame (see EnsureExitFrame). Used by Ion bailouts and
// Baseline exception unwinding.
IonFrame_Unwound_OptimizedJS,
// A bailed rectifier frame is a rectifier frame signalling that its callee
// has been bailed out.
IonFrame_Bailed_Rectifier,
// An unwound rectifier frame is a rectifier frame signalling that its callee
// frame has been turned into an exit frame (see EnsureExitFrame).
IonFrame_Unwound_Rectifier,
// An exit frame is necessary for transitioning from a JS frame into C++.
// From within C++, an exit frame is always the last frame in any

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

@ -30,12 +30,12 @@ SizeOfFramePrefix(FrameType type)
case IonFrame_Entry:
return IonEntryFrameLayout::Size();
case IonFrame_OptimizedJS:
case IonFrame_Bailed_JS:
case IonFrame_Unwound_OptimizedJS:
return IonJSFrameLayout::Size();
case IonFrame_Rectifier:
return IonRectifierFrameLayout::Size();
case IonFrame_Bailed_Rectifier:
return IonBailedRectifierFrameLayout::Size();
case IonFrame_Unwound_Rectifier:
return IonUnwoundRectifierFrameLayout::Size();
case IonFrame_Exit:
return IonExitFrameLayout::Size();
case IonFrame_Osr:

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

@ -140,7 +140,7 @@ IonFrameIterator::isFunctionFrame() const
bool
IonFrameIterator::isEntryJSFrame() const
{
if (prevType() == IonFrame_OptimizedJS || prevType() == IonFrame_Bailed_JS)
if (prevType() == IonFrame_OptimizedJS || prevType() == IonFrame_Unwound_OptimizedJS)
return false;
if (prevType() == IonFrame_Entry)
@ -185,7 +185,7 @@ IonFrameIterator::prevFp() const
// This quick fix must be removed as soon as bug 717297 land. This is
// needed because the descriptor size of JS-to-JS frame which is just after
// a Rectifier frame should not change. (cf EnsureExitFrame function)
if (prevType() == IonFrame_Bailed_Rectifier || prevType() == IonFrame_Bailed_JS) {
if (prevType() == IonFrame_Unwound_Rectifier || prevType() == IonFrame_Unwound_OptimizedJS) {
JS_ASSERT(type_ == IonFrame_Exit);
currentSize = SizeOfFramePrefix(IonFrame_OptimizedJS);
}
@ -212,7 +212,7 @@ IonFrameIterator::operator++()
// next frame.
uint8_t *prev = prevFp();
type_ = current()->prevType();
if (type_ == IonFrame_Bailed_JS)
if (type_ == IonFrame_Unwound_OptimizedJS)
type_ = IonFrame_OptimizedJS;
returnAddressToFp_ = current()->returnAddress();
current_ = prev;
@ -349,6 +349,28 @@ ion::HandleException(ResumeFromException *rfe)
rfe->stackPointer = iter.fp();
}
void
ion::EnsureExitFrame(IonCommonFrameLayout *frame)
{
if (frame->prevType() == IonFrame_Entry) {
// The previous frame type is the entry frame, so there's no actual
// need for an exit frame.
return;
}
if (frame->prevType() == IonFrame_Rectifier) {
// The rectifier code uses the frame descriptor to discard its stack,
// so modifying its descriptor size here would be dangerous. Instead,
// we change the frame type, and teach the stack walking code how to
// deal with this edge case. bug 717297 would obviate the need
frame->changePrevType(IonFrame_Unwound_Rectifier);
return;
}
JS_ASSERT(frame->prevType() == IonFrame_OptimizedJS);
frame->changePrevType(IonFrame_Unwound_OptimizedJS);
}
void
IonActivationIterator::settle()
{
@ -634,11 +656,11 @@ MarkIonActivation(JSTracer *trc, const IonActivationIterator &activations)
case IonFrame_OptimizedJS:
MarkIonJSFrame(trc, frames);
break;
case IonFrame_Bailed_JS:
case IonFrame_Unwound_OptimizedJS:
JS_NOT_REACHED("invalid");
break;
case IonFrame_Rectifier:
case IonFrame_Bailed_Rectifier:
case IonFrame_Unwound_Rectifier:
break;
case IonFrame_Osr:
// The callee token will be marked by the callee JS frame;
@ -1126,12 +1148,12 @@ IonFrameIterator::dump() const
break;
}
case IonFrame_Rectifier:
case IonFrame_Bailed_Rectifier:
case IonFrame_Unwound_Rectifier:
fprintf(stderr, " Rectifier frame\n");
fprintf(stderr, " Frame size: %u\n", unsigned(current()->prevFrameLocalSize()));
break;
case IonFrame_Bailed_JS:
fprintf(stderr, "Warning! Bailed JS frames are not observable.\n");
case IonFrame_Unwound_OptimizedJS:
fprintf(stderr, "Warning! Unwound JS frames are not observable.\n");
break;
case IonFrame_Exit:
break;

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

@ -248,6 +248,8 @@ struct ResumeFromException
void HandleException(ResumeFromException *rfe);
void EnsureExitFrame(IonCommonFrameLayout *frame);
void MarkIonActivations(JSRuntime *rt, JSTracer *trc);
void MarkIonCompilerRoots(JSTracer *trc);

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

@ -110,14 +110,14 @@ class IonRectifierFrameLayout : public IonJSFrameLayout
}
};
class IonBailedRectifierFrameLayout : public IonJSFrameLayout
class IonUnwoundRectifierFrameLayout : public IonJSFrameLayout
{
public:
static inline size_t Size() {
// On X86, there is a +sizeof(uintptr_t) to account for an extra callee token.
// This is not needee here because sizeof(IonExitFrame) == sizeof(IonRectifierFrame)
// This is not needed here because sizeof(IonExitFrame) == sizeof(IonRectifierFrame)
// due to extra padding.
return sizeof(IonBailedRectifierFrameLayout);
return sizeof(IonUnwoundRectifierFrameLayout);
}
};

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

@ -106,11 +106,11 @@ class IonRectifierFrameLayout : public IonJSFrameLayout
};
// The callee token is now dead.
class IonBailedRectifierFrameLayout : public IonRectifierFrameLayout
class IonUnwoundRectifierFrameLayout : public IonRectifierFrameLayout
{
public:
static inline size_t Size() {
return sizeof(IonBailedRectifierFrameLayout);
return sizeof(IonUnwoundRectifierFrameLayout);
}
};