1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/Recover.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,71 @@ 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_Recover_h 1.11 +#define jit_Recover_h 1.12 + 1.13 +#include "mozilla/Attributes.h" 1.14 + 1.15 +#include "jit/Snapshots.h" 1.16 + 1.17 +namespace js { 1.18 +namespace jit { 1.19 + 1.20 +class RResumePoint; 1.21 + 1.22 +class RInstruction 1.23 +{ 1.24 + public: 1.25 + enum Opcode 1.26 + { 1.27 + Recover_ResumePoint = 0 1.28 + }; 1.29 + 1.30 + virtual Opcode opcode() const = 0; 1.31 + 1.32 + bool isResumePoint() const { 1.33 + return opcode() == Recover_ResumePoint; 1.34 + } 1.35 + inline const RResumePoint *toResumePoint() const; 1.36 + 1.37 + virtual uint32_t numOperands() const = 0; 1.38 + 1.39 + static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw); 1.40 +}; 1.41 + 1.42 +class RResumePoint MOZ_FINAL : public RInstruction 1.43 +{ 1.44 + private: 1.45 + uint32_t pcOffset_; // Offset from script->code. 1.46 + uint32_t numOperands_; // Number of slots. 1.47 + 1.48 + friend class RInstruction; 1.49 + RResumePoint(CompactBufferReader &reader); 1.50 + 1.51 + public: 1.52 + virtual Opcode opcode() const { 1.53 + return Recover_ResumePoint; 1.54 + } 1.55 + 1.56 + uint32_t pcOffset() const { 1.57 + return pcOffset_; 1.58 + } 1.59 + virtual uint32_t numOperands() const { 1.60 + return numOperands_; 1.61 + } 1.62 +}; 1.63 + 1.64 +const RResumePoint * 1.65 +RInstruction::toResumePoint() const 1.66 +{ 1.67 + MOZ_ASSERT(isResumePoint()); 1.68 + return static_cast<const RResumePoint *>(this); 1.69 +} 1.70 + 1.71 +} 1.72 +} 1.73 + 1.74 +#endif /* jit_Recover_h */