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