📄 jsobj.h
字号:
#define BUSY_BIT ((jsatomid) 2)#define SHARP_ID_SHIFT 2#define IS_SHARP(he) (JS_PTR_TO_UINT32((he)->value) & SHARP_BIT)#define MAKE_SHARP(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|SHARP_BIT))#define IS_BUSY(he) (JS_PTR_TO_UINT32((he)->value) & BUSY_BIT)#define MAKE_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)|BUSY_BIT))#define CLEAR_BUSY(he) ((he)->value = JS_UINT32_TO_PTR(JS_PTR_TO_UINT32((he)->value)&~BUSY_BIT))extern JSHashEntry *js_EnterSharpObject(JSContext *cx, JSObject *obj, JSIdArray **idap, jschar **sp);extern voidjs_LeaveSharpObject(JSContext *cx, JSIdArray **idap);/* * Mark objects stored in map if GC happens between js_EnterSharpObject * and js_LeaveSharpObject. GC calls this when map->depth > 0. */extern voidjs_GCMarkSharpMap(JSContext *cx, JSSharpObjectMap *map);extern JSBooljs_obj_toSource(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);extern JSBooljs_obj_toString(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);extern JSBooljs_HasOwnPropertyHelper(JSContext *cx, JSObject *obj, JSLookupPropOp lookup, uintN argc, jsval *argv, jsval *rval);extern JSObject*js_InitBlockClass(JSContext *cx, JSObject* obj);extern JSObject *js_InitObjectClass(JSContext *cx, JSObject *obj);/* Select Object.prototype method names shared between jsapi.c and jsobj.c. */extern const char js_watch_str[];extern const char js_unwatch_str[];extern const char js_hasOwnProperty_str[];extern const char js_isPrototypeOf_str[];extern const char js_propertyIsEnumerable_str[];extern const char js_defineGetter_str[];extern const char js_defineSetter_str[];extern const char js_lookupGetter_str[];extern const char js_lookupSetter_str[];extern voidjs_InitObjectMap(JSObjectMap *map, jsrefcount nrefs, JSObjectOps *ops, JSClass *clasp);extern JSObjectMap *js_NewObjectMap(JSContext *cx, jsrefcount nrefs, JSObjectOps *ops, JSClass *clasp, JSObject *obj);extern voidjs_DestroyObjectMap(JSContext *cx, JSObjectMap *map);extern JSObjectMap *js_HoldObjectMap(JSContext *cx, JSObjectMap *map);extern JSObjectMap *js_DropObjectMap(JSContext *cx, JSObjectMap *map, JSObject *obj);extern JSBooljs_GetClassId(JSContext *cx, JSClass *clasp, jsid *idp);extern JSObject *js_NewObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent);/* * Fast access to immutable standard objects (constructors and prototypes). */extern JSBooljs_GetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key, JSObject **objp);extern JSBooljs_SetClassObject(JSContext *cx, JSObject *obj, JSProtoKey key, JSObject *cobj);extern JSBooljs_FindClassObject(JSContext *cx, JSObject *start, jsid id, jsval *vp);extern JSObject *js_ConstructObject(JSContext *cx, JSClass *clasp, JSObject *proto, JSObject *parent, uintN argc, jsval *argv);extern voidjs_FinalizeObject(JSContext *cx, JSObject *obj);extern JSBooljs_AllocSlot(JSContext *cx, JSObject *obj, uint32 *slotp);extern voidjs_FreeSlot(JSContext *cx, JSObject *obj, uint32 slot);/* * Native property add and lookup variants that hide id in the hidden atom * subspace, so as to avoid collisions between internal properties such as * formal arguments and local variables in function objects, and externally * set properties with the same ids. */extern JSScopeProperty *js_AddHiddenProperty(JSContext *cx, JSObject *obj, jsid id, JSPropertyOp getter, JSPropertyOp setter, uint32 slot, uintN attrs, uintN flags, intN shortid);extern JSBooljs_LookupHiddenProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp);/* * Find or create a property named by id in obj's scope, with the given getter * and setter, slot, attributes, and other members. */extern JSScopeProperty *js_AddNativeProperty(JSContext *cx, JSObject *obj, jsid id, JSPropertyOp getter, JSPropertyOp setter, uint32 slot, uintN attrs, uintN flags, intN shortid);/* * Change sprop to have the given attrs, getter, and setter in scope, morphing * it into a potentially new JSScopeProperty. Return a pointer to the changed * or identical property. */extern JSScopeProperty *js_ChangeNativePropertyAttrs(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, uintN attrs, uintN mask, JSPropertyOp getter, JSPropertyOp setter);/* * On error, return false. On success, if propp is non-null, return true with * obj locked and with a held property in *propp; if propp is null, return true * but release obj's lock first. Therefore all callers who pass non-null propp * result parameters must later call OBJ_DROP_PROPERTY(cx, obj, *propp) both to * drop the held property, and to release the lock on obj. */extern JSBooljs_DefineProperty(JSContext *cx, JSObject *obj, jsid id, jsval value, JSPropertyOp getter, JSPropertyOp setter, uintN attrs, JSProperty **propp);extern JSBooljs_DefineNativeProperty(JSContext *cx, JSObject *obj, jsid id, jsval value, JSPropertyOp getter, JSPropertyOp setter, uintN attrs, uintN flags, intN shortid, JSProperty **propp);/* * Unlike js_DefineProperty, propp must be non-null. On success, and if id was * found, return true with *objp non-null and locked, and with a held property * stored in *propp. If successful but id was not found, return true with both * *objp and *propp null. Therefore all callers who receive a non-null *propp * must later call OBJ_DROP_PROPERTY(cx, *objp, *propp). */extern JS_FRIEND_API(JSBool)js_LookupProperty(JSContext *cx, JSObject *obj, jsid id, JSObject **objp, JSProperty **propp);/* * Specialized subroutine that allows caller to preset JSRESOLVE_* flags. * JSRESOLVE_HIDDEN flags hidden function param/local name lookups, just for * internal use by fun_resolve and similar built-ins. */extern JSBooljs_LookupPropertyWithFlags(JSContext *cx, JSObject *obj, jsid id, uintN flags, JSObject **objp, JSProperty **propp);#define JSRESOLVE_HIDDEN 0x8000extern JS_FRIEND_API(JSBool)js_FindProperty(JSContext *cx, jsid id, JSObject **objp, JSObject **pobjp, JSProperty **propp);extern JSObject *js_FindIdentifierBase(JSContext *cx, jsid id);extern JSObject *js_FindVariableScope(JSContext *cx, JSFunction **funp);/* * NB: js_NativeGet and js_NativeSet are called with the scope containing sprop * (pobj's scope for Get, obj's for Set) locked, and on successful return, that * scope is again locked. But on failure, both functions return false with the * scope containing sprop unlocked. */extern JSBooljs_NativeGet(JSContext *cx, JSObject *obj, JSObject *pobj, JSScopeProperty *sprop, jsval *vp);extern JSBooljs_NativeSet(JSContext *cx, JSObject *obj, JSScopeProperty *sprop, jsval *vp);extern JSBooljs_GetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);extern JSBooljs_SetProperty(JSContext *cx, JSObject *obj, jsid id, jsval *vp);extern JSBooljs_GetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop, uintN *attrsp);extern JSBooljs_SetAttributes(JSContext *cx, JSObject *obj, jsid id, JSProperty *prop, uintN *attrsp);extern JSBooljs_DeleteProperty(JSContext *cx, JSObject *obj, jsid id, jsval *rval);extern JSBooljs_DefaultValue(JSContext *cx, JSObject *obj, JSType hint, jsval *vp);extern JSIdArray *js_NewIdArray(JSContext *cx, jsint length);/* * Unlike realloc(3), this function frees ida on failure. */extern JSIdArray *js_SetIdArrayLength(JSContext *cx, JSIdArray *ida, jsint length);extern JSBooljs_Enumerate(JSContext *cx, JSObject *obj, JSIterateOp enum_op, jsval *statep, jsid *idp);extern voidjs_MarkNativeIteratorStates(JSContext *cx);extern JSBooljs_CheckAccess(JSContext *cx, JSObject *obj, jsid id, JSAccessMode mode, jsval *vp, uintN *attrsp);extern JSBooljs_Call(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);extern JSBooljs_Construct(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval);extern JSBooljs_HasInstance(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);extern JSBooljs_SetProtoOrParent(JSContext *cx, JSObject *obj, uint32 slot, JSObject *pobj);extern JSBooljs_IsDelegate(JSContext *cx, JSObject *obj, jsval v, JSBool *bp);extern JSBooljs_GetClassPrototype(JSContext *cx, JSObject *scope, jsid id, JSObject **protop);extern JSBooljs_SetClassPrototype(JSContext *cx, JSObject *ctor, JSObject *proto, uintN attrs);extern JSBooljs_ValueToObject(JSContext *cx, jsval v, JSObject **objp);extern JSObject *js_ValueToNonNullObject(JSContext *cx, jsval v);extern JSBooljs_TryValueOf(JSContext *cx, JSObject *obj, JSType type, jsval *rval);extern JSBooljs_TryMethod(JSContext *cx, JSObject *obj, JSAtom *atom, uintN argc, jsval *argv, jsval *rval);extern JSBooljs_XDRObject(JSXDRState *xdr, JSObject **objp);extern uint32js_Mark(JSContext *cx, JSObject *obj, void *arg);extern voidjs_Clear(JSContext *cx, JSObject *obj);extern jsvaljs_GetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot);extern JSBooljs_SetRequiredSlot(JSContext *cx, JSObject *obj, uint32 slot, jsval v);extern JSObject *js_CheckScopeChainValidity(JSContext *cx, JSObject *scopeobj, const char *caller);extern JSBooljs_CheckPrincipalsAccess(JSContext *cx, JSObject *scopeobj, JSPrincipals *principals, JSAtom *caller);JS_END_EXTERN_C#endif /* jsobj_h___ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -