Bug 927763 - Track all property types for singleton scope objects when Ion compiling scripts using them, r=jandem.

This commit is contained in:
Brian Hackett 2013-10-28 09:12:56 -06:00
Родитель 2a3d94e413
Коммит 2f4d6ffd15
2 изменённых файлов: 33 добавлений и 4 удалений

Просмотреть файл

@ -5374,10 +5374,6 @@ TryAttachScopeNameStub(JSContext *cx, HandleScript script, ICGetName_Fallback *s
if (!IsCacheableGetPropReadSlot(scopeChain, scopeChain, shape))
return true;
// Instantiate properties on singleton scope chain objects, for use during Ion compilation.
if (scopeChain->hasSingletonType() && IsIonEnabled(cx))
types::EnsureTrackPropertyTypes(cx, scopeChain, NameToId(name));
bool isFixedSlot;
uint32_t offset;
GetFixedOrDynamicSlotOffset(scopeChain, shape->slot(), &isFixedSlot, &offset);

Просмотреть файл

@ -1553,6 +1553,37 @@ OffThreadCompilationAvailable(JSContext *cx)
&& !cx->runtime()->spsProfiler.enabled();
}
static void
TrackAllProperties(JSContext *cx, JSObject *obj)
{
JS_ASSERT(obj->hasSingletonType());
for (Shape::Range<NoGC> range(obj->lastProperty()); !range.empty(); range.popFront())
types::EnsureTrackPropertyTypes(cx, obj, range.front().propid());
}
static void
TrackPropertiesForSingletonScopes(JSContext *cx, JSScript *script, BaselineFrame *baselineFrame)
{
// Ensure that all properties of singleton call objects which the script
// could access are tracked. These are generally accessed through
// ALIASEDVAR operations in baseline and will not be tracked even if they
// have been accessed in baseline code.
JSObject *environment = script->function() ? script->function()->environment() : NULL;
while (environment && !environment->is<GlobalObject>()) {
if (environment->is<CallObject>() && environment->hasSingletonType())
TrackAllProperties(cx, environment);
environment = environment->enclosingScope();
}
if (baselineFrame) {
JSObject *scope = baselineFrame->scopeChain();
if (scope->is<CallObject>() && scope->hasSingletonType())
TrackAllProperties(cx, scope);
}
}
static AbortReason
IonCompile(JSContext *cx, JSScript *script,
BaselineFrame *baselineFrame, jsbytecode *osrPc, bool constructing,
@ -1565,6 +1596,8 @@ IonCompile(JSContext *cx, JSScript *script,
script);
#endif
TrackPropertiesForSingletonScopes(cx, script, baselineFrame);
LifoAlloc *alloc = cx->new_<LifoAlloc>(BUILDER_LIFO_ALLOC_PRIMARY_CHUNK_SIZE);
if (!alloc)
return AbortReason_Alloc;