FrameIter-inl.h (1934B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- 2 * vim: set ts=8 sts=2 et sw=2 tw=80: 3 * This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef vm_FrameIter_inl_h 8 #define vm_FrameIter_inl_h 9 10 #include "vm/FrameIter.h" 11 12 #include "mozilla/Assertions.h" // MOZ_ASSERT, MOZ_CRASH 13 14 #include "jit/JSJitFrameIter.h" // js::jit::{InlineFrameIterator,MaybeReadFallback,ReadFrame_Actuals} 15 16 #include "vm/Stack-inl.h" // js::InterpreterFrame::unaliasedForEachActual 17 18 namespace js { 19 20 template <class Op> 21 inline void FrameIter::unaliasedForEachActual(JSContext* cx, Op op) { 22 switch (data_.state_) { 23 case DONE: 24 break; 25 case INTERP: 26 interpFrame()->unaliasedForEachActual(op); 27 return; 28 case JIT: 29 MOZ_ASSERT(isJSJit()); 30 if (jsJitFrame().isIonJS()) { 31 jit::MaybeReadFallback recover(cx, activation()->asJit(), 32 &jsJitFrame()); 33 ionInlineFrames_.unaliasedForEachActual(cx, op, recover); 34 } else if (jsJitFrame().isBailoutJS()) { 35 // :TODO: (Bug 1070962) If we are introspecting the frame which is 36 // being bailed, then we might be in the middle of recovering 37 // instructions. Stacking computeInstructionResults implies that we 38 // might be recovering result twice. In the mean time, to avoid 39 // that, we just return Undefined values for instruction results 40 // which are not yet recovered. 41 jit::MaybeReadFallback fallback; 42 ionInlineFrames_.unaliasedForEachActual(cx, op, fallback); 43 } else { 44 MOZ_ASSERT(jsJitFrame().isBaselineJS()); 45 jsJitFrame().unaliasedForEachActual(op); 46 } 47 return; 48 } 49 MOZ_CRASH("Unexpected state"); 50 } 51 52 } // namespace js 53 54 #endif // vm_FrameIter_inl_h