1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit/ParallelFunctions.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,86 @@ 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_ParallelFunctions_h 1.11 +#define jit_ParallelFunctions_h 1.12 + 1.13 +#include "gc/Heap.h" 1.14 +#include "vm/ForkJoin.h" 1.15 + 1.16 +namespace js { 1.17 + 1.18 +class TypedObject; // subclass of JSObject* defined in builtin/TypedObject.h 1.19 + 1.20 +namespace jit { 1.21 + 1.22 +ForkJoinContext *ForkJoinContextPar(); 1.23 +JSObject *NewGCThingPar(ForkJoinContext *cx, gc::AllocKind allocKind); 1.24 +bool ParallelWriteGuard(ForkJoinContext *cx, JSObject *object); 1.25 +bool IsInTargetRegion(ForkJoinContext *cx, TypedObject *object); 1.26 +bool CheckOverRecursedPar(ForkJoinContext *cx); 1.27 +bool InterruptCheckPar(ForkJoinContext *cx); 1.28 + 1.29 +// Extends the given array with `length` new holes. Returns nullptr on 1.30 +// failure or else `array`, which is convenient during code 1.31 +// generation. 1.32 +JSObject *ExtendArrayPar(ForkJoinContext *cx, JSObject *array, uint32_t length); 1.33 + 1.34 +// Set properties and elements on thread local objects. 1.35 +bool SetPropertyPar(ForkJoinContext *cx, HandleObject obj, HandlePropertyName name, 1.36 + HandleValue value, bool strict, jsbytecode *pc); 1.37 +bool SetElementPar(ForkJoinContext *cx, HandleObject obj, HandleValue index, 1.38 + HandleValue value, bool strict); 1.39 +bool SetDenseElementPar(ForkJoinContext *cx, HandleObject obj, int32_t index, 1.40 + HandleValue value, bool strict); 1.41 + 1.42 +// String related parallel functions. These tend to call existing VM functions 1.43 +// that take a ThreadSafeContext. 1.44 +JSString *ConcatStringsPar(ForkJoinContext *cx, HandleString left, HandleString right); 1.45 +JSFlatString *IntToStringPar(ForkJoinContext *cx, int i); 1.46 +JSString *DoubleToStringPar(ForkJoinContext *cx, double d); 1.47 +JSString *PrimitiveToStringPar(ForkJoinContext *cx, HandleValue input); 1.48 +bool StringToNumberPar(ForkJoinContext *cx, JSString *str, double *out); 1.49 + 1.50 +// Binary and unary operator functions on values. These tend to return 1.51 +// RETRY_SEQUENTIALLY if the values are objects. 1.52 +bool StrictlyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.53 +bool StrictlyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.54 +bool LooselyEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.55 +bool LooselyUnequalPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.56 +bool LessThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.57 +bool LessThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.58 +bool GreaterThanPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.59 +bool GreaterThanOrEqualPar(ForkJoinContext *cx, MutableHandleValue v1, MutableHandleValue v2, bool *); 1.60 + 1.61 +bool StringsEqualPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); 1.62 +bool StringsUnequalPar(ForkJoinContext *cx, HandleString v1, HandleString v2, bool *); 1.63 + 1.64 +bool BitNotPar(ForkJoinContext *cx, HandleValue in, int32_t *out); 1.65 +bool BitXorPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); 1.66 +bool BitOrPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); 1.67 +bool BitAndPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); 1.68 +bool BitLshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); 1.69 +bool BitRshPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, int32_t *out); 1.70 + 1.71 +bool UrshValuesPar(ForkJoinContext *cx, HandleValue lhs, HandleValue rhs, MutableHandleValue out); 1.72 + 1.73 +// Make a new rest parameter in parallel. 1.74 +JSObject *InitRestParameterPar(ForkJoinContext *cx, uint32_t length, Value *rest, 1.75 + HandleObject templateObj, HandleObject res); 1.76 + 1.77 +// Abort and debug tracing functions. 1.78 +void AbortPar(ParallelBailoutCause cause, JSScript *outermostScript, JSScript *currentScript, 1.79 + jsbytecode *bytecode); 1.80 +void PropagateAbortPar(JSScript *outermostScript, JSScript *currentScript); 1.81 + 1.82 +void TraceLIR(IonLIRTraceData *current); 1.83 + 1.84 +void CallToUncompiledScriptPar(JSObject *obj); 1.85 + 1.86 +} // namespace jit 1.87 +} // namespace js 1.88 + 1.89 +#endif /* jit_ParallelFunctions_h */