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_mips_Bailouts_mips_h michael@0: #define jit_mips_Bailouts_mips_h michael@0: michael@0: #include "jit/Bailouts.h" michael@0: #include "jit/JitCompartment.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: class BailoutStack michael@0: { michael@0: uintptr_t frameClassId_; michael@0: // This is pushed in the bailout handler. Both entry points into the michael@0: // handler inserts their own value int lr, which is then placed onto the michael@0: // stack along with frameClassId_ above. This should be migrated to ip. michael@0: public: michael@0: union { michael@0: uintptr_t frameSize_; michael@0: uintptr_t tableOffset_; michael@0: }; michael@0: michael@0: protected: michael@0: mozilla::Array fpregs_; michael@0: mozilla::Array regs_; michael@0: michael@0: uintptr_t snapshotOffset_; michael@0: uintptr_t padding_; michael@0: michael@0: public: michael@0: FrameSizeClass frameClass() const { michael@0: return FrameSizeClass::FromClass(frameClassId_); michael@0: } michael@0: uintptr_t tableOffset() const { michael@0: MOZ_ASSERT(frameClass() != FrameSizeClass::None()); michael@0: return tableOffset_; michael@0: } michael@0: uint32_t frameSize() const { michael@0: if (frameClass() == FrameSizeClass::None()) michael@0: return frameSize_; michael@0: return frameClass().frameSize(); michael@0: } michael@0: MachineState machine() { michael@0: return MachineState::FromBailout(regs_, fpregs_); michael@0: } michael@0: SnapshotOffset snapshotOffset() const { michael@0: MOZ_ASSERT(frameClass() == FrameSizeClass::None()); michael@0: return snapshotOffset_; michael@0: } michael@0: uint8_t *parentStackPointer() const { michael@0: if (frameClass() == FrameSizeClass::None()) michael@0: return (uint8_t *)this + sizeof(BailoutStack); michael@0: return (uint8_t *)this + offsetof(BailoutStack, snapshotOffset_); michael@0: } michael@0: static size_t offsetOfFrameClass() { michael@0: return offsetof(BailoutStack, frameClassId_); michael@0: } michael@0: static size_t offsetOfFrameSize() { michael@0: return offsetof(BailoutStack, frameSize_); michael@0: } michael@0: static size_t offsetOfFpRegs() { michael@0: return offsetof(BailoutStack, fpregs_); michael@0: } michael@0: static size_t offsetOfRegs() { michael@0: return offsetof(BailoutStack, regs_); michael@0: } michael@0: }; michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif /* jit_mips_Bailouts_mips_h */