|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: set ts=8 sts=4 et sw=4 tw=99: |
|
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 jit_Recover_h |
|
8 #define jit_Recover_h |
|
9 |
|
10 #include "mozilla/Attributes.h" |
|
11 |
|
12 #include "jit/Snapshots.h" |
|
13 |
|
14 namespace js { |
|
15 namespace jit { |
|
16 |
|
17 class RResumePoint; |
|
18 |
|
19 class RInstruction |
|
20 { |
|
21 public: |
|
22 enum Opcode |
|
23 { |
|
24 Recover_ResumePoint = 0 |
|
25 }; |
|
26 |
|
27 virtual Opcode opcode() const = 0; |
|
28 |
|
29 bool isResumePoint() const { |
|
30 return opcode() == Recover_ResumePoint; |
|
31 } |
|
32 inline const RResumePoint *toResumePoint() const; |
|
33 |
|
34 virtual uint32_t numOperands() const = 0; |
|
35 |
|
36 static void readRecoverData(CompactBufferReader &reader, RInstructionStorage *raw); |
|
37 }; |
|
38 |
|
39 class RResumePoint MOZ_FINAL : public RInstruction |
|
40 { |
|
41 private: |
|
42 uint32_t pcOffset_; // Offset from script->code. |
|
43 uint32_t numOperands_; // Number of slots. |
|
44 |
|
45 friend class RInstruction; |
|
46 RResumePoint(CompactBufferReader &reader); |
|
47 |
|
48 public: |
|
49 virtual Opcode opcode() const { |
|
50 return Recover_ResumePoint; |
|
51 } |
|
52 |
|
53 uint32_t pcOffset() const { |
|
54 return pcOffset_; |
|
55 } |
|
56 virtual uint32_t numOperands() const { |
|
57 return numOperands_; |
|
58 } |
|
59 }; |
|
60 |
|
61 const RResumePoint * |
|
62 RInstruction::toResumePoint() const |
|
63 { |
|
64 MOZ_ASSERT(isResumePoint()); |
|
65 return static_cast<const RResumePoint *>(this); |
|
66 } |
|
67 |
|
68 } |
|
69 } |
|
70 |
|
71 #endif /* jit_Recover_h */ |