js/src/jit/ExecutionMode-inl.h

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial