mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1133746. Allow DOMProxyShadows to communicate to the JIT whether the shadowing is done by the expando object or not. r=efaust,peterv
This commit is contained in:
parent
6038f5819e
commit
0123e1e87e
@ -33,17 +33,22 @@ const char DOMProxyHandler::family = 0;
|
|||||||
js::DOMProxyShadowsResult
|
js::DOMProxyShadowsResult
|
||||||
DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
|
DOMProxyShadows(JSContext* cx, JS::Handle<JSObject*> proxy, JS::Handle<jsid> id)
|
||||||
{
|
{
|
||||||
|
JS::Rooted<JSObject*> expando(cx, DOMProxyHandler::GetExpandoObject(proxy));
|
||||||
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
|
JS::Value v = js::GetProxyExtra(proxy, JSPROXYSLOT_EXPANDO);
|
||||||
if (v.isObject()) {
|
bool isOverrideBuiltins = !v.isObject() && !v.isUndefined();
|
||||||
|
if (expando) {
|
||||||
bool hasOwn;
|
bool hasOwn;
|
||||||
Rooted<JSObject*> object(cx, &v.toObject());
|
if (!JS_AlreadyHasOwnPropertyById(cx, expando, id, &hasOwn))
|
||||||
if (!JS_AlreadyHasOwnPropertyById(cx, object, id, &hasOwn))
|
|
||||||
return js::ShadowCheckFailed;
|
return js::ShadowCheckFailed;
|
||||||
|
|
||||||
return hasOwn ? js::Shadows : js::DoesntShadow;
|
if (hasOwn) {
|
||||||
|
return isOverrideBuiltins ?
|
||||||
|
js::ShadowsViaIndirectExpando : js::ShadowsViaDirectExpando;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (v.isUndefined()) {
|
if (!isOverrideBuiltins) {
|
||||||
|
// Our expando, if any, didn't shadow, so we're not shadowing at all.
|
||||||
return js::DoesntShadow;
|
return js::DoesntShadow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3220,7 +3220,7 @@ EffectlesslyLookupProperty(JSContext *cx, HandleObject obj, HandlePropertyName n
|
|||||||
if (*shadowsResult == ShadowCheckFailed)
|
if (*shadowsResult == ShadowCheckFailed)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (*shadowsResult == Shadows) {
|
if (DOMProxyIsShadowing(*shadowsResult)) {
|
||||||
holder.set(obj);
|
holder.set(obj);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -6519,7 +6519,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If it's a shadowed listbase proxy property, attach stub to call Proxy::get instead.
|
// If it's a shadowed listbase proxy property, attach stub to call Proxy::get instead.
|
||||||
if (isDOMProxy && domProxyShadowsResult == Shadows) {
|
if (isDOMProxy && DOMProxyIsShadowing(domProxyShadowsResult)) {
|
||||||
MOZ_ASSERT(obj == holder);
|
MOZ_ASSERT(obj == holder);
|
||||||
#if JS_HAS_NO_SUCH_METHOD
|
#if JS_HAS_NO_SUCH_METHOD
|
||||||
if (isCallProp)
|
if (isCallProp)
|
||||||
|
@ -1697,9 +1697,10 @@ GetPropertyIC::tryAttachProxy(JSContext *cx, HandleScript outerScript, IonScript
|
|||||||
DOMProxyShadowsResult shadows = GetDOMProxyShadowsCheck()(cx, obj, id);
|
DOMProxyShadowsResult shadows = GetDOMProxyShadowsCheck()(cx, obj, id);
|
||||||
if (shadows == ShadowCheckFailed)
|
if (shadows == ShadowCheckFailed)
|
||||||
return false;
|
return false;
|
||||||
if (shadows == Shadows)
|
if (DOMProxyIsShadowing(shadows))
|
||||||
return tryAttachDOMProxyShadowed(cx, outerScript, ion, obj, returnAddr, emitted);
|
return tryAttachDOMProxyShadowed(cx, outerScript, ion, obj, returnAddr, emitted);
|
||||||
|
|
||||||
|
MOZ_ASSERT(shadows == DoesntShadow || shadows == DoesntShadowUnique);
|
||||||
return tryAttachDOMProxyUnshadowed(cx, outerScript, ion, obj, name,
|
return tryAttachDOMProxyUnshadowed(cx, outerScript, ion, obj, name,
|
||||||
shadows == DoesntShadowUnique, returnAddr, emitted);
|
shadows == DoesntShadowUnique, returnAddr, emitted);
|
||||||
}
|
}
|
||||||
@ -2969,7 +2970,7 @@ SetPropertyIC::update(JSContext *cx, HandleScript outerScript, size_t cacheIndex
|
|||||||
DOMProxyShadowsResult shadows = GetDOMProxyShadowsCheck()(cx, obj, id);
|
DOMProxyShadowsResult shadows = GetDOMProxyShadowsCheck()(cx, obj, id);
|
||||||
if (shadows == ShadowCheckFailed)
|
if (shadows == ShadowCheckFailed)
|
||||||
return false;
|
return false;
|
||||||
if (shadows == Shadows) {
|
if (DOMProxyIsShadowing(shadows)) {
|
||||||
if (!cache.attachDOMProxyShadowed(cx, outerScript, ion, obj, returnAddr))
|
if (!cache.attachDOMProxyShadowed(cx, outerScript, ion, obj, returnAddr))
|
||||||
return false;
|
return false;
|
||||||
addedSetterStub = true;
|
addedSetterStub = true;
|
||||||
|
@ -1176,14 +1176,23 @@ NukeCrossCompartmentWrappers(JSContext* cx,
|
|||||||
* The DOMProxyShadowsCheck function will be called to check if the property for
|
* The DOMProxyShadowsCheck function will be called to check if the property for
|
||||||
* id should be gotten from the prototype, or if there is an own property that
|
* id should be gotten from the prototype, or if there is an own property that
|
||||||
* shadows it.
|
* shadows it.
|
||||||
* If DoesntShadow is returned then the slot at listBaseExpandoSlot should
|
* * If ShadowsViaDirectExpando is returned, then the slot at
|
||||||
* either be undefined or point to an expando object that would contain the own
|
* listBaseExpandoSlot contains an expando object which has the property in
|
||||||
* property.
|
* question.
|
||||||
* If DoesntShadowUnique is returned then the slot at listBaseExpandoSlot should
|
* * If ShadowsViaIndirectExpando is returned, then the slot at
|
||||||
* contain a private pointer to a ExpandoAndGeneration, which contains a
|
* listBaseExpandoSlot contains a private pointer to an ExpandoAndGeneration
|
||||||
* JS::Value that should either be undefined or point to an expando object, and
|
* and the expando object in the ExpandoAndGeneration has the property in
|
||||||
* a uint32 value. If that value changes then the IC for getting a property will
|
* question.
|
||||||
* be invalidated.
|
* * If DoesntShadow is returned then the slot at listBaseExpandoSlot should
|
||||||
|
* either be undefined or point to an expando object that would contain the
|
||||||
|
* own property.
|
||||||
|
* * If DoesntShadowUnique is returned then the slot at listBaseExpandoSlot
|
||||||
|
* should contain a private pointer to a ExpandoAndGeneration, which contains
|
||||||
|
* a JS::Value that should either be undefined or point to an expando object,
|
||||||
|
* and a uint32 value. If that value changes then the IC for getting a
|
||||||
|
* property will be invalidated.
|
||||||
|
* * If Shadows is returned, that means the property is an own property of the
|
||||||
|
* proxy but doesn't live on the expando object.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
struct ExpandoAndGeneration {
|
struct ExpandoAndGeneration {
|
||||||
@ -1216,7 +1225,9 @@ typedef enum DOMProxyShadowsResult {
|
|||||||
ShadowCheckFailed,
|
ShadowCheckFailed,
|
||||||
Shadows,
|
Shadows,
|
||||||
DoesntShadow,
|
DoesntShadow,
|
||||||
DoesntShadowUnique
|
DoesntShadowUnique,
|
||||||
|
ShadowsViaDirectExpando,
|
||||||
|
ShadowsViaIndirectExpando
|
||||||
} DOMProxyShadowsResult;
|
} DOMProxyShadowsResult;
|
||||||
typedef DOMProxyShadowsResult
|
typedef DOMProxyShadowsResult
|
||||||
(* DOMProxyShadowsCheck)(JSContext* cx, JS::HandleObject object, JS::HandleId id);
|
(* DOMProxyShadowsCheck)(JSContext* cx, JS::HandleObject object, JS::HandleId id);
|
||||||
@ -1227,6 +1238,11 @@ SetDOMProxyInformation(const void *domProxyHandlerFamily, uint32_t domProxyExpan
|
|||||||
const void *GetDOMProxyHandlerFamily();
|
const void *GetDOMProxyHandlerFamily();
|
||||||
uint32_t GetDOMProxyExpandoSlot();
|
uint32_t GetDOMProxyExpandoSlot();
|
||||||
DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
|
DOMProxyShadowsCheck GetDOMProxyShadowsCheck();
|
||||||
|
inline bool DOMProxyIsShadowing(DOMProxyShadowsResult result) {
|
||||||
|
return result == Shadows ||
|
||||||
|
result == ShadowsViaDirectExpando ||
|
||||||
|
result == ShadowsViaIndirectExpando;
|
||||||
|
}
|
||||||
|
|
||||||
/* Implemented in jsdate.cpp. */
|
/* Implemented in jsdate.cpp. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user