michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef jit_IonFrames_inl_h michael@0: #define jit_IonFrames_inl_h michael@0: michael@0: #ifdef JS_ION michael@0: michael@0: #include "jit/IonFrames.h" michael@0: michael@0: #include "jit/JitFrameIterator.h" michael@0: #include "jit/LIR.h" michael@0: #include "vm/ForkJoin.h" michael@0: michael@0: #include "jit/JitFrameIterator-inl.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: inline void michael@0: SafepointIndex::resolve() michael@0: { michael@0: JS_ASSERT(!resolved); michael@0: safepointOffset_ = safepoint_->offset(); michael@0: #ifdef DEBUG michael@0: resolved = true; michael@0: #endif michael@0: } michael@0: michael@0: inline uint8_t * michael@0: JitFrameIterator::returnAddress() const michael@0: { michael@0: IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; michael@0: return current->returnAddress(); michael@0: } michael@0: michael@0: inline size_t michael@0: JitFrameIterator::prevFrameLocalSize() const michael@0: { michael@0: IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; michael@0: return current->prevFrameLocalSize(); michael@0: } michael@0: michael@0: inline FrameType michael@0: JitFrameIterator::prevType() const michael@0: { michael@0: IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; michael@0: return current->prevType(); michael@0: } michael@0: michael@0: inline bool michael@0: JitFrameIterator::isFakeExitFrame() const michael@0: { michael@0: bool res = (prevType() == JitFrame_Unwound_Rectifier || michael@0: prevType() == JitFrame_Unwound_IonJS || michael@0: prevType() == JitFrame_Unwound_BaselineStub || michael@0: (prevType() == JitFrame_Entry && type() == JitFrame_Exit)); michael@0: JS_ASSERT_IF(res, type() == JitFrame_Exit || type() == JitFrame_BaselineJS); michael@0: return res; michael@0: } michael@0: michael@0: inline IonExitFrameLayout * michael@0: JitFrameIterator::exitFrame() const michael@0: { michael@0: JS_ASSERT(type() == JitFrame_Exit); michael@0: JS_ASSERT(!isFakeExitFrame()); michael@0: return (IonExitFrameLayout *) fp(); michael@0: } michael@0: michael@0: inline BaselineFrame * michael@0: GetTopBaselineFrame(JSContext *cx) michael@0: { michael@0: JitFrameIterator iter(cx); michael@0: JS_ASSERT(iter.type() == JitFrame_Exit); michael@0: ++iter; michael@0: if (iter.isBaselineStub()) michael@0: ++iter; michael@0: JS_ASSERT(iter.isBaselineJS()); michael@0: return iter.baselineFrame(); michael@0: } michael@0: michael@0: inline JSScript * michael@0: GetTopIonJSScript(JSContext *cx, void **returnAddrOut = nullptr) michael@0: { michael@0: return GetTopIonJSScript(cx->mainThread().ionTop, returnAddrOut, SequentialExecution); michael@0: } michael@0: michael@0: inline JSScript * michael@0: GetTopIonJSScript(ForkJoinContext *cx, void **returnAddrOut = nullptr) michael@0: { michael@0: return GetTopIonJSScript(cx->perThreadData->ionTop, returnAddrOut, ParallelExecution); michael@0: } michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif // JS_ION michael@0: michael@0: #endif /* jit_IonFrames_inl_h */