|
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_IonFrames_inl_h |
|
8 #define jit_IonFrames_inl_h |
|
9 |
|
10 #ifdef JS_ION |
|
11 |
|
12 #include "jit/IonFrames.h" |
|
13 |
|
14 #include "jit/JitFrameIterator.h" |
|
15 #include "jit/LIR.h" |
|
16 #include "vm/ForkJoin.h" |
|
17 |
|
18 #include "jit/JitFrameIterator-inl.h" |
|
19 |
|
20 namespace js { |
|
21 namespace jit { |
|
22 |
|
23 inline void |
|
24 SafepointIndex::resolve() |
|
25 { |
|
26 JS_ASSERT(!resolved); |
|
27 safepointOffset_ = safepoint_->offset(); |
|
28 #ifdef DEBUG |
|
29 resolved = true; |
|
30 #endif |
|
31 } |
|
32 |
|
33 inline uint8_t * |
|
34 JitFrameIterator::returnAddress() const |
|
35 { |
|
36 IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; |
|
37 return current->returnAddress(); |
|
38 } |
|
39 |
|
40 inline size_t |
|
41 JitFrameIterator::prevFrameLocalSize() const |
|
42 { |
|
43 IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; |
|
44 return current->prevFrameLocalSize(); |
|
45 } |
|
46 |
|
47 inline FrameType |
|
48 JitFrameIterator::prevType() const |
|
49 { |
|
50 IonCommonFrameLayout *current = (IonCommonFrameLayout *) current_; |
|
51 return current->prevType(); |
|
52 } |
|
53 |
|
54 inline bool |
|
55 JitFrameIterator::isFakeExitFrame() const |
|
56 { |
|
57 bool res = (prevType() == JitFrame_Unwound_Rectifier || |
|
58 prevType() == JitFrame_Unwound_IonJS || |
|
59 prevType() == JitFrame_Unwound_BaselineStub || |
|
60 (prevType() == JitFrame_Entry && type() == JitFrame_Exit)); |
|
61 JS_ASSERT_IF(res, type() == JitFrame_Exit || type() == JitFrame_BaselineJS); |
|
62 return res; |
|
63 } |
|
64 |
|
65 inline IonExitFrameLayout * |
|
66 JitFrameIterator::exitFrame() const |
|
67 { |
|
68 JS_ASSERT(type() == JitFrame_Exit); |
|
69 JS_ASSERT(!isFakeExitFrame()); |
|
70 return (IonExitFrameLayout *) fp(); |
|
71 } |
|
72 |
|
73 inline BaselineFrame * |
|
74 GetTopBaselineFrame(JSContext *cx) |
|
75 { |
|
76 JitFrameIterator iter(cx); |
|
77 JS_ASSERT(iter.type() == JitFrame_Exit); |
|
78 ++iter; |
|
79 if (iter.isBaselineStub()) |
|
80 ++iter; |
|
81 JS_ASSERT(iter.isBaselineJS()); |
|
82 return iter.baselineFrame(); |
|
83 } |
|
84 |
|
85 inline JSScript * |
|
86 GetTopIonJSScript(JSContext *cx, void **returnAddrOut = nullptr) |
|
87 { |
|
88 return GetTopIonJSScript(cx->mainThread().ionTop, returnAddrOut, SequentialExecution); |
|
89 } |
|
90 |
|
91 inline JSScript * |
|
92 GetTopIonJSScript(ForkJoinContext *cx, void **returnAddrOut = nullptr) |
|
93 { |
|
94 return GetTopIonJSScript(cx->perThreadData->ionTop, returnAddrOut, ParallelExecution); |
|
95 } |
|
96 |
|
97 } // namespace jit |
|
98 } // namespace js |
|
99 |
|
100 #endif // JS_ION |
|
101 |
|
102 #endif /* jit_IonFrames_inl_h */ |