Bug 808519 part 2 - Rename MaybeScriptFromCalleeToken and call it in GetTopIonJSScript. r=dvander
authorJan de Mooij <jdemooij@mozilla.com>
Mon, 05 Nov 2012 17:35:30 +0100
changeset 112315 9a13c51926cd2b73f6e98652b96b922330f30e7d
parent 112314 1cc2de645efdb3672bca63702742c54d91ca669c
child 112316 004a0714ba52dad0c7e0d82fd4b8f1f77d375f76
push id23812
push useremorley@mozilla.com
push dateTue, 06 Nov 2012 14:01:34 +0000
treeherdermozilla-central@f4aeed115e54 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdvander
bugs808519
milestone19.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 808519 part 2 - Rename MaybeScriptFromCalleeToken and call it in GetTopIonJSScript. r=dvander
js/src/ion/IonFrames-inl.h
js/src/ion/IonFrames.cpp
js/src/ion/IonFrames.h
--- a/js/src/ion/IonFrames-inl.h
+++ b/js/src/ion/IonFrames-inl.h
@@ -92,28 +92,18 @@ GetTopIonJSScript(JSContext *cx, const S
     // If needed, grab the safepoint index.
     if (safepointIndexOut)
         *safepointIndexOut = iter.safepoint();
 
     JS_ASSERT(iter.returnAddressToFp() != NULL);
     if (returnAddrOut)
         *returnAddrOut = (void *) iter.returnAddressToFp();
 
-    JS_ASSERT(iter.type() == IonFrame_OptimizedJS);
+    JS_ASSERT(iter.isScripted());
     IonJSFrameLayout *frame = static_cast<IonJSFrameLayout*>(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
 } // namespace js
 
 #endif // jsion_frames_inl_h__
 
--- a/js/src/ion/IonFrames.cpp
+++ b/js/src/ion/IonFrames.cpp
@@ -21,30 +21,16 @@
 #include "gc/Marking.h"
 #include "SnapshotReader.h"
 #include "Safepoints.h"
 #include "VMFunctions.h"
 
 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),
       returnAddressToFp_(NULL),
       frameSize_(0),
       cachedSafepointIndex_(NULL),
       activation_(activations.activation())
 {
@@ -169,17 +155,17 @@ IonFrameIterator::isEntryJSFrame() const
     return true;
 }
 
 JSScript *
 IonFrameIterator::script() const
 {
     AutoAssertNoGC nogc;
     JS_ASSERT(isScripted());
-    RawScript script = MaybeScriptFromCalleeToken(calleeToken());
+    RawScript script = ScriptFromCalleeToken(calleeToken());
     JS_ASSERT(script);
     return script;
 }
 
 Value *
 IonFrameIterator::nativeVp() const
 {
     JS_ASSERT(isNative());
--- a/js/src/ion/IonFrames.h
+++ b/js/src/ion/IonFrames.h
@@ -58,18 +58,30 @@ CalleeTokenToFunction(CalleeToken token)
     return (JSFunction *)token;
 }
 static inline JSScript *
 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
 // descriptor describes the size and type of the previous frame, whereas the
 // returnAddress describes the address the newer frame (the callee) will return
 // to. The exact mechanism in which frames are laid out is architecture
 // dependent.
 //