author | Boris Zbarsky <bzbarsky@mit.edu> |
Fri, 23 Aug 2013 22:42:39 -0400 | |
changeset 144185 | e6d3fd6af60638f175aef3059acd9e9952a06804 |
parent 144184 | 862513e70ed3139e16a333cef2055e9f0685cc42 |
child 144186 | c0d21a0f16957669ba35e905089bbf49d561889d |
push id | 32903 |
push user | bzbarsky@mozilla.com |
push date | Sat, 24 Aug 2013 02:43:19 +0000 |
treeherder | mozilla-inbound@18311b19cd53 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | khuey |
bugs | 908351 |
milestone | 26.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/dom/bindings/DOMJSClass.h +++ b/dom/bindings/DOMJSClass.h @@ -6,61 +6,30 @@ #ifndef mozilla_dom_DOMJSClass_h #define mozilla_dom_DOMJSClass_h #include "jsfriendapi.h" #include "mozilla/Assertions.h" #include "mozilla/dom/PrototypeList.h" // auto-generated -class nsCycleCollectionParticipant; - -// We use slot 0 for holding the raw object. This is safe for both -// globals and non-globals. -#define DOM_OBJECT_SLOT 0 +#include "mozilla/dom/JSSlots.h" -// We use slot 1 for holding the expando object. This is not safe for globals -// until bug 760095 is fixed, so that bug blocks converting Window to new -// bindings. -#define DOM_XRAY_EXPANDO_SLOT 1 - -// We use slot 2 for holding either a JS::ObjectValue which points to the cached -// SOW or JS::UndefinedValue if this class doesn't need SOWs. This is not safe -// for globals until bug 760095 is fixed, so that bug blocks converting Window -// to new bindings. -#define DOM_OBJECT_SLOT_SOW 2 +class nsCycleCollectionParticipant; // All DOM globals must have a slot at DOM_PROTOTYPE_SLOT. #define DOM_PROTOTYPE_SLOT JSCLASS_GLOBAL_SLOT_COUNT // Keep this count up to date with any extra global slots added above. #define DOM_GLOBAL_SLOTS 1 // We use these flag bits for the new bindings. #define JSCLASS_DOM_GLOBAL JSCLASS_USERBIT1 #define JSCLASS_IS_DOMIFACEANDPROTOJSCLASS JSCLASS_USERBIT2 -// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and -// LSetDOMProperty. Those constants need to be changed accordingly if this value -// changes. -#define DOM_PROTO_INSTANCE_CLASS_SLOT 0 - -// Interface objects store a number of reserved slots equal to -// DOM_INTERFACE_SLOTS_BASE + number of named constructors. -#define DOM_INTERFACE_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1) - -// Interface prototype objects store a number of reserved slots equal to -// DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a -// slot for the unforgeable holder is needed. -#define DOM_INTERFACE_PROTO_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1) - -static_assert(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT, - "Interface prototype object use both of these, so they must " - "not be the same slot."); - namespace mozilla { namespace dom { typedef bool (* ResolveOwnProperty)(JSContext* cx, JS::Handle<JSObject*> wrapper, JS::Handle<JSObject*> obj, JS::Handle<jsid> id, JS::MutableHandle<JSPropertyDescriptor> desc, unsigned flags);
--- a/dom/bindings/DOMJSProxyHandler.cpp +++ b/dom/bindings/DOMJSProxyHandler.cpp @@ -1,17 +1,17 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- * vim: set ts=2 sw=2 et tw=99 ft=cpp: */ /* 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/. */ #include "mozilla/Util.h" -#include "DOMJSProxyHandler.h" +#include "mozilla/dom/DOMJSProxyHandler.h" #include "xpcpublic.h" #include "xpcprivate.h" #include "XPCQuickStubs.h" #include "XPCWrapper.h" #include "WrapperFactory.h" #include "nsDOMClassInfo.h" #include "nsGlobalWindow.h" #include "nsWrapperCacheInlines.h"
--- a/dom/bindings/DOMJSProxyHandler.h +++ b/dom/bindings/DOMJSProxyHandler.h @@ -12,16 +12,18 @@ #include "xpcpublic.h" #include "nsStringGlue.h" #define DOM_PROXY_OBJECT_SLOT js::PROXY_PRIVATE_SLOT namespace mozilla { namespace dom { +class DOMClass; + enum { JSPROXYSLOT_EXPANDO = 0, JSPROXYSLOT_XRAY_EXPANDO }; template<typename T> struct Prefable; class BaseDOMProxyHandler : public js::BaseProxyHandler
new file mode 100644 --- /dev/null +++ b/dom/bindings/JSSlots.h @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-*/ +/* 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/. */ + +/** + * This file defines various reserved slot indices used by JavaScript + * reflections of DOM objects. + */ +#ifndef mozilla_dom_DOMSlots_h +#define mozilla_dom_DOMSlots_h + +// We use slot 0 for holding the raw object. This is safe for both +// globals and non-globals. +#define DOM_OBJECT_SLOT 0 + +// We use slot 1 for holding the expando object. This is not safe for globals +// until bug 760095 is fixed, so that bug blocks converting Window to new +// bindings. +#define DOM_XRAY_EXPANDO_SLOT 1 + +// We use slot 2 for holding either a JS::ObjectValue which points to the cached +// SOW or JS::UndefinedValue if this class doesn't need SOWs. This is not safe +// for globals until bug 760095 is fixed, so that bug blocks converting Window +// to new bindings. +#define DOM_OBJECT_SLOT_SOW 2 + +// NOTE: This is baked into the Ion JIT as 0 in codegen for LGetDOMProperty and +// LSetDOMProperty. Those constants need to be changed accordingly if this value +// changes. +#define DOM_PROTO_INSTANCE_CLASS_SLOT 0 + +// Interface objects store a number of reserved slots equal to +// DOM_INTERFACE_SLOTS_BASE + number of named constructors. +#define DOM_INTERFACE_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1) + +// Interface prototype objects store a number of reserved slots equal to +// DOM_INTERFACE_PROTO_SLOTS_BASE or DOM_INTERFACE_PROTO_SLOTS_BASE + 1 if a +// slot for the unforgeable holder is needed. +#define DOM_INTERFACE_PROTO_SLOTS_BASE (DOM_XRAY_EXPANDO_SLOT + 1) + +static_assert(DOM_PROTO_INSTANCE_CLASS_SLOT != DOM_XRAY_EXPANDO_SLOT, + "Interface prototype object use both of these, so they must " + "not be the same slot."); + +#endif /* mozilla_dom_DOMSlots_h */
--- a/dom/bindings/moz.build +++ b/dom/bindings/moz.build @@ -17,16 +17,17 @@ EXPORTS.mozilla.dom += [ 'CallbackFunction.h', 'CallbackInterface.h', 'CallbackObject.h', 'DOMJSClass.h', 'DOMJSProxyHandler.h', 'Date.h', 'Errors.msg', 'GeneratedAtomList.h', + 'JSSlots.h', 'NonRefcountedDOMObject.h', 'Nullable.h', 'PrimitiveConversions.h', 'TypedArray.h', ] FAIL_ON_WARNINGS = True
--- a/dom/workers/DOMBindingBase.cpp +++ b/dom/workers/DOMBindingBase.cpp @@ -1,17 +1,16 @@ /* -*- Mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 40 -*- */ /* 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/. */ #include "DOMBindingBase.h" #include "jsfriendapi.h" -#include "mozilla/dom/DOMJSClass.h" #include "nsContentUtils.h" #include "nsWrapperCacheInlines.h" using namespace mozilla; using namespace mozilla::dom; USING_WORKERS_NAMESPACE DOMBindingBase::DOMBindingBase(JSContext* aCx)
--- a/dom/workers/Worker.h +++ b/dom/workers/Worker.h @@ -3,18 +3,16 @@ * 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/. */ #ifndef mozilla_dom_workers_worker_h__ #define mozilla_dom_workers_worker_h__ #include "Workers.h" -#include "mozilla/dom/DOMJSClass.h" - BEGIN_WORKERS_NAMESPACE namespace worker { JSObject* InitClass(JSContext* aCx, JSObject* aGlobal, JSObject* aProto, bool aMainRuntime);
--- a/js/xpconnect/src/XPCJSID.cpp +++ b/js/xpconnect/src/XPCJSID.cpp @@ -2,17 +2,16 @@ /* vim: set ts=8 sts=4 et sw=4 tw=99: */ /* 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/. */ /* An xpcom implementation of the JavaScript nsIID and nsCID objects. */ #include "xpcprivate.h" -#include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/Attributes.h" #include "XPCWrapper.h" #include "JavaScriptParent.h" using namespace mozilla::dom; using namespace JS;
--- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -31,17 +31,16 @@ #include "nsCCUncollectableMarker.h" #include "nsCycleCollectionNoteRootCallback.h" #include "nsScriptLoader.h" #include "jsdbgapi.h" #include "jsfriendapi.h" #include "jsprf.h" #include "js/MemoryMetrics.h" #include "mozilla/dom/AtomList.h" -#include "mozilla/dom/DOMJSClass.h" #include "mozilla/dom/BindingUtils.h" #include "mozilla/dom/Element.h" #include "mozilla/Attributes.h" #include "AccessCheck.h" #include "nsGlobalWindow.h" #include "GeckoProfiler.h" #include "nsJSPrincipals.h"
--- a/js/xpconnect/src/xpcpublic.h +++ b/js/xpconnect/src/xpcpublic.h @@ -13,17 +13,17 @@ #include "js/GCAPI.h" #include "nsISupports.h" #include "nsIURI.h" #include "nsIPrincipal.h" #include "nsWrapperCache.h" #include "nsStringGlue.h" #include "nsTArray.h" -#include "mozilla/dom/DOMJSClass.h" +#include "mozilla/dom/JSSlots.h" #include "nsMathUtils.h" #include "nsStringBuffer.h" #include "nsIGlobalObject.h" #include "mozilla/dom/BindingDeclarations.h" class nsIPrincipal; class nsIXPConnectWrappedJS; class nsScriptNameSpaceManager;