1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/IonFrames-inl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,102 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_IonFrames_inl_h 1.11 +#define jit_IonFrames_inl_h 1.12 + 1.13 +#ifdef JS_ION 1.14 + 1.15 +#include "jit/IonFrames.h" 1.16 + 1.17 +#include "jit/JitFrameIterator.h" 1.18 +#include "jit/LIR.h" 1.19 +#include "vm/ForkJoin.h" 1.20 + 1.21 +#include "jit/JitFrameIterator-inl.h" 1.22 + 1.23 +namespace js { 1.24 +namespace jit { 1.25 + 1.26 +inline void 1.27 +SafepointIndex::resolve() 1.28 +{ 1.29 + JS_ASSERT(!resolved); 1.30 + safepointOffset_ = safepoint_->offset(); 1.31 +#ifdef DEBUG 1.32 + resolved = true; 1.33 +#endif 1.34 +} 1.35 + 1.36 +inline uint8_t * 1.37 +JitFrameIterator::returnAddress() const 1.38 +{ 1.39 + IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; 1.40 + return current->returnAddress(); 1.41 +} 1.42 + 1.43 +inline size_t 1.44 +JitFrameIterator::prevFrameLocalSize() const 1.45 +{ 1.46 + IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; 1.47 + return current->prevFrameLocalSize(); 1.48 +} 1.49 + 1.50 +inline FrameType 1.51 +JitFrameIterator::prevType() const 1.52 +{ 1.53 + IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; 1.54 + return current->prevType(); 1.55 +} 1.56 + 1.57 +inline bool 1.58 +JitFrameIterator::isFakeExitFrame() const 1.59 +{ 1.60 + bool res = (prevType() == JitFrame_Unwound_Rectifier || 1.61 + prevType() == JitFrame_Unwound_IonJS || 1.62 + prevType() == JitFrame_Unwound_BaselineStub || 1.63 + (prevType() == JitFrame_Entry && type() == JitFrame_Exit)); 1.64 + JS_ASSERT_IF(res, type() == JitFrame_Exit || type() == JitFrame_BaselineJS); 1.65 + return res; 1.66 +} 1.67 + 1.68 +inline IonExitFrameLayout * 1.69 +JitFrameIterator::exitFrame() const 1.70 +{ 1.71 + JS_ASSERT(type() == JitFrame_Exit); 1.72 + JS_ASSERT(!isFakeExitFrame()); 1.73 + return (IonExitFrameLayout *) fp(); 1.74 +} 1.75 + 1.76 +inline BaselineFrame * 1.77 +GetTopBaselineFrame(JSContext *cx) 1.78 +{ 1.79 + JitFrameIterator iter(cx); 1.80 + JS_ASSERT(iter.type() == JitFrame_Exit); 1.81 + ++iter; 1.82 + if (iter.isBaselineStub()) 1.83 + ++iter; 1.84 + JS_ASSERT(iter.isBaselineJS()); 1.85 + return iter.baselineFrame(); 1.86 +} 1.87 + 1.88 +inline JSScript * 1.89 +GetTopIonJSScript(JSContext *cx, void **returnAddrOut = nullptr) 1.90 +{ 1.91 + return GetTopIonJSScript(cx->mainThread().ionTop, returnAddrOut, SequentialExecution); 1.92 +} 1.93 + 1.94 +inline JSScript * 1.95 +GetTopIonJSScript(ForkJoinContext *cx, void **returnAddrOut = nullptr) 1.96 +{ 1.97 + return GetTopIonJSScript(cx->perThreadData->ionTop, returnAddrOut, ParallelExecution); 1.98 +} 1.99 + 1.100 +} // namespace jit 1.101 +} // namespace js 1.102 + 1.103 +#endif // JS_ION 1.104 + 1.105 +#endif /* jit_IonFrames_inl_h */