|
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_mips_Bailouts_mips_h |
|
8 #define jit_mips_Bailouts_mips_h |
|
9 |
|
10 #include "jit/Bailouts.h" |
|
11 #include "jit/JitCompartment.h" |
|
12 |
|
13 namespace js { |
|
14 namespace jit { |
|
15 |
|
16 class BailoutStack |
|
17 { |
|
18 uintptr_t frameClassId_; |
|
19 // This is pushed in the bailout handler. Both entry points into the |
|
20 // handler inserts their own value int lr, which is then placed onto the |
|
21 // stack along with frameClassId_ above. This should be migrated to ip. |
|
22 public: |
|
23 union { |
|
24 uintptr_t frameSize_; |
|
25 uintptr_t tableOffset_; |
|
26 }; |
|
27 |
|
28 protected: |
|
29 mozilla::Array<double, FloatRegisters::Total> fpregs_; |
|
30 mozilla::Array<uintptr_t, Registers::Total> regs_; |
|
31 |
|
32 uintptr_t snapshotOffset_; |
|
33 uintptr_t padding_; |
|
34 |
|
35 public: |
|
36 FrameSizeClass frameClass() const { |
|
37 return FrameSizeClass::FromClass(frameClassId_); |
|
38 } |
|
39 uintptr_t tableOffset() const { |
|
40 MOZ_ASSERT(frameClass() != FrameSizeClass::None()); |
|
41 return tableOffset_; |
|
42 } |
|
43 uint32_t frameSize() const { |
|
44 if (frameClass() == FrameSizeClass::None()) |
|
45 return frameSize_; |
|
46 return frameClass().frameSize(); |
|
47 } |
|
48 MachineState machine() { |
|
49 return MachineState::FromBailout(regs_, fpregs_); |
|
50 } |
|
51 SnapshotOffset snapshotOffset() const { |
|
52 MOZ_ASSERT(frameClass() == FrameSizeClass::None()); |
|
53 return snapshotOffset_; |
|
54 } |
|
55 uint8_t *parentStackPointer() const { |
|
56 if (frameClass() == FrameSizeClass::None()) |
|
57 return (uint8_t *)this + sizeof(BailoutStack); |
|
58 return (uint8_t *)this + offsetof(BailoutStack, snapshotOffset_); |
|
59 } |
|
60 static size_t offsetOfFrameClass() { |
|
61 return offsetof(BailoutStack, frameClassId_); |
|
62 } |
|
63 static size_t offsetOfFrameSize() { |
|
64 return offsetof(BailoutStack, frameSize_); |
|
65 } |
|
66 static size_t offsetOfFpRegs() { |
|
67 return offsetof(BailoutStack, fpregs_); |
|
68 } |
|
69 static size_t offsetOfRegs() { |
|
70 return offsetof(BailoutStack, regs_); |
|
71 } |
|
72 }; |
|
73 |
|
74 } // namespace jit |
|
75 } // namespace js |
|
76 |
|
77 #endif /* jit_mips_Bailouts_mips_h */ |