Bug 952285 - Clarify some code in TypeRepresentation for the hazard analysis; r=nmatsakis

--HG--
extra : rebase_source : dce9b8d79f645fd90e4049bf18e3056b25fd1740
This commit is contained in:
Terrence Cole 2013-12-19 16:55:40 -08:00
Родитель 0e064ae2dd
Коммит 4a498bde24
1 изменённых файлов: 20 добавлений и 8 удалений

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

@ -453,8 +453,11 @@ class TypeRepresentationHelper {
static JSObject *CreateSimple(JSContext *cx, typename T::Type type) {
JSCompartment *comp = cx->compartment();
T sample(type);
TypeRepresentationHash::AddPtr p = comp->typeReprs.lookupForAdd(&sample);
TypeRepresentationHash::AddPtr p;
{
T sample(type);
p = comp->typeReprs.lookupForAdd(&sample);
}
if (p)
return (*p)->ownerObject();
@ -492,8 +495,11 @@ ReferenceTypeRepresentation::Create(JSContext *cx,
{
JSCompartment *comp = cx->compartment();
ReferenceTypeRepresentation sample(type);
TypeRepresentationHash::AddPtr p = comp->typeReprs.lookupForAdd(&sample);
TypeRepresentationHash::AddPtr p;
{
ReferenceTypeRepresentation sample(type);
p = comp->typeReprs.lookupForAdd(&sample);
}
if (p)
return (*p)->ownerObject();
@ -526,8 +532,11 @@ SizedArrayTypeRepresentation::Create(JSContext *cx,
return nullptr;
}
SizedArrayTypeRepresentation sample(element, length);
TypeRepresentationHash::AddPtr p = comp->typeReprs.lookupForAdd(&sample);
TypeRepresentationHash::AddPtr p;
{
SizedArrayTypeRepresentation sample(element, length);
p = comp->typeReprs.lookupForAdd(&sample);
}
if (p)
return (*p)->ownerObject();
@ -550,8 +559,11 @@ UnsizedArrayTypeRepresentation::Create(JSContext *cx,
{
JSCompartment *comp = cx->compartment();
UnsizedArrayTypeRepresentation sample(element);
TypeRepresentationHash::AddPtr p = comp->typeReprs.lookupForAdd(&sample);
TypeRepresentationHash::AddPtr p;
{
UnsizedArrayTypeRepresentation sample(element);
p = comp->typeReprs.lookupForAdd(&sample);
}
if (p)
return (*p)->ownerObject();