mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1094491 - Generate baseline getGName ICs for accessor properties before calling the getter. r=efaust
This commit is contained in:
parent
8468639a1a
commit
4b29243b9e
@ -5903,11 +5903,11 @@ UpdateExistingSetPropCallStubs(ICSetProp_Fallback* fallbackStub,
|
|||||||
return foundMatchingStub;
|
return foundMatchingStub;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Attach an optimized stub for a GETGNAME/CALLGNAME op.
|
// Attach an optimized stub for a GETGNAME/CALLGNAME slot-read op.
|
||||||
static bool
|
static bool
|
||||||
TryAttachGlobalNameStub(JSContext* cx, HandleScript script, jsbytecode* pc,
|
TryAttachGlobalNameValueStub(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||||
ICGetName_Fallback* stub, Handle<GlobalObject*> global,
|
ICGetName_Fallback* stub, Handle<GlobalObject*> global,
|
||||||
HandlePropertyName name, bool* attached, bool* isTemporarilyUnoptimizable)
|
HandlePropertyName name, bool* attached)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(global->is<GlobalObject>());
|
MOZ_ASSERT(global->is<GlobalObject>());
|
||||||
MOZ_ASSERT(!*attached);
|
MOZ_ASSERT(!*attached);
|
||||||
@ -5962,8 +5962,37 @@ TryAttachGlobalNameStub(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||||||
|
|
||||||
stub->addNewStub(newStub);
|
stub->addNewStub(newStub);
|
||||||
*attached = true;
|
*attached = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Attach an optimized stub for a GETGNAME/CALLGNAME getter op.
|
||||||
|
static bool
|
||||||
|
TryAttachGlobalNameAccessorStub(JSContext* cx, HandleScript script, jsbytecode* pc,
|
||||||
|
ICGetName_Fallback* stub, Handle<GlobalObject*> global,
|
||||||
|
HandlePropertyName name, bool* attached,
|
||||||
|
bool* isTemporarilyUnoptimizable)
|
||||||
|
{
|
||||||
|
MOZ_ASSERT(global->is<GlobalObject>());
|
||||||
|
|
||||||
|
RootedId id(cx, NameToId(name));
|
||||||
|
|
||||||
|
// The property must be found, and it must be found as a normal data property.
|
||||||
|
RootedShape shape(cx);
|
||||||
|
RootedNativeObject current(cx, global);
|
||||||
|
while (true) {
|
||||||
|
shape = current->lookup(cx, id);
|
||||||
|
if (shape)
|
||||||
|
break;
|
||||||
|
JSObject* proto = current->getProto();
|
||||||
|
if (!proto || !proto->is<NativeObject>())
|
||||||
|
return true;
|
||||||
|
current = &proto->as<NativeObject>();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Instantiate this global property, for use during Ion compilation.
|
||||||
|
if (IsIonEnabled(cx))
|
||||||
|
EnsureTrackPropertyTypes(cx, current, id);
|
||||||
|
|
||||||
// Try to add a getter stub. We don't handle scripted getters yet; if this
|
// Try to add a getter stub. We don't handle scripted getters yet; if this
|
||||||
// changes we need to make sure IonBuilder::getPropTryCommonGetter (which
|
// changes we need to make sure IonBuilder::getPropTryCommonGetter (which
|
||||||
@ -5993,9 +6022,7 @@ TryAttachGlobalNameStub(JSContext* cx, HandleScript script, jsbytecode* pc,
|
|||||||
|
|
||||||
stub->addNewStub(newStub);
|
stub->addNewStub(newStub);
|
||||||
*attached = true;
|
*attached = true;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6112,6 +6139,22 @@ DoGetNameFallback(JSContext* cx, BaselineFrame* frame, ICGetName_Fallback* stub_
|
|||||||
MOZ_ASSERT(op == JSOP_GETNAME || op == JSOP_GETGNAME);
|
MOZ_ASSERT(op == JSOP_GETNAME || op == JSOP_GETGNAME);
|
||||||
|
|
||||||
RootedPropertyName name(cx, script->getName(pc));
|
RootedPropertyName name(cx, script->getName(pc));
|
||||||
|
bool attached = false;
|
||||||
|
bool isTemporarilyUnoptimizable = false;
|
||||||
|
|
||||||
|
// Attach new stub.
|
||||||
|
if (stub->numOptimizedStubs() >= ICGetName_Fallback::MAX_OPTIMIZED_STUBS) {
|
||||||
|
// TODO: Discard all stubs in this IC and replace with generic stub.
|
||||||
|
attached = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!attached && IsGlobalOp(JSOp(*pc)) && !script->hasPollutedGlobalScope()) {
|
||||||
|
if (!TryAttachGlobalNameAccessorStub(cx, script, pc, stub, scopeChain.as<GlobalObject>(),
|
||||||
|
name, &attached, &isTemporarilyUnoptimizable))
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static_assert(JSOP_GETGNAME_LENGTH == JSOP_GETNAME_LENGTH,
|
static_assert(JSOP_GETGNAME_LENGTH == JSOP_GETNAME_LENGTH,
|
||||||
"Otherwise our check for JSOP_TYPEOF isn't ok");
|
"Otherwise our check for JSOP_TYPEOF isn't ok");
|
||||||
@ -6132,22 +6175,13 @@ DoGetNameFallback(JSContext* cx, BaselineFrame* frame, ICGetName_Fallback* stub_
|
|||||||
// Add a type monitor stub for the resulting value.
|
// Add a type monitor stub for the resulting value.
|
||||||
if (!stub->addMonitorStubForValue(cx, script, res))
|
if (!stub->addMonitorStubForValue(cx, script, res))
|
||||||
return false;
|
return false;
|
||||||
|
if (attached)
|
||||||
// Attach new stub.
|
|
||||||
if (stub->numOptimizedStubs() >= ICGetName_Fallback::MAX_OPTIMIZED_STUBS) {
|
|
||||||
// TODO: Discard all stubs in this IC and replace with generic stub.
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
bool attached = false;
|
|
||||||
bool isTemporarilyUnoptimizable = false;
|
|
||||||
if (IsGlobalOp(JSOp(*pc)) && !script->hasPollutedGlobalScope()) {
|
if (IsGlobalOp(JSOp(*pc)) && !script->hasPollutedGlobalScope()) {
|
||||||
Handle<GlobalObject*> global = scopeChain.as<GlobalObject>();
|
Handle<GlobalObject*> global = scopeChain.as<GlobalObject>();
|
||||||
if (!TryAttachGlobalNameStub(cx, script, pc, stub, global, name, &attached,
|
if (!TryAttachGlobalNameValueStub(cx, script, pc, stub, global, name, &attached))
|
||||||
&isTemporarilyUnoptimizable))
|
|
||||||
{
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (!TryAttachScopeNameStub(cx, script, stub, scopeChain, name, &attached))
|
if (!TryAttachScopeNameStub(cx, script, stub, scopeChain, name, &attached))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user