author | Tom Schuster <evilpies@gmail.com> |
Mon, 11 Feb 2013 21:05:13 +0100 | |
changeset 121538 | b9a00a67b74948df2d8b1673e520151028764bad |
parent 121537 | 9a8d04f67e396ac918bbfcbf5ca45dd1c91f5d32 |
child 121539 | d91d6e2bc2587b4c6816574d0872bb3ae0bba746 |
push id | 24296 |
push user | emorley@mozilla.com |
push date | Tue, 12 Feb 2013 14:43:19 +0000 |
treeherder | mozilla-central@860d7a47b675 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | jorendorff |
bugs | 839027 |
milestone | 21.0a1 |
first release with | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
--- a/js/src/builtin/ParallelArray.cpp +++ b/js/src/builtin/ParallelArray.cpp @@ -969,17 +969,16 @@ Class ParallelArrayObject::class_ = { setGenericAttributes, setPropertyAttributes, setElementAttributes, setSpecialAttributes, deleteProperty, deleteElement, deleteSpecial, NULL, // enumerate - NULL, // typeof NULL, // thisObject } }; JSObject * ParallelArrayObject::initClass(JSContext *cx, JSObject *obj) { JS_ASSERT(obj->isNative());
--- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -1008,22 +1008,16 @@ typedef JSBool /* * Convert obj to the given type, returning true with the resulting value in * *vp on success, and returning false on error or exception. */ typedef JSBool (* JSConvertOp)(JSContext *cx, JSHandleObject obj, JSType type, JSMutableHandleValue vp); -/* - * Delegate typeof to an object so it can cloak a primitive or another object. - */ -typedef JSType -(* JSTypeOfOp)(JSContext *cx, JSHandleObject obj); - typedef struct JSFreeOp JSFreeOp; struct JSFreeOp { private: JSRuntime *runtime_; protected: JSFreeOp(JSRuntime *rt)
--- a/js/src/jsclass.h +++ b/js/src/jsclass.h @@ -182,18 +182,17 @@ typedef JSBool typedef JSBool (* SpecialAttributesOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, unsigned *attrsp); typedef JSBool (* DeletePropertyOp)(JSContext *cx, HandleObject obj, HandlePropertyName name, MutableHandleValue vp, JSBool strict); typedef JSBool (* DeleteElementOp)(JSContext *cx, HandleObject obj, uint32_t index, MutableHandleValue vp, JSBool strict); typedef JSBool (* DeleteSpecialOp)(JSContext *cx, HandleObject obj, HandleSpecialId sid, MutableHandleValue vp, JSBool strict); -typedef JSType -(* TypeOfOp)(JSContext *cx, HandleObject obj); + typedef JSObject * (* ObjectOp)(JSContext *cx, HandleObject obj); typedef void (* FinalizeOp)(FreeOp *fop, RawObject obj); #define JS_CLASS_MEMBERS \ const char *name; \ @@ -282,24 +281,23 @@ struct ObjectOps PropertyAttributesOp setPropertyAttributes; ElementAttributesOp setElementAttributes; SpecialAttributesOp setSpecialAttributes; DeletePropertyOp deleteProperty; DeleteElementOp deleteElement; DeleteSpecialOp deleteSpecial; JSNewEnumerateOp enumerate; - TypeOfOp typeOf; ObjectOp thisObject; }; #define JS_NULL_OBJECT_OPS \ {NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL,NULL, \ - NULL,NULL,NULL,NULL} + NULL,NULL,NULL} struct Class { JS_CLASS_MEMBERS; ClassExtension ext; ObjectOps ops; uint8_t pad[sizeof(JSClass) - sizeof(ClassSizeMeasurement) - sizeof(ClassExtension) - sizeof(ObjectOps)];
--- a/js/src/jsinterp.cpp +++ b/js/src/jsinterp.cpp @@ -715,17 +715,17 @@ js::TypeOfValue(JSContext *cx, const Val if (v.isString()) return JSTYPE_STRING; if (v.isNull()) return JSTYPE_OBJECT; if (v.isUndefined()) return JSTYPE_VOID; if (v.isObject()) { RootedObject obj(cx, &v.toObject()); - return JSObject::typeOf(cx, obj); + return baseops::TypeOf(cx, obj); } JS_ASSERT(v.isBoolean()); return JSTYPE_BOOLEAN; } /* * Enter the new with scope using an object at sp[-1] and associate the depth * of the with block with sp + stackIndex.
--- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -920,17 +920,16 @@ class JSObject : public js::ObjectImpl js::MutableHandleValue rval, bool strict); static bool deleteByValue(JSContext *cx, js::HandleObject obj, const js::Value &property, js::MutableHandleValue rval, bool strict); static inline bool enumerate(JSContext *cx, JS::HandleObject obj, JSIterateOp iterop, JS::MutableHandleValue statep, JS::MutableHandleId idp); static inline bool defaultValue(JSContext *cx, js::HandleObject obj, JSType hint, js::MutableHandleValue vp); - static inline JSType typeOf(JSContext *cx, js::HandleObject obj); static inline JSObject *thisObject(JSContext *cx, js::HandleObject obj); static bool thisObject(JSContext *cx, const js::Value &v, js::Value *vp); bool swap(JSContext *cx, JSObject *other); inline void initArrayClass();
--- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -68,23 +68,16 @@ JSObject::defaultValue(JSContext *cx, js if (op == JS_ConvertStub) ok = js::DefaultValue(cx, obj, hint, vp); else ok = op(cx, obj, hint, vp); JS_ASSERT_IF(ok, vp.isPrimitive()); return ok; } -/* static */ inline JSType -JSObject::typeOf(JSContext *cx, js::HandleObject obj) -{ - js::TypeOfOp op = obj->getOps()->typeOf; - return (op ? op : js::baseops::TypeOf)(cx, obj); -} - /* static */ inline JSObject * JSObject::thisObject(JSContext *cx, js::HandleObject obj) { JSObjectOp op = obj->getOps()->thisObject; return op ? op(cx, obj) : obj; } /* static */ inline JSBool
--- a/js/src/jsproxy.cpp +++ b/js/src/jsproxy.cpp @@ -342,22 +342,16 @@ bool BaseProxyHandler::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { RootedValue val(cx, ObjectValue(*proxy.get())); js_ReportValueError(cx, JSMSG_BAD_INSTANCEOF_RHS, JSDVG_SEARCH_STACK, val, NullPtr()); return false; } -JSType -BaseProxyHandler::typeOf(JSContext *cx, JSObject *proxy) -{ - return IsFunctionProxy(proxy) ? JSTYPE_FUNCTION : JSTYPE_OBJECT; -} - bool BaseProxyHandler::objectClassIs(JSObject *proxy, ESClassValue classValue, JSContext *cx) { return false; } void BaseProxyHandler::finalize(JSFreeOp *fop, JSObject *proxy) @@ -472,21 +466,16 @@ DirectProxyHandler::hasInstance(JSContex JSBool b; RootedObject target(cx, GetProxyTargetObject(proxy)); if (!JS_HasInstance(cx, target, v, &b)) return false; *bp = !!b; return true; } -JSType -DirectProxyHandler::typeOf(JSContext *cx, JSObject *proxy) -{ - return TypeOfValue(cx, ObjectValue(*GetProxyTargetObject(proxy))); -} bool DirectProxyHandler::objectClassIs(JSObject *proxy, ESClassValue classValue, JSContext *cx) { return ObjectClassIs(*GetProxyTargetObject(proxy), classValue, cx); } @@ -743,17 +732,16 @@ class ScriptedIndirectProxyHandler : pub virtual bool set(JSContext *cx, JSObject *proxy, JSObject *receiver, jsid id, bool strict, Value *vp) MOZ_OVERRIDE; virtual bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props) MOZ_OVERRIDE; virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp) MOZ_OVERRIDE; /* Spidermonkey extensions. */ virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) MOZ_OVERRIDE; - virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Value *vp) MOZ_OVERRIDE; static ScriptedIndirectProxyHandler singleton; }; static int sScriptedIndirectProxyHandlerFamily = 0; ScriptedIndirectProxyHandler::ScriptedIndirectProxyHandler() @@ -962,28 +950,16 @@ ScriptedIndirectProxyHandler::iterate(JS bool ScriptedIndirectProxyHandler::nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) { return BaseProxyHandler::nativeCall(cx, test, impl, args); } - -JSType -ScriptedIndirectProxyHandler::typeOf(JSContext *cx, JSObject *proxy) -{ - /* - * This function is only here to prevent a regression in - * js1_8_5/extensions/scripted-proxies.js. It will be removed when the - * direct proxy refactor is complete. - */ - return BaseProxyHandler::typeOf(cx, proxy); -} - bool ScriptedIndirectProxyHandler::defaultValue(JSContext *cx, JSObject *proxy, JSType hint, Value *vp) { /* * This function is only here to prevent bug 757063. It will be removed when * the direct proxy refactor is complete. */ return BaseProxyHandler::defaultValue(cx, proxy, hint, vp); @@ -2475,25 +2451,16 @@ Proxy::nativeCall(JSContext *cx, IsAccep bool Proxy::hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) { JS_CHECK_RECURSION(cx, return false); return GetProxyHandler(proxy)->hasInstance(cx, proxy, v, bp); } -JSType -Proxy::typeOf(JSContext *cx, JSObject *proxy_) -{ - // FIXME: API doesn't allow us to report error (bug 618906). - JS_CHECK_RECURSION(cx, return JSTYPE_OBJECT); - RootedObject proxy(cx, proxy_); - return GetProxyHandler(proxy)->typeOf(cx, proxy); -} - bool Proxy::objectClassIs(JSObject *proxy_, ESClassValue classValue, JSContext *cx) { RootedObject proxy(cx, proxy_); return GetProxyHandler(proxy)->objectClassIs(proxy, classValue, cx); } JSString * @@ -2872,23 +2839,16 @@ proxy_HasInstance(JSContext *cx, HandleO { bool b; if (!Proxy::hasInstance(cx, proxy, v, &b)) return false; *bp = !!b; return true; } -static JSType -proxy_TypeOf(JSContext *cx, HandleObject proxy) -{ - JS_ASSERT(proxy->isProxy()); - return Proxy::typeOf(cx, proxy); -} - #define PROXY_CLASS_EXT \ { \ NULL, /* equality */ \ NULL, /* outerObject */ \ NULL, /* innerObject */ \ NULL, /* iteratorObject */ \ NULL, /* unused */ \ false, /* isWrappedNative */ \ @@ -2937,17 +2897,16 @@ JS_FRIEND_DATA(Class) js::ObjectProxyCla proxy_SetGenericAttributes, proxy_SetPropertyAttributes, proxy_SetElementAttributes, proxy_SetSpecialAttributes, proxy_DeleteProperty, proxy_DeleteElement, proxy_DeleteSpecial, NULL, /* enumerate */ - proxy_TypeOf, NULL, /* thisObject */ } }; JS_FRIEND_DATA(Class) js::OuterWindowProxyClass = { "Proxy", Class::NON_NATIVE | JSCLASS_IMPLEMENTS_BARRIERS | JSCLASS_HAS_RESERVED_SLOTS(4), JS_PropertyStub, /* addProperty */ @@ -2997,17 +2956,16 @@ JS_FRIEND_DATA(Class) js::OuterWindowPro proxy_SetGenericAttributes, proxy_SetPropertyAttributes, proxy_SetElementAttributes, proxy_SetSpecialAttributes, proxy_DeleteProperty, proxy_DeleteElement, proxy_DeleteSpecial, NULL, /* enumerate */ - NULL, /* typeof */ NULL, /* thisObject */ } }; static JSBool proxy_Call(JSContext *cx, unsigned argc, Value *vp) { RootedObject proxy(cx, &JS_CALLEE(cx, vp).toObject()); @@ -3065,17 +3023,16 @@ JS_FRIEND_DATA(Class) js::FunctionProxyC proxy_SetGenericAttributes, proxy_SetPropertyAttributes, proxy_SetElementAttributes, proxy_SetSpecialAttributes, proxy_DeleteProperty, proxy_DeleteElement, proxy_DeleteSpecial, NULL, /* enumerate */ - proxy_TypeOf, NULL, /* thisObject */ } }; static JSObject * NewProxyObject(JSContext *cx, BaseProxyHandler *handler, const Value &priv_, TaggedProto proto_, JSObject *parent_, JSObject *call_, JSObject *construct_) {
--- a/js/src/jsproxy.h +++ b/js/src/jsproxy.h @@ -95,17 +95,16 @@ class JS_FRIEND_API(BaseProxyHandler) { virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp); /* Spidermonkey extensions. */ virtual bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); virtual bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); - virtual JSType typeOf(JSContext *cx, JSObject *proxy); virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); virtual JSString *obj_toString(JSContext *cx, JSObject *proxy); virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent); virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g); virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Value *vp); virtual void finalize(JSFreeOp *fop, JSObject *proxy); virtual bool getElementIfPresent(JSContext *cx, JSObject *obj, JSObject *receiver, uint32_t index, Value *vp, bool *present); @@ -154,17 +153,16 @@ public: virtual bool iterate(JSContext *cx, JSObject *proxy, unsigned flags, Value *vp) MOZ_OVERRIDE; /* Spidermonkey extensions. */ virtual bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args) MOZ_OVERRIDE; virtual bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp) MOZ_OVERRIDE; - virtual JSType typeOf(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; virtual bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx) MOZ_OVERRIDE; virtual JSString *obj_toString(JSContext *cx, JSObject *proxy) MOZ_OVERRIDE; virtual JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent) MOZ_OVERRIDE; virtual bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g) MOZ_OVERRIDE; virtual bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, @@ -201,17 +199,16 @@ class Proxy { static bool keys(JSContext *cx, JSObject *proxy, AutoIdVector &props); static bool iterate(JSContext *cx, HandleObject proxy, unsigned flags, MutableHandleValue vp); /* Spidermonkey extensions. */ static bool call(JSContext *cx, JSObject *proxy, unsigned argc, Value *vp); static bool construct(JSContext *cx, JSObject *proxy, unsigned argc, Value *argv, Value *rval); static bool nativeCall(JSContext *cx, IsAcceptableThis test, NativeImpl impl, CallArgs args); static bool hasInstance(JSContext *cx, HandleObject proxy, MutableHandleValue v, bool *bp); - static JSType typeOf(JSContext *cx, JSObject *proxy); static bool objectClassIs(JSObject *obj, ESClassValue classValue, JSContext *cx); static JSString *obj_toString(JSContext *cx, JSObject *proxy); static JSString *fun_toString(JSContext *cx, JSObject *proxy, unsigned indent); static bool regexp_toShared(JSContext *cx, JSObject *proxy, RegExpGuard *g); static bool defaultValue(JSContext *cx, JSObject *obj, JSType hint, Value *vp); static bool getPrototypeOf(JSContext *cx, JSObject *proxy, JSObject **protop); static JSObject * const LazyProto;
--- a/js/src/jstypedarray.cpp +++ b/js/src/jstypedarray.cpp @@ -3179,17 +3179,16 @@ Class js::ArrayBufferClass = { ArrayBufferObject::obj_setGenericAttributes, ArrayBufferObject::obj_setPropertyAttributes, ArrayBufferObject::obj_setElementAttributes, ArrayBufferObject::obj_setSpecialAttributes, ArrayBufferObject::obj_deleteProperty, ArrayBufferObject::obj_deleteElement, ArrayBufferObject::obj_deleteSpecial, ArrayBufferObject::obj_enumerate, - NULL, /* typeOf */ NULL, /* thisObject */ } }; JSFunctionSpec ArrayBufferObject::jsfuncs[] = { JS_FN("slice", ArrayBufferObject::fun_slice, 2, JSFUN_GENERIC_NATIVE), JS_FS_END }; @@ -3351,17 +3350,16 @@ IMPL_TYPED_ARRAY_COMBINED_UNWRAPPERS(Flo _typedArray::obj_setGenericAttributes, \ _typedArray::obj_setPropertyAttributes, \ _typedArray::obj_setElementAttributes, \ _typedArray::obj_setSpecialAttributes, \ _typedArray::obj_deleteProperty, \ _typedArray::obj_deleteElement, \ _typedArray::obj_deleteSpecial, \ _typedArray::obj_enumerate, \ - NULL, /* typeOf */ \ NULL, /* thisObject */ \ } \ } template<class ArrayType> static inline JSObject * InitTypedArrayClass(JSContext *cx) {
--- a/js/src/vm/ScopeObject.cpp +++ b/js/src/vm/ScopeObject.cpp @@ -540,22 +540,16 @@ with_DeleteSpecial(JSContext *cx, Handle static JSBool with_Enumerate(JSContext *cx, HandleObject obj, JSIterateOp enum_op, MutableHandleValue statep, MutableHandleId idp) { RootedObject actual(cx, &obj->asWith().object()); return JSObject::enumerate(cx, actual, enum_op, statep, idp); } -static JSType -with_TypeOf(JSContext *cx, HandleObject obj) -{ - return JSTYPE_OBJECT; -} - static JSObject * with_ThisObject(JSContext *cx, HandleObject obj) { return &obj->asWith().withThis(); } Class js::WithClass = { "With", @@ -600,17 +594,16 @@ Class js::WithClass = { with_SetGenericAttributes, with_SetPropertyAttributes, with_SetElementAttributes, with_SetSpecialAttributes, with_DeleteProperty, with_DeleteElement, with_DeleteSpecial, with_Enumerate, - with_TypeOf, with_ThisObject, } }; /*****************************************************************************/ ClonedBlockObject * ClonedBlockObject::create(JSContext *cx, Handle<StaticBlockObject *> block, AbstractFramePtr frame)
--- a/js/xpconnect/src/XPCWrappedNativeJSOps.cpp +++ b/js/xpconnect/src/XPCWrappedNativeJSOps.cpp @@ -806,17 +806,16 @@ XPCWrappedNativeJSClass XPC_WN_NoHelper_ nullptr, // setGenericAttributes nullptr, // setAttributes nullptr, // setElementAttributes nullptr, // setSpecialAttributes nullptr, // deleteProperty nullptr, // deleteElement nullptr, // deleteSpecial XPC_WN_JSOp_Enumerate, - XPC_WN_JSOp_TypeOf_Object, XPC_WN_JSOp_ThisObject, } }, 0 // interfacesBitmap }; /***************************************************************************/ @@ -1193,28 +1192,16 @@ XPC_WN_JSOp_Enumerate(JSContext *cx, JSH } } // else call js_ObjectOps.enumerate... return JS_EnumerateState(cx, obj, enum_op, statep, idp); } -JSType -XPC_WN_JSOp_TypeOf_Object(JSContext *cx, JSHandleObject obj) -{ - return JSTYPE_OBJECT; -} - -JSType -XPC_WN_JSOp_TypeOf_Function(JSContext *cx, JSHandleObject obj) -{ - return JSTYPE_FUNCTION; -} - namespace { NS_STACK_CLASS class AutoPopJSContext { public: AutoPopJSContext(XPCJSContextStack *stack) : mCx(nullptr), mStack(stack) {
--- a/js/xpconnect/src/xpcprivate.h +++ b/js/xpconnect/src/xpcprivate.h @@ -1476,22 +1476,16 @@ XPC_WN_CallMethod(JSContext *cx, unsigne extern JSBool XPC_WN_GetterSetter(JSContext *cx, unsigned argc, jsval *vp); extern JSBool XPC_WN_JSOp_Enumerate(JSContext *cx, JSHandleObject obj, JSIterateOp enum_op, JSMutableHandleValue statep, JSMutableHandleId idp); -extern JSType -XPC_WN_JSOp_TypeOf_Object(JSContext *cx, JSHandleObject obj); - -extern JSType -XPC_WN_JSOp_TypeOf_Function(JSContext *cx, JSHandleObject obj); - extern JSObject* XPC_WN_JSOp_ThisObject(JSContext *cx, JSHandleObject obj); // Macros to initialize Object or Function like XPC_WN classes #define XPC_WN_WithCall_ObjectOps \ { \ nullptr, /* lookupGeneric */ \ nullptr, /* lookupProperty */ \ @@ -1517,17 +1511,16 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS nullptr, /* setGenericAttributes */ \ nullptr, /* setAttributes */ \ nullptr, /* setElementAttributes */ \ nullptr, /* setSpecialAttributes */ \ nullptr, /* deleteProperty */ \ nullptr, /* deleteElement */ \ nullptr, /* deleteSpecial */ \ XPC_WN_JSOp_Enumerate, \ - XPC_WN_JSOp_TypeOf_Function, \ XPC_WN_JSOp_ThisObject, \ } #define XPC_WN_NoCall_ObjectOps \ { \ nullptr, /* lookupGeneric */ \ nullptr, /* lookupProperty */ \ nullptr, /* lookupElement */ \ @@ -1552,17 +1545,16 @@ XPC_WN_JSOp_ThisObject(JSContext *cx, JS nullptr, /* setGenericAttributes */ \ nullptr, /* setAttributes */ \ nullptr, /* setElementAttributes */ \ nullptr, /* setSpecialAttributes */ \ nullptr, /* deleteProperty */ \ nullptr, /* deleteElement */ \ nullptr, /* deleteSpecial */ \ XPC_WN_JSOp_Enumerate, \ - XPC_WN_JSOp_TypeOf_Object, \ XPC_WN_JSOp_ThisObject, \ } // Maybe this macro should check for class->enumerate == // XPC_WN_Shared_Proto_Enumerate or something rather than checking for // 4 classes? static inline bool IS_PROTO_CLASS(js::Class *clazz) {