2012-08-28 02:41:49 +08:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
2013-08-07 09:43:25 +08:00
|
|
|
* vim: set ts=8 sts=4 et sw=4 tw=99:
|
2012-10-19 11:48:42 +08:00
|
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
#ifndef jsprvtd_h___
|
|
|
|
#define jsprvtd_h___
|
|
|
|
/*
|
|
|
|
* JS private typename definitions.
|
|
|
|
*
|
|
|
|
* This header is included only in other .h files, for convenience and for
|
|
|
|
* simplicity of type naming. The alternative for structures is to use tags,
|
|
|
|
* which are named the same as their typedef names (legal in C/C++, and less
|
|
|
|
* noisy than suffixing the typedef name with "Struct" or "Str"). Instead,
|
|
|
|
* all .h files that include this file may use the same typedef name, whether
|
|
|
|
* declaring a pointer to struct type, or defining a member of struct type.
|
|
|
|
*
|
|
|
|
* A few fundamental scalar types are defined here too. Neither the scalar
|
|
|
|
* nor the struct typedefs should change much, therefore the nearly-global
|
|
|
|
* make dependency induced by this file should not prove painful.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "jsutil.h"
|
|
|
|
|
|
|
|
#include "js/HashTable.h"
|
|
|
|
#include "js/Vector.h"
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Convenience constants.
|
|
|
|
*/
|
|
|
|
#define JS_BITS_PER_UINT32_LOG2 5
|
|
|
|
#define JS_BITS_PER_UINT32 32
|
|
|
|
|
|
|
|
/* The alignment required of objects stored in GC arenas. */
|
|
|
|
static const unsigned JS_GCTHING_ALIGN = 8;
|
|
|
|
static const unsigned JS_GCTHING_ZEROBITS = 3;
|
|
|
|
|
|
|
|
/* Scalar typedefs. */
|
|
|
|
typedef uint8_t jsbytecode;
|
|
|
|
typedef uint8_t jssrcnote;
|
|
|
|
typedef uintptr_t jsatomid;
|
|
|
|
|
|
|
|
/* Struct typedefs. */
|
|
|
|
typedef struct JSGCThing JSGCThing;
|
|
|
|
typedef struct JSGenerator JSGenerator;
|
|
|
|
typedef struct JSNativeEnumerator JSNativeEnumerator;
|
|
|
|
typedef struct JSTryNote JSTryNote;
|
|
|
|
|
|
|
|
/* Friend "Advanced API" typedefs. */
|
|
|
|
typedef struct JSAtomState JSAtomState;
|
|
|
|
typedef struct JSCodeSpec JSCodeSpec;
|
|
|
|
typedef struct JSPrinter JSPrinter;
|
|
|
|
typedef struct JSStackHeader JSStackHeader;
|
|
|
|
typedef struct JSSubString JSSubString;
|
|
|
|
typedef struct JSSpecializedNative JSSpecializedNative;
|
2012-10-19 11:48:42 +08:00
|
|
|
|
2012-08-28 02:41:49 +08:00
|
|
|
/*
|
|
|
|
* Template declarations.
|
|
|
|
*
|
|
|
|
* jsprvtd.h can be included in both C and C++ translation units. For C++, it
|
|
|
|
* may possibly be wrapped in an extern "C" block which does not agree with
|
|
|
|
* templates.
|
|
|
|
*/
|
|
|
|
class JSDependentString;
|
|
|
|
class JSExtensibleString;
|
|
|
|
class JSExternalString;
|
|
|
|
class JSLinearString;
|
|
|
|
class JSRope;
|
|
|
|
class JSAtom;
|
|
|
|
class JSWrapper;
|
|
|
|
|
|
|
|
namespace js {
|
|
|
|
|
|
|
|
struct ArgumentsData;
|
|
|
|
struct Class;
|
|
|
|
|
|
|
|
class RegExpGuard;
|
|
|
|
class RegExpObject;
|
|
|
|
class RegExpObjectBuilder;
|
|
|
|
class RegExpShared;
|
|
|
|
class RegExpStatics;
|
|
|
|
class MatchPairs;
|
|
|
|
class PropertyName;
|
|
|
|
|
|
|
|
enum RegExpFlag
|
|
|
|
{
|
|
|
|
IgnoreCaseFlag = 0x01,
|
|
|
|
GlobalFlag = 0x02,
|
|
|
|
MultilineFlag = 0x04,
|
|
|
|
StickyFlag = 0x08,
|
|
|
|
|
|
|
|
NoFlags = 0x00,
|
|
|
|
AllFlags = 0x0f
|
|
|
|
};
|
|
|
|
|
|
|
|
class ExecuteArgsGuard;
|
|
|
|
class InvokeFrameGuard;
|
|
|
|
class InvokeArgsGuard;
|
|
|
|
class StringBuffer;
|
|
|
|
|
|
|
|
class FrameRegs;
|
|
|
|
class StackFrame;
|
|
|
|
class StackSegment;
|
|
|
|
class StackSpace;
|
|
|
|
class ContextStack;
|
2012-10-19 11:48:42 +08:00
|
|
|
class ScriptFrameIter;
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
class Proxy;
|
2012-10-31 10:33:43 +08:00
|
|
|
class JS_FRIEND_API(BaseProxyHandler);
|
2013-02-27 16:57:36 +08:00
|
|
|
class JS_FRIEND_API(Wrapper);
|
2012-10-31 10:33:43 +08:00
|
|
|
class JS_FRIEND_API(CrossCompartmentWrapper);
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
class TempAllocPolicy;
|
|
|
|
class RuntimeAllocPolicy;
|
|
|
|
|
|
|
|
class GlobalObject;
|
|
|
|
|
|
|
|
template <typename K,
|
|
|
|
typename V,
|
|
|
|
size_t InlineElems>
|
|
|
|
class InlineMap;
|
|
|
|
|
|
|
|
class LifoAlloc;
|
|
|
|
|
2013-04-10 11:19:43 +08:00
|
|
|
class Shape;
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
class Breakpoint;
|
|
|
|
class BreakpointSite;
|
|
|
|
class Debugger;
|
|
|
|
class WatchpointMap;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Env is the type of what ES5 calls "lexical environments" (runtime
|
|
|
|
* activations of lexical scopes). This is currently just JSObject, and is
|
|
|
|
* implemented by Call, Block, With, and DeclEnv objects, among others--but
|
|
|
|
* environments and objects are really two different concepts.
|
|
|
|
*/
|
|
|
|
typedef JSObject Env;
|
|
|
|
|
|
|
|
typedef JSNative Native;
|
|
|
|
typedef JSPropertyOp PropertyOp;
|
|
|
|
typedef JSStrictPropertyOp StrictPropertyOp;
|
|
|
|
typedef JSPropertyDescriptor PropertyDescriptor;
|
|
|
|
|
2012-10-31 10:33:43 +08:00
|
|
|
namespace frontend {
|
|
|
|
|
|
|
|
struct BytecodeEmitter;
|
|
|
|
struct Definition;
|
2013-01-09 13:42:21 +08:00
|
|
|
class FunctionBox;
|
|
|
|
class ObjectBox;
|
2012-10-31 10:33:43 +08:00
|
|
|
struct Token;
|
|
|
|
struct TokenPos;
|
|
|
|
class TokenStream;
|
|
|
|
class ParseMapPool;
|
|
|
|
struct ParseNode;
|
|
|
|
|
2013-06-27 16:06:05 +08:00
|
|
|
template <typename ParseHandler>
|
|
|
|
struct Parser;
|
|
|
|
|
2012-10-31 10:33:43 +08:00
|
|
|
} /* namespace frontend */
|
|
|
|
|
2012-08-28 02:41:49 +08:00
|
|
|
namespace analyze {
|
|
|
|
|
|
|
|
struct LifetimeVariable;
|
|
|
|
class LoopAnalysis;
|
|
|
|
class ScriptAnalysis;
|
|
|
|
class SlotValue;
|
|
|
|
class SSAValue;
|
|
|
|
class SSAUseChain;
|
|
|
|
|
|
|
|
} /* namespace analyze */
|
|
|
|
|
|
|
|
namespace types {
|
|
|
|
|
|
|
|
class TypeSet;
|
|
|
|
struct TypeCallsite;
|
|
|
|
struct TypeObject;
|
|
|
|
struct TypeCompartment;
|
|
|
|
|
|
|
|
} /* namespace types */
|
|
|
|
|
|
|
|
typedef JS::Handle<Shape*> HandleShape;
|
|
|
|
typedef JS::Handle<types::TypeObject*> HandleTypeObject;
|
|
|
|
typedef JS::Handle<JSAtom*> HandleAtom;
|
|
|
|
typedef JS::Handle<PropertyName*> HandlePropertyName;
|
|
|
|
|
2012-10-19 11:48:42 +08:00
|
|
|
typedef JS::MutableHandle<Shape*> MutableHandleShape;
|
2013-01-09 13:42:21 +08:00
|
|
|
typedef JS::MutableHandle<JSAtom*> MutableHandleAtom;
|
2012-08-28 02:41:49 +08:00
|
|
|
|
2013-06-27 16:06:05 +08:00
|
|
|
typedef JS::Rooted<Shape*> RootedShape;
|
|
|
|
typedef JS::Rooted<types::TypeObject*> RootedTypeObject;
|
|
|
|
typedef JS::Rooted<JSAtom*> RootedAtom;
|
|
|
|
typedef JS::Rooted<PropertyName*> RootedPropertyName;
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
enum XDRMode {
|
|
|
|
XDR_ENCODE,
|
|
|
|
XDR_DECODE
|
|
|
|
};
|
|
|
|
|
|
|
|
template <XDRMode mode>
|
|
|
|
class XDRState;
|
|
|
|
|
|
|
|
class FreeOp;
|
|
|
|
|
2013-06-27 16:06:05 +08:00
|
|
|
struct IdValuePair
|
|
|
|
{
|
|
|
|
jsid id;
|
|
|
|
Value value;
|
|
|
|
|
|
|
|
IdValuePair() {}
|
|
|
|
IdValuePair(jsid idArg)
|
|
|
|
: id(idArg), value(UndefinedValue())
|
|
|
|
{}
|
|
|
|
};
|
|
|
|
|
2012-08-28 02:41:49 +08:00
|
|
|
} /* namespace js */
|
|
|
|
|
|
|
|
namespace JSC {
|
|
|
|
|
|
|
|
class ExecutableAllocator;
|
|
|
|
|
|
|
|
} /* namespace JSC */
|
|
|
|
|
|
|
|
namespace WTF {
|
|
|
|
|
|
|
|
class BumpPointerAllocator;
|
|
|
|
|
|
|
|
} /* namespace WTF */
|
|
|
|
|
|
|
|
/* "Friend" types used by jscntxt.h and jsdbgapi.h. */
|
|
|
|
typedef enum JSTrapStatus {
|
|
|
|
JSTRAP_ERROR,
|
|
|
|
JSTRAP_CONTINUE,
|
|
|
|
JSTRAP_RETURN,
|
|
|
|
JSTRAP_THROW,
|
|
|
|
JSTRAP_LIMIT
|
|
|
|
} JSTrapStatus;
|
|
|
|
|
|
|
|
typedef JSTrapStatus
|
|
|
|
(* JSTrapHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
|
|
|
|
jsval closure);
|
|
|
|
|
|
|
|
typedef JSTrapStatus
|
|
|
|
(* JSInterruptHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
|
|
|
|
void *closure);
|
|
|
|
|
|
|
|
typedef JSTrapStatus
|
|
|
|
(* JSDebuggerHandler)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
|
|
|
|
void *closure);
|
|
|
|
|
|
|
|
typedef JSTrapStatus
|
|
|
|
(* JSThrowHook)(JSContext *cx, JSScript *script, jsbytecode *pc, jsval *rval,
|
|
|
|
void *closure);
|
|
|
|
|
|
|
|
typedef JSBool
|
|
|
|
(* JSWatchPointHandler)(JSContext *cx, JSObject *obj, jsid id, jsval old,
|
|
|
|
jsval *newp, void *closure);
|
|
|
|
|
|
|
|
/* called just after script creation */
|
|
|
|
typedef void
|
|
|
|
(* JSNewScriptHook)(JSContext *cx,
|
|
|
|
const char *filename, /* URL of script */
|
2013-04-10 11:19:43 +08:00
|
|
|
unsigned lineno, /* first line */
|
2012-08-28 02:41:49 +08:00
|
|
|
JSScript *script,
|
|
|
|
JSFunction *fun,
|
|
|
|
void *callerdata);
|
|
|
|
|
|
|
|
/* called just before script destruction */
|
|
|
|
typedef void
|
|
|
|
(* JSDestroyScriptHook)(JSFreeOp *fop,
|
2013-04-10 11:19:43 +08:00
|
|
|
JSScript *script,
|
|
|
|
void *callerdata);
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
typedef void
|
|
|
|
(* JSSourceHandler)(const char *filename, unsigned lineno, const jschar *str,
|
|
|
|
size_t length, void **listenerTSData, void *closure);
|
|
|
|
|
|
|
|
/* js::ObjectOps function pointer typedefs. */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* A generic type for functions mapping an object to another object, or null
|
|
|
|
* if an error or exception was thrown on cx.
|
|
|
|
*/
|
|
|
|
typedef JSObject *
|
2012-10-19 11:48:42 +08:00
|
|
|
(* JSObjectOp)(JSContext *cx, JSHandleObject obj);
|
|
|
|
|
|
|
|
/* Signature for class initialization ops. */
|
|
|
|
typedef JSObject *
|
2013-01-09 13:42:21 +08:00
|
|
|
(* JSClassInitializerOp)(JSContext *cx, JSHandleObject obj);
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Hook that creates an iterator object for a given object. Returns the
|
|
|
|
* iterator object or null if an error or exception was thrown on cx.
|
|
|
|
*/
|
|
|
|
typedef JSObject *
|
2012-10-19 11:48:42 +08:00
|
|
|
(* JSIteratorOp)(JSContext *cx, JSHandleObject obj, JSBool keysonly);
|
2012-08-28 02:41:49 +08:00
|
|
|
|
|
|
|
|
|
|
|
#endif /* jsprvtd_h___ */
|