Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
michael@0 | 2 | * vim: set ts=8 sts=4 et sw=4 tw=99: |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef jit_Recover_h |
michael@0 | 8 | #define jit_Recover_h |
michael@0 | 9 | |
michael@0 | 10 | #include "mozilla/Attributes.h" |
michael@0 | 11 | |
michael@0 | 12 | #include "jit/Snapshots.h" |
michael@0 | 13 | |
michael@0 | 14 | namespace js { |
michael@0 | 15 | namespace jit { |
michael@0 | 16 | |
michael@0 | 17 | class RResumePoint; |
michael@0 | 18 | |
michael@0 | 19 | class RInstruction |
michael@0 | 20 | { |
michael@0 | 21 | public: |
michael@0 | 22 | enum Opcode |
michael@0 | 23 | { |
michael@0 | 24 | Recover_ResumePoint = 0 |
michael@0 | 25 | }; |
michael@0 | 26 | |
michael@0 | 27 | virtual Opcode opcode() const = 0; |
michael@0 | 28 | |
michael@0 | 29 | bool isResumePoint() const { |
michael@0 | 30 | return opcode() == Recover_ResumePoint; |
michael@0 | 31 | } |
michael@0 | 32 | inline const RResumePoint *toResumePoint() const; |
michael@0 | 33 | |
michael@0 | 34 | virtual uint32_t numOperands() const = 0; |
michael@0 | 35 | |
michael@0 | 36 | static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw); |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | class RResumePoint MOZ_FINAL : public RInstruction |
michael@0 | 40 | { |
michael@0 | 41 | private: |
michael@0 | 42 | uint32_t pcOffset_; // Offset from script->code. |
michael@0 | 43 | uint32_t numOperands_; // Number of slots. |
michael@0 | 44 | |
michael@0 | 45 | friend class RInstruction; |
michael@0 | 46 | RResumePoint(CompactBufferReader &reader); |
michael@0 | 47 | |
michael@0 | 48 | public: |
michael@0 | 49 | virtual Opcode opcode() const { |
michael@0 | 50 | return Recover_ResumePoint; |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | uint32_t pcOffset() const { |
michael@0 | 54 | return pcOffset_; |
michael@0 | 55 | } |
michael@0 | 56 | virtual uint32_t numOperands() const { |
michael@0 | 57 | return numOperands_; |
michael@0 | 58 | } |
michael@0 | 59 | }; |
michael@0 | 60 | |
michael@0 | 61 | const RResumePoint * |
michael@0 | 62 | RInstruction::toResumePoint() const |
michael@0 | 63 | { |
michael@0 | 64 | MOZ_ASSERT(isResumePoint()); |
michael@0 | 65 | return static_cast<const RResumePoint *>(this); |
michael@0 | 66 | } |
michael@0 | 67 | |
michael@0 | 68 | } |
michael@0 | 69 | } |
michael@0 | 70 | |
michael@0 | 71 | #endif /* jit_Recover_h */ |