Bug 1131802 part 1. Add JS friend API to test whether a given function object has extended slots. r=terrence
authorBoris Zbarsky <bzbarsky@mit.edu>
Fri, 06 Mar 2015 16:33:30 -0500
changeset 232357 94a0946d5a0a09f4282d1c6513d3677d87e43f9b
parent 232356 cf124d9e2441864c73cdbfdc3aa40fc93fba73f9
child 232358 fdb146bc4052d731374a19a496b21640507ddb73
push id56525
push userbzbarsky@mozilla.com
push dateSat, 07 Mar 2015 02:16:16 +0000
treeherdermozilla-inbound@41846743ab88 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersterrence
bugs1131802
milestone39.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
Bug 1131802 part 1. Add JS friend API to test whether a given function object has extended slots. r=terrence
js/src/jsfriendapi.cpp
js/src/jsfriendapi.h
--- a/js/src/jsfriendapi.cpp
+++ b/js/src/jsfriendapi.cpp
@@ -469,16 +469,23 @@ JS_FRIEND_API(void)
 js::SetFunctionNativeReserved(JSObject *fun, size_t which, const Value &val)
 {
     MOZ_ASSERT(fun->as<JSFunction>().isNative());
     MOZ_ASSERT_IF(val.isObject(), val.toObject().compartment() == fun->compartment());
     fun->as<JSFunction>().setExtendedSlot(which, val);
 }
 
 JS_FRIEND_API(bool)
+js::FunctionHasNativeReserved(JSObject *fun)
+{
+    MOZ_ASSERT(fun->as<JSFunction>().isNative());
+    return fun->as<JSFunction>().isExtended();
+}
+
+JS_FRIEND_API(bool)
 js::GetObjectProto(JSContext *cx, JS::Handle<JSObject*> obj, JS::MutableHandle<JSObject*> proto)
 {
     if (IsProxy(obj))
         return JS_GetPrototype(cx, obj, proto);
 
     proto.set(reinterpret_cast<const shadow::Object*>(obj.get())->group->proto);
     return true;
 }
--- a/js/src/jsfriendapi.h
+++ b/js/src/jsfriendapi.h
@@ -753,16 +753,19 @@ NewFunctionByIdWithReserved(JSContext *c
 
 JS_FRIEND_API(const JS::Value &)
 GetFunctionNativeReserved(JSObject *fun, size_t which);
 
 JS_FRIEND_API(void)
 SetFunctionNativeReserved(JSObject *fun, size_t which, const JS::Value &val);
 
 JS_FRIEND_API(bool)
+FunctionHasNativeReserved(JSObject *fun);
+
+JS_FRIEND_API(bool)
 GetObjectProto(JSContext *cx, JS::HandleObject obj, JS::MutableHandleObject proto);
 
 JS_FRIEND_API(bool)
 GetOriginalEval(JSContext *cx, JS::HandleObject scope,
                 JS::MutableHandleObject eval);
 
 inline void *
 GetObjectPrivate(JSObject *obj)