bool DynamicObject::DeoptimizeObjectHeaderInlining() { if(!IsObjectHeaderInlinedTypeHandler()) { return false; } if (PHASE_TRACE1(Js::ObjectHeaderInliningPhase)) { Output::Print(_u("ObjectHeaderInlining: De-optimizing the object.\n")); Output::Flush(); } PathTypeHandlerBase *const oldTypeHandler = PathTypeHandlerBase::FromTypeHandler(GetTypeHandler()); SimplePathTypeHandler *const newTypeHandler = oldTypeHandler->DeoptimizeObjectHeaderInlining(GetLibrary()); const PropertyIndex newInlineSlotCapacity = newTypeHandler->GetInlineSlotCapacity(); DynamicTypeHandler::AdjustSlots( this, newInlineSlotCapacity, newTypeHandler->GetSlotCapacity() - newInlineSlotCapacity); DynamicType *const newType = DuplicateType(); newType->typeHandler = newTypeHandler; newType->ShareType(); type = newType; return true; }
DynamicTypeHandler::DynamicTypeHandler(int slotCapacity, uint16 inlineSlotCapacity, uint16 offsetOfInlineSlots, BYTE flags) : flags(flags), propertyTypes(PropertyTypesWritableDataOnly | PropertyTypesReserved), offsetOfInlineSlots(offsetOfInlineSlots), unusedBytes(Js::AtomTag) { Assert(!GetIsOrMayBecomeShared() || GetIsLocked()); Assert(offsetOfInlineSlots != 0 || inlineSlotCapacity == 0); Assert(!IsObjectHeaderInlined(offsetOfInlineSlots) || inlineSlotCapacity != 0); // Align the slot capacities and set the total slot capacity this->inlineSlotCapacity = inlineSlotCapacity = IsObjectHeaderInlined(offsetOfInlineSlots) ? RoundUpObjectHeaderInlinedInlineSlotCapacity(inlineSlotCapacity) : RoundUpInlineSlotCapacity(inlineSlotCapacity); this->slotCapacity = RoundUpSlotCapacity(slotCapacity, inlineSlotCapacity); this->isNotPathTypeHandlerOrHasUserDefinedCtor = true; Assert(IsObjectHeaderInlinedTypeHandler() == IsObjectHeaderInlined(offsetOfInlineSlots)); }