Skip to content

Commit

Permalink
Bug 1148916 - Remove MaybeSingletonObject NewObjectKind, r=terrence.
Browse files Browse the repository at this point in the history
  • Loading branch information
bhackett1024 committed Apr 7, 2015
1 parent 6e34197 commit 662dbd9
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 23 deletions.
4 changes: 2 additions & 2 deletions js/src/builtin/TypedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1485,7 +1485,7 @@ OutlineTypedObject::createUnattachedWithClass(JSContext* cx,
if (!group)
return nullptr;

NewObjectKind newKind = (heap == gc::TenuredHeap) ? MaybeSingletonObject : GenericObject;
NewObjectKind newKind = (heap == gc::TenuredHeap) ? TenuredObject : GenericObject;
OutlineTypedObject* obj = NewObjectWithGroup<OutlineTypedObject>(cx, group,
gc::AllocKind::OBJECT0,
newKind);
Expand Down Expand Up @@ -2119,7 +2119,7 @@ InlineTypedObject::create(JSContext* cx, HandleTypeDescr descr, gc::InitialHeap
if (!group)
return nullptr;

NewObjectKind newKind = (heap == gc::TenuredHeap) ? MaybeSingletonObject : GenericObject;
NewObjectKind newKind = (heap == gc::TenuredHeap) ? TenuredObject : GenericObject;
return NewObjectWithGroup<InlineTypedObject>(cx, group, allocKind, newKind);
}

Expand Down
2 changes: 1 addition & 1 deletion js/src/frontend/Parser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1232,7 +1232,7 @@ Parser<ParseHandler>::newFunction(HandleAtom atom, FunctionSyntaxKind kind, Hand
if (kind == Arrow)
allocKind = JSFunction::ExtendedFinalizeKind;
fun = NewFunctionWithProto(context, nullptr, 0, flags, NullPtr(), atom, proto,
allocKind, MaybeSingletonObject);
allocKind, TenuredObject);
if (!fun)
return nullptr;
if (options().selfHostingMode)
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/BaselineCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1377,7 +1377,7 @@ BaselineCompiler::emit_JSOP_OBJECT()

prepareVMCall();

pushArg(ImmWord(js::MaybeSingletonObject));
pushArg(ImmWord(TenuredObject));
pushArg(ImmGCPtr(obj));

if (!callVM(DeepCloneObjectLiteralInfo))
Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/BaselineIC.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9661,7 +9661,7 @@ TryAttachCallStub(JSContext* cx, ICCall_Fallback* stub, HandleScript script, jsb
}
}

JSObject* thisObject = CreateThisForFunction(cx, fun, MaybeSingletonObject);
JSObject* thisObject = CreateThisForFunction(cx, fun, TenuredObject);
if (!thisObject)
return false;

Expand Down
2 changes: 1 addition & 1 deletion js/src/jit/CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1950,7 +1950,7 @@ static const VMFunction DeepCloneObjectLiteralInfo =
void
CodeGenerator::visitCloneLiteral(LCloneLiteral* lir)
{
pushArg(ImmWord(js::MaybeSingletonObject));
pushArg(ImmWord(TenuredObject));
pushArg(ToRegister(lir->getObjectLiteral()));
callVM(DeepCloneObjectLiteralInfo, lir);
}
Expand Down
8 changes: 3 additions & 5 deletions js/src/jsobj.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1347,7 +1347,7 @@ CreateThisForFunctionWithGroup(JSContext* cx, HandleObjectGroup group,
// The initial objects registered with a TypeNewScript can't be in the
// nursery.
if (newKind == GenericObject)
newKind = MaybeSingletonObject;
newKind = TenuredObject;

// Not enough objects with this group have been created yet, so make a
// plain object and register it with the group. Use the maximum number
Expand Down Expand Up @@ -1965,8 +1965,7 @@ js::CloneObjectLiteral(JSContext* cx, HandleObject srcObj)
if (!group)
return nullptr;

RootedPlainObject res(cx, NewObjectWithGroup<PlainObject>(cx, group, kind,
MaybeSingletonObject));
RootedPlainObject res(cx, NewObjectWithGroup<PlainObject>(cx, group, kind, TenuredObject));
if (!res)
return nullptr;

Expand All @@ -1985,8 +1984,7 @@ js::CloneObjectLiteral(JSContext* cx, HandleObject srcObj)
MOZ_ASSERT(srcArray->getElementsHeader()->ownerObject() == srcObj);

size_t length = srcArray->as<ArrayObject>().length();
RootedArrayObject res(cx, NewDenseFullyAllocatedArray(cx, length, NullPtr(),
MaybeSingletonObject));
RootedArrayObject res(cx, NewDenseFullyAllocatedArray(cx, length, NullPtr(), TenuredObject));
if (!res)
return nullptr;

Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/Interpreter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3038,7 +3038,7 @@ CASE(JSOP_OBJECT)
RootedObject& ref = rootObject0;
ref = script->getObject(REGS.pc);
if (JS::CompartmentOptionsRef(cx).cloneSingletons()) {
JSObject* obj = DeepCloneObjectLiteral(cx, ref, js::MaybeSingletonObject);
JSObject* obj = DeepCloneObjectLiteral(cx, ref, TenuredObject);
if (!obj)
goto error;
PUSH_OBJECT(*obj);
Expand Down
9 changes: 1 addition & 8 deletions js/src/vm/ObjectGroup.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,17 +140,10 @@ enum NewObjectKind {
/*
* Singleton objects are treated specially by the type system. This flag
* ensures that the new object is automatically set up correctly as a
* singleton and is allocated in the correct heap.
* singleton and is allocated in the tenured heap.
*/
SingletonObject,

/*
* Objects which may be marked as a singleton after allocation must still
* be allocated on the correct heap, but are not automatically setup as a
* singleton after allocation.
*/
MaybeSingletonObject,

/*
* Objects which will not benefit from being allocated in the nursery
* (e.g. because they are known to have a long lifetime) may be allocated
Expand Down
3 changes: 1 addition & 2 deletions js/src/vm/TypeInference.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3647,8 +3647,7 @@ TypeNewScript::maybeAnalyze(JSContext* cx, ObjectGroup* group, bool* regenerate,
}

RootedObjectGroup groupRoot(cx, group);
templateObject_ = NewObjectWithGroup<PlainObject>(cx, groupRoot, kind,
MaybeSingletonObject);
templateObject_ = NewObjectWithGroup<PlainObject>(cx, groupRoot, kind, TenuredObject);
if (!templateObject_)
return false;

Expand Down
2 changes: 1 addition & 1 deletion js/src/vm/UnboxedObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ UnboxedLayout::makeNativeGroup(JSContext* cx, ObjectGroup* group)

PlainObject* templateObject = NewObjectWithGroup<PlainObject>(cx, replacementNewGroup,
layout.getAllocKind(),
MaybeSingletonObject);
TenuredObject);
if (!templateObject)
return false;

Expand Down

0 comments on commit 662dbd9

Please sign in to comment.