michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: set ts=8 sts=4 et sw=4 tw=99: michael@0: * This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef jit_ParallelFunctions_h michael@0: #define jit_ParallelFunctions_h michael@0: michael@0: #include "gc/Heap.h" michael@0: #include "vm/ForkJoin.h" michael@0: michael@0: namespace js { michael@0: michael@0: class TypedObject; // subclass of JSObject* defined in builtin/TypedObject.h michael@0: michael@0: namespace jit { michael@0: michael@0: ForkJoinContext *ForkJoinContextPar(); michael@0: JSObject *NewGCThingPar(ForkJoinContext *cx, gc::AllocKind allocKind); michael@0: bool ParallelWriteGuard(ForkJoinContext *cx, JSObject *object); michael@0: bool IsInTargetRegion(ForkJoinContext *cx, TypedObject *object); michael@0: bool CheckOverRecursedPar(ForkJoinContext *cx); michael@0: bool InterruptCheckPar(ForkJoinContext *cx); michael@0: michael@0: // Extends the given array with `length` new holes. Returns nullptr on michael@0: // failure or else `array`, which is convenient during code michael@0: // generation. michael@0: JSObject *ExtendArrayPar(ForkJoinContext *cx, JSObject *array, uint32_t length); michael@0: michael@0: // Set properties and elements on thread local objects. michael@0: bool SetPropertyPar(ForkJoinContext *cx, HandleObject obj, HandlePropertyName name, michael@0: HandleValue value, bool strict, jsbytecode *pc); michael@0: bool SetElementPar(ForkJoinContext *cx, HandleObject obj, HandleValue index, michael@0: HandleValue value, bool strict); michael@0: bool SetDenseElementPar(ForkJoinContext *cx, HandleObject obj, int32_t index, michael@0: HandleValue value, bool strict); michael@0: michael@0: // String related parallel functions. These tend to call existing VM functions michael@0: // that take a ThreadSafeContext. michael@0: JSString *ConcatStringsPar(ForkJoinContext *cx, HandleString left, HandleString right); michael@0: JSFlatString *IntToStringPar(ForkJoinContext *cx, int i); michael@0: JSString *DoubleToStringPar(ForkJoinContext *cx, double d); michael@0: JSString *PrimitiveToStringPar(ForkJoinContext *cx, HandleValue input); michael@0: bool StringToNumberPar(ForkJoinContext *cx, JSString *str, double *out); michael@0: michael@0: // Binary and unary operator functions on values. These tend to return michael@0: // RETRY_SEQUENTIALLY if the values are objects. michael@0: bool StrictlyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool StrictlyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool LooselyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool LooselyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool LessThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool LessThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool GreaterThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: bool GreaterThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); michael@0: michael@0: bool StringsEqualPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); michael@0: bool StringsUnequalPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); michael@0: michael@0: bool BitNotPar(ForkJoinContext *cx, HandleValue in, int32_t *out); michael@0: bool BitXorPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); michael@0: bool BitOrPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); michael@0: bool BitAndPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); michael@0: bool BitLshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); michael@0: bool BitRshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); michael@0: michael@0: bool UrshValuesPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleValue out); michael@0: michael@0: // Make a new rest parameter in parallel. michael@0: JSObject *InitRestParameterPar(ForkJoinContext *cx, uint32_t length, Value *rest, michael@0: HandleObject templateObj, HandleObject res); michael@0: michael@0: // Abort and debug tracing functions. michael@0: void AbortPar(ParallelBailoutCause cause, JSScript *outermostScript, JSScript *currentScript, michael@0: jsbytecode *bytecode); michael@0: void PropagateAbortPar(JSScript *outermostScript, JSScript *currentScript); michael@0: michael@0: void TraceLIR(IonLIRTraceData *current); michael@0: michael@0: void CallToUncompiledScriptPar(JSObject *obj); michael@0: michael@0: } // namespace jit michael@0: } // namespace js michael@0: michael@0: #endif /* jit_ParallelFunctions_h */