|
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_ParallelFunctions_h |
|
8 #define jit_ParallelFunctions_h |
|
9 |
|
10 #include "gc/Heap.h" |
|
11 #include "vm/ForkJoin.h" |
|
12 |
|
13 namespace js { |
|
14 |
|
15 class TypedObject; // subclass of JSObject* defined in builtin/TypedObject.h |
|
16 |
|
17 namespace jit { |
|
18 |
|
19 ForkJoinContext *ForkJoinContextPar(); |
|
20 JSObject *NewGCThingPar(ForkJoinContext *cx, gc::AllocKind allocKind); |
|
21 bool ParallelWriteGuard(ForkJoinContext *cx, JSObject *object); |
|
22 bool IsInTargetRegion(ForkJoinContext *cx, TypedObject *object); |
|
23 bool CheckOverRecursedPar(ForkJoinContext *cx); |
|
24 bool InterruptCheckPar(ForkJoinContext *cx); |
|
25 |
|
26 // Extends the given array with `length` new holes. Returns nullptr on |
|
27 // failure or else `array`, which is convenient during code |
|
28 // generation. |
|
29 JSObject *ExtendArrayPar(ForkJoinContext *cx, JSObject *array, uint32_t length); |
|
30 |
|
31 // Set properties and elements on thread local objects. |
|
32 bool SetPropertyPar(ForkJoinContext *cx, HandleObject obj, HandlePropertyName name, |
|
33 HandleValue value, bool strict, jsbytecode *pc); |
|
34 bool SetElementPar(ForkJoinContext *cx, HandleObject obj, HandleValue index, |
|
35 HandleValue value, bool strict); |
|
36 bool SetDenseElementPar(ForkJoinContext *cx, HandleObject obj, int32_t index, |
|
37 HandleValue value, bool strict); |
|
38 |
|
39 // String related parallel functions. These tend to call existing VM functions |
|
40 // that take a ThreadSafeContext. |
|
41 JSString *ConcatStringsPar(ForkJoinContext *cx, HandleString left, HandleString right); |
|
42 JSFlatString *IntToStringPar(ForkJoinContext *cx, int i); |
|
43 JSString *DoubleToStringPar(ForkJoinContext *cx, double d); |
|
44 JSString *PrimitiveToStringPar(ForkJoinContext *cx, HandleValue input); |
|
45 bool StringToNumberPar(ForkJoinContext *cx, JSString *str, double *out); |
|
46 |
|
47 // Binary and unary operator functions on values. These tend to return |
|
48 // RETRY_SEQUENTIALLY if the values are objects. |
|
49 bool StrictlyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
50 bool StrictlyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
51 bool LooselyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
52 bool LooselyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
53 bool LessThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
54 bool LessThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
55 bool GreaterThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
56 bool GreaterThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); |
|
57 |
|
58 bool StringsEqualPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); |
|
59 bool StringsUnequalPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); |
|
60 |
|
61 bool BitNotPar(ForkJoinContext *cx, HandleValue in, int32_t *out); |
|
62 bool BitXorPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); |
|
63 bool BitOrPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); |
|
64 bool BitAndPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); |
|
65 bool BitLshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); |
|
66 bool BitRshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); |
|
67 |
|
68 bool UrshValuesPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleValue out); |
|
69 |
|
70 // Make a new rest parameter in parallel. |
|
71 JSObject *InitRestParameterPar(ForkJoinContext *cx, uint32_t length, Value *rest, |
|
72 HandleObject templateObj, HandleObject res); |
|
73 |
|
74 // Abort and debug tracing functions. |
|
75 void AbortPar(ParallelBailoutCause cause, JSScript *outermostScript, JSScript *currentScript, |
|
76 jsbytecode *bytecode); |
|
77 void PropagateAbortPar(JSScript *outermostScript, JSScript *currentScript); |
|
78 |
|
79 void TraceLIR(IonLIRTraceData *current); |
|
80 |
|
81 void CallToUncompiledScriptPar(JSObject *obj); |
|
82 |
|
83 } // namespace jit |
|
84 } // namespace js |
|
85 |
|
86 #endif /* jit_ParallelFunctions_h */ |