Bug 983462 - Implement own property native getter cacheing at JSOP_GETPROP sites in BC. (r=djvj)

This commit is contained in:
Eric Faust 2014-03-24 14:55:25 -07:00
parent 62b5a7609b
commit 7156d47c42

View File

@ -3382,10 +3382,6 @@ IsCacheableGetPropCall(JSContext *cx, JSObject *obj, JSObject *holder, Shape *sh
{
JS_ASSERT(isScripted);
// Currently we only optimize getter calls for getters bound on prototypes.
if (obj == holder)
return false;
if (!shape || !IsCacheableProtoChain(obj, holder, isDOMProxy))
return false;
@ -3783,6 +3779,10 @@ static bool TryAttachNativeGetElemStub(JSContext *cx, HandleScript script, jsbyt
return true;
#endif
// For now, we do not handle own property getters
if (obj == holder)
return true;
// If a suitable stub already exists, nothing else to do.
if (GetElemNativeStubExists(stub, obj, holder, propName, needsAtomize))
return true;
@ -5648,9 +5648,8 @@ TryAttachGlobalNameStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return true;
}
if (shape->hasGetterValue() && shape->getterValue().isObject() &&
shape->getterObject()->is<JSFunction>() &&
shape->getterObject()->as<JSFunction>().isNative())
bool isScripted;
if (IsCacheableGetPropCall(cx, global, global, shape, &isScripted) && !isScripted)
{
#ifdef JS_HAS_NO_SUCH_METHOD
if (JSOp(*pc) == JSOP_CALLGNAME)
@ -6172,6 +6171,10 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
return true;
#endif
// Don't handle scripted own property getters
if (obj == holder)
return true;
RootedFunction callee(cx, &shape->getterObject()->as<JSFunction>());
JS_ASSERT(obj != holder);
JS_ASSERT(callee->hasScript());
@ -6201,7 +6204,6 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
#endif
RootedFunction callee(cx, &shape->getterObject()->as<JSFunction>());
JS_ASSERT(obj != holder);
JS_ASSERT(callee->isNative());
IonSpew(IonSpew_BaselineIC, " Generating GetProp(%s%s/NativeGetter %p) stub",
@ -6211,6 +6213,7 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
ICStub *newStub = nullptr;
if (isDOMProxy) {
JS_ASSERT(obj != holder);
ICStub::Kind kind;
if (domProxyHasGeneration) {
if (UpdateExistingGenerationalDOMProxyStub(stub, obj)) {
@ -6225,6 +6228,10 @@ TryAttachNativeGetPropStub(JSContext *cx, HandleScript script, jsbytecode *pc,
ICGetPropCallDOMProxyNativeCompiler
compiler(cx, kind, monitorStub, proxy, holder, callee, script->pcToOffset(pc));
newStub = compiler.getStub(compiler.getStubSpace(script));
} else if (obj == holder) {
ICGetProp_CallNative::Compiler compiler(cx, monitorStub, obj, callee,
script->pcToOffset(pc));
newStub = compiler.getStub(compiler.getStubSpace(script));
} else {
ICGetProp_CallNativePrototype::Compiler compiler(cx, monitorStub, obj, holder, callee,
script->pcToOffset(pc));