Bug 891215 (part 10) - Slim down IonFrames-inl.h. r=terrence.

--HG--
extra : rebase_source : 4f47ec9244cbfa8e359d792e5ba825bfaad2db57
This commit is contained in:
Nicholas Nethercote 2013-07-08 23:03:03 -07:00
parent 1edc87a1fd
commit f7f6c920e8
4 changed files with 65 additions and 72 deletions

View File

@ -110,7 +110,10 @@ class IonFrameIterator
return current_;
}
inline IonCommonFrameLayout *current() const;
IonCommonFrameLayout *current() const {
return (IonCommonFrameLayout *)current_;
}
inline uint8_t *returnAddress() const;
IonJSFrameLayout *jsFrame() const {
@ -177,7 +180,10 @@ class IonFrameIterator
// Returns the stack space used by the current frame, in bytes. This does
// not include the size of its fixed header.
inline size_t frameSize() const;
size_t frameSize() const {
JS_ASSERT(type_ != IonFrame_Exit);
return frameSize_;
}
// Functions used to iterate on frames. When prevType is IonFrame_Entry,
// the current frame is the last frame.

View File

@ -26,37 +26,6 @@ SafepointIndex::resolve()
resolved = true;
}
static inline size_t
SizeOfFramePrefix(FrameType type)
{
switch (type) {
case IonFrame_Entry:
return IonEntryFrameLayout::Size();
case IonFrame_BaselineJS:
case IonFrame_OptimizedJS:
case IonFrame_Unwound_OptimizedJS:
return IonJSFrameLayout::Size();
case IonFrame_BaselineStub:
return IonBaselineStubFrameLayout::Size();
case IonFrame_Rectifier:
return IonRectifierFrameLayout::Size();
case IonFrame_Unwound_Rectifier:
return IonUnwoundRectifierFrameLayout::Size();
case IonFrame_Exit:
return IonExitFrameLayout::Size();
case IonFrame_Osr:
return IonOsrFrameLayout::Size();
default:
MOZ_ASSUME_UNREACHABLE("unknown frame type");
}
}
inline IonCommonFrameLayout *
IonFrameIterator::current() const
{
return (IonCommonFrameLayout *)current_;
}
inline uint8_t *
IonFrameIterator::returnAddress() const
{
@ -96,45 +65,6 @@ IonFrameIterator::exitFrame() const
return (IonExitFrameLayout *) fp();
}
size_t
IonFrameIterator::frameSize() const
{
JS_ASSERT(type_ != IonFrame_Exit);
return frameSize_;
}
// Returns the JSScript associated with the topmost Ion frame.
inline JSScript *
GetTopIonJSScript(PerThreadData *pt, const SafepointIndex **safepointIndexOut, void **returnAddrOut)
{
IonFrameIterator iter(pt->ionTop);
JS_ASSERT(iter.type() == IonFrame_Exit);
++iter;
// If needed, grab the safepoint index.
if (safepointIndexOut)
*safepointIndexOut = iter.safepoint();
JS_ASSERT(iter.returnAddressToFp() != NULL);
if (returnAddrOut)
*returnAddrOut = (void *) iter.returnAddressToFp();
if (iter.isBaselineStub()) {
++iter;
JS_ASSERT(iter.isBaselineJS());
}
JS_ASSERT(iter.isScripted());
return iter.script();
}
inline JSScript *
GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut, void **returnAddrOut)
{
return GetTopIonJSScript(&cx->mainThread(), safepointIndexOut, returnAddrOut);
}
inline BaselineFrame *
GetTopBaselineFrame(JSContext *cx)
{

View File

@ -233,6 +233,31 @@ IonFrameIterator::actualArgs() const
return jsFrame()->argv() + 1;
}
static inline size_t
SizeOfFramePrefix(FrameType type)
{
switch (type) {
case IonFrame_Entry:
return IonEntryFrameLayout::Size();
case IonFrame_BaselineJS:
case IonFrame_OptimizedJS:
case IonFrame_Unwound_OptimizedJS:
return IonJSFrameLayout::Size();
case IonFrame_BaselineStub:
return IonBaselineStubFrameLayout::Size();
case IonFrame_Rectifier:
return IonRectifierFrameLayout::Size();
case IonFrame_Unwound_Rectifier:
return IonUnwoundRectifierFrameLayout::Size();
case IonFrame_Exit:
return IonExitFrameLayout::Size();
case IonFrame_Osr:
return IonOsrFrameLayout::Size();
default:
MOZ_ASSUME_UNREACHABLE("unknown frame type");
}
}
uint8_t *
IonFrameIterator::prevFp() const
{

View File

@ -11,6 +11,7 @@
#include "mozilla/DebugOnly.h"
#include "jscntxt.h"
#include "jsfun.h"
#include "jstypes.h"
#include "jsutil.h"
@ -284,6 +285,37 @@ MakeFrameDescriptor(uint32_t frameSize, FrameType type)
return (frameSize << FRAMESIZE_SHIFT) | type;
}
// Returns the JSScript associated with the topmost Ion frame.
inline JSScript *
GetTopIonJSScript(PerThreadData *pt, const SafepointIndex **safepointIndexOut, void **returnAddrOut)
{
IonFrameIterator iter(pt->ionTop);
JS_ASSERT(iter.type() == IonFrame_Exit);
++iter;
// If needed, grab the safepoint index.
if (safepointIndexOut)
*safepointIndexOut = iter.safepoint();
JS_ASSERT(iter.returnAddressToFp() != NULL);
if (returnAddrOut)
*returnAddrOut = (void *) iter.returnAddressToFp();
if (iter.isBaselineStub()) {
++iter;
JS_ASSERT(iter.isBaselineJS());
}
JS_ASSERT(iter.isScripted());
return iter.script();
}
inline JSScript *
GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut, void **returnAddrOut)
{
return GetTopIonJSScript(&cx->mainThread(), safepointIndexOut, returnAddrOut);
}
} // namespace ion
} // namespace js