1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/ExecutionMode-inl.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,104 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- 1.5 + * vim: set ts=8 sts=4 et sw=4 tw=99: 1.6 + * This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef jit_ExecutionMode_inl_h 1.11 +#define jit_ExecutionMode_inl_h 1.12 + 1.13 +#ifdef JS_ION 1.14 + 1.15 +#include "jit/CompileInfo.h" 1.16 + 1.17 +#include "jsscriptinlines.h" 1.18 + 1.19 +namespace js { 1.20 +namespace jit { 1.21 + 1.22 +static inline bool 1.23 +HasIonScript(JSScript *script, ExecutionMode cmode) 1.24 +{ 1.25 + switch (cmode) { 1.26 + case SequentialExecution: return script->hasIonScript(); 1.27 + case ParallelExecution: return script->hasParallelIonScript(); 1.28 + default:; 1.29 + } 1.30 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.31 +} 1.32 + 1.33 +static inline IonScript * 1.34 +GetIonScript(JSScript *script, ExecutionMode cmode) 1.35 +{ 1.36 + switch (cmode) { 1.37 + case SequentialExecution: return script->maybeIonScript(); 1.38 + case ParallelExecution: return script->maybeParallelIonScript(); 1.39 + default:; 1.40 + } 1.41 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.42 +} 1.43 + 1.44 +static inline void 1.45 +SetIonScript(JSScript *script, ExecutionMode cmode, IonScript *ionScript) 1.46 +{ 1.47 + switch (cmode) { 1.48 + case SequentialExecution: script->setIonScript(ionScript); return; 1.49 + case ParallelExecution: script->setParallelIonScript(ionScript); return; 1.50 + default:; 1.51 + } 1.52 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.53 +} 1.54 + 1.55 +static inline size_t 1.56 +OffsetOfIonInJSScript(ExecutionMode cmode) 1.57 +{ 1.58 + switch (cmode) { 1.59 + case SequentialExecution: return JSScript::offsetOfIonScript(); 1.60 + case ParallelExecution: return JSScript::offsetOfParallelIonScript(); 1.61 + default:; 1.62 + } 1.63 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.64 +} 1.65 + 1.66 +static inline bool 1.67 +CanIonCompile(JSScript *script, ExecutionMode cmode) 1.68 +{ 1.69 + switch (cmode) { 1.70 + case SequentialExecution: return script->canIonCompile(); 1.71 + case ParallelExecution: return script->canParallelIonCompile(); 1.72 + case DefinitePropertiesAnalysis: return true; 1.73 + case ArgumentsUsageAnalysis: return true; 1.74 + default:; 1.75 + } 1.76 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.77 + return false; 1.78 +} 1.79 + 1.80 +static inline bool 1.81 +CompilingOffThread(JSScript *script, ExecutionMode cmode) 1.82 +{ 1.83 + switch (cmode) { 1.84 + case SequentialExecution: return script->isIonCompilingOffThread(); 1.85 + case ParallelExecution: return script->isParallelIonCompilingOffThread(); 1.86 + default:; 1.87 + } 1.88 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.89 +} 1.90 + 1.91 +static inline bool 1.92 +CompilingOffThread(HandleScript script, ExecutionMode cmode) 1.93 +{ 1.94 + switch (cmode) { 1.95 + case SequentialExecution: return script->isIonCompilingOffThread(); 1.96 + case ParallelExecution: return script->isParallelIonCompilingOffThread(); 1.97 + default:; 1.98 + } 1.99 + MOZ_ASSUME_UNREACHABLE("No such execution mode"); 1.100 +} 1.101 + 1.102 +} // namespace jit 1.103 +} // namespace js 1.104 + 1.105 +#endif // JS_ION 1.106 + 1.107 +#endif /* jit_ExecutionMode_inl_h */