|
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_ExecutionMode_inl_h |
|
8 #define jit_ExecutionMode_inl_h |
|
9 |
|
10 #ifdef JS_ION |
|
11 |
|
12 #include "jit/CompileInfo.h" |
|
13 |
|
14 #include "jsscriptinlines.h" |
|
15 |
|
16 namespace js { |
|
17 namespace jit { |
|
18 |
|
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 } |
|
29 |
|
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 } |
|
40 |
|
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 } |
|
51 |
|
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 } |
|
62 |
|
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 } |
|
76 |
|
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 } |
|
87 |
|
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 } |
|
98 |
|
99 } // namespace jit |
|
100 } // namespace js |
|
101 |
|
102 #endif // JS_ION |
|
103 |
|
104 #endif /* jit_ExecutionMode_inl_h */ |