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_ExecutionMode_inl_h |
michael@0 | 8 | #define jit_ExecutionMode_inl_h |
michael@0 | 9 | |
michael@0 | 10 | #ifdef JS_ION |
michael@0 | 11 | |
michael@0 | 12 | #include "jit/CompileInfo.h" |
michael@0 | 13 | |
michael@0 | 14 | #include "jsscriptinlines.h" |
michael@0 | 15 | |
michael@0 | 16 | namespace js { |
michael@0 | 17 | namespace jit { |
michael@0 | 18 | |
michael@0 | 19 | static inline bool |
michael@0 | 20 | HasIonScript(JSScript *script, ExecutionMode cmode) |
michael@0 | 21 | { |
michael@0 | 22 | switch (cmode) { |
michael@0 | 23 | case SequentialExecution: return script->hasIonScript(); |
michael@0 | 24 | case ParallelExecution: return script->hasParallelIonScript(); |
michael@0 | 25 | default:; |
michael@0 | 26 | } |
michael@0 | 27 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | static inline IonScript * |
michael@0 | 31 | GetIonScript(JSScript *script, ExecutionMode cmode) |
michael@0 | 32 | { |
michael@0 | 33 | switch (cmode) { |
michael@0 | 34 | case SequentialExecution: return script->maybeIonScript(); |
michael@0 | 35 | case ParallelExecution: return script->maybeParallelIonScript(); |
michael@0 | 36 | default:; |
michael@0 | 37 | } |
michael@0 | 38 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 39 | } |
michael@0 | 40 | |
michael@0 | 41 | static inline void |
michael@0 | 42 | SetIonScript(JSScript *script, ExecutionMode cmode, IonScript *ionScript) |
michael@0 | 43 | { |
michael@0 | 44 | switch (cmode) { |
michael@0 | 45 | case SequentialExecution: script->setIonScript(ionScript); return; |
michael@0 | 46 | case ParallelExecution: script->setParallelIonScript(ionScript); return; |
michael@0 | 47 | default:; |
michael@0 | 48 | } |
michael@0 | 49 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 50 | } |
michael@0 | 51 | |
michael@0 | 52 | static inline size_t |
michael@0 | 53 | OffsetOfIonInJSScript(ExecutionMode cmode) |
michael@0 | 54 | { |
michael@0 | 55 | switch (cmode) { |
michael@0 | 56 | case SequentialExecution: return JSScript::offsetOfIonScript(); |
michael@0 | 57 | case ParallelExecution: return JSScript::offsetOfParallelIonScript(); |
michael@0 | 58 | default:; |
michael@0 | 59 | } |
michael@0 | 60 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | static inline bool |
michael@0 | 64 | CanIonCompile(JSScript *script, ExecutionMode cmode) |
michael@0 | 65 | { |
michael@0 | 66 | switch (cmode) { |
michael@0 | 67 | case SequentialExecution: return script->canIonCompile(); |
michael@0 | 68 | case ParallelExecution: return script->canParallelIonCompile(); |
michael@0 | 69 | case DefinitePropertiesAnalysis: return true; |
michael@0 | 70 | case ArgumentsUsageAnalysis: return true; |
michael@0 | 71 | default:; |
michael@0 | 72 | } |
michael@0 | 73 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 74 | return false; |
michael@0 | 75 | } |
michael@0 | 76 | |
michael@0 | 77 | static inline bool |
michael@0 | 78 | CompilingOffThread(JSScript *script, ExecutionMode cmode) |
michael@0 | 79 | { |
michael@0 | 80 | switch (cmode) { |
michael@0 | 81 | case SequentialExecution: return script->isIonCompilingOffThread(); |
michael@0 | 82 | case ParallelExecution: return script->isParallelIonCompilingOffThread(); |
michael@0 | 83 | default:; |
michael@0 | 84 | } |
michael@0 | 85 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 86 | } |
michael@0 | 87 | |
michael@0 | 88 | static inline bool |
michael@0 | 89 | CompilingOffThread(HandleScript script, ExecutionMode cmode) |
michael@0 | 90 | { |
michael@0 | 91 | switch (cmode) { |
michael@0 | 92 | case SequentialExecution: return script->isIonCompilingOffThread(); |
michael@0 | 93 | case ParallelExecution: return script->isParallelIonCompilingOffThread(); |
michael@0 | 94 | default:; |
michael@0 | 95 | } |
michael@0 | 96 | MOZ_ASSUME_UNREACHABLE("No such execution mode"); |
michael@0 | 97 | } |
michael@0 | 98 | |
michael@0 | 99 | } // namespace jit |
michael@0 | 100 | } // namespace js |
michael@0 | 101 | |
michael@0 | 102 | #endif // JS_ION |
michael@0 | 103 | |
michael@0 | 104 | #endif /* jit_ExecutionMode_inl_h */ |