From 56817aeb782012b617b94641cc073213d887e01f Mon Sep 17 00:00:00 2001 From: Jan de Mooij Date: Mon, 5 Nov 2012 17:35:30 +0100 Subject: [PATCH] Bug 808519 part 2 - Rename MaybeScriptFromCalleeToken and call it in GetTopIonJSScript. r=dvander --- js/src/ion/IonFrames-inl.h | 14 ++------------ js/src/ion/IonFrames.cpp | 16 +--------------- js/src/ion/IonFrames.h | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 29 deletions(-) diff --git a/js/src/ion/IonFrames-inl.h b/js/src/ion/IonFrames-inl.h index a8f9d3e94f31..1a0a7a3f94c5 100644 --- a/js/src/ion/IonFrames-inl.h +++ b/js/src/ion/IonFrames-inl.h @@ -97,19 +97,9 @@ GetTopIonJSScript(JSContext *cx, const SafepointIndex **safepointIndexOut, void if (returnAddrOut) *returnAddrOut = (void *) iter.returnAddressToFp(); - JS_ASSERT(iter.type() == IonFrame_OptimizedJS); + JS_ASSERT(iter.isScripted()); IonJSFrameLayout *frame = static_cast(iter.current()); - switch (GetCalleeTokenTag(frame->calleeToken())) { - case CalleeToken_Function: { - JSFunction *fun = CalleeTokenToFunction(frame->calleeToken()); - return fun->script(); - } - case CalleeToken_Script: - return CalleeTokenToScript(frame->calleeToken()); - default: - JS_NOT_REACHED("unexpected callee token kind"); - return NULL; - } + return ScriptFromCalleeToken(frame->calleeToken()); } } // namespace ion diff --git a/js/src/ion/IonFrames.cpp b/js/src/ion/IonFrames.cpp index 4d62cb3a764f..4d27f03a2c61 100644 --- a/js/src/ion/IonFrames.cpp +++ b/js/src/ion/IonFrames.cpp @@ -26,20 +26,6 @@ using namespace js; using namespace js::ion; -JSScript * -ion::MaybeScriptFromCalleeToken(CalleeToken token) -{ - AutoAssertNoGC nogc; - switch (GetCalleeTokenTag(token)) { - case CalleeToken_Script: - return CalleeTokenToScript(token); - case CalleeToken_Function: - return CalleeTokenToFunction(token)->script(); - } - JS_NOT_REACHED("invalid callee token tag"); - return NULL; -} - IonFrameIterator::IonFrameIterator(const IonActivationIterator &activations) : current_(activations.top()), type_(IonFrame_Exit), @@ -174,7 +160,7 @@ IonFrameIterator::script() const { AutoAssertNoGC nogc; JS_ASSERT(isScripted()); - RawScript script = MaybeScriptFromCalleeToken(calleeToken()); + RawScript script = ScriptFromCalleeToken(calleeToken()); JS_ASSERT(script); return script; } diff --git a/js/src/ion/IonFrames.h b/js/src/ion/IonFrames.h index f59b36d89e43..559f0de3b9ce 100644 --- a/js/src/ion/IonFrames.h +++ b/js/src/ion/IonFrames.h @@ -63,8 +63,20 @@ CalleeTokenToScript(CalleeToken token) JS_ASSERT(GetCalleeTokenTag(token) == CalleeToken_Script); return (JSScript *)(uintptr_t(token) & ~uintptr_t(0x3)); } -JSScript * -MaybeScriptFromCalleeToken(CalleeToken token); + +static inline JSScript * +ScriptFromCalleeToken(CalleeToken token) +{ + AutoAssertNoGC nogc; + switch (GetCalleeTokenTag(token)) { + case CalleeToken_Script: + return CalleeTokenToScript(token); + case CalleeToken_Function: + return CalleeTokenToFunction(token)->script(); + } + JS_NOT_REACHED("invalid callee token tag"); + return NULL; +} // In between every two frames lies a small header describing both frames. This // header, minimally, contains a returnAddress word and a descriptor word. The