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_Recover_h michael@0: #define jit_Recover_h michael@0: michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: #include "jit/Snapshots.h" michael@0: michael@0: namespace js { michael@0: namespace jit { michael@0: michael@0: class RResumePoint; michael@0: michael@0: class RInstruction michael@0: { michael@0: public: michael@0: enum Opcode michael@0: { michael@0: Recover_ResumePoint = 0 michael@0: }; michael@0: michael@0: virtual Opcode opcode() const = 0; michael@0: michael@0: bool isResumePoint() const { michael@0: return opcode() == Recover_ResumePoint; michael@0: } michael@0: inline const RResumePoint *toResumePoint() const; michael@0: michael@0: virtual uint32_t numOperands() const = 0; michael@0: michael@0: static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw); michael@0: }; michael@0: michael@0: class RResumePoint MOZ_FINAL : public RInstruction michael@0: { michael@0: private: michael@0: uint32_t pcOffset_; // Offset from script->code. michael@0: uint32_t numOperands_; // Number of slots. michael@0: michael@0: friend class RInstruction; michael@0: RResumePoint(CompactBufferReader &reader); michael@0: michael@0: public: michael@0: virtual Opcode opcode() const { michael@0: return Recover_ResumePoint; michael@0: } michael@0: michael@0: uint32_t pcOffset() const { michael@0: return pcOffset_; michael@0: } michael@0: virtual uint32_t numOperands() const { michael@0: return numOperands_; michael@0: } michael@0: }; michael@0: michael@0: const RResumePoint * michael@0: RInstruction::toResumePoint() const michael@0: { michael@0: MOZ_ASSERT(isResumePoint()); michael@0: return static_cast(this); michael@0: } michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif /* jit_Recover_h */