bool GetPropIRGenerator::tryAttachObjectLength(CacheIRWriter& writer, HandleObject obj, ObjOperandId objId) { MOZ_ASSERT(!emitted_); if (name_ != cx_->names().length) return true; if (obj->is<ArrayObject>()) { // Make sure int32 is added to the TypeSet before we attach a stub, so // the stub can return int32 values without monitoring the result. if (obj->as<ArrayObject>().length() > INT32_MAX) return true; writer.guardClass(objId, GuardClassKind::Array); writer.loadInt32ArrayLengthResult(objId); emitted_ = true; return true; } if (obj->is<UnboxedArrayObject>()) { writer.guardClass(objId, GuardClassKind::UnboxedArray); writer.loadUnboxedArrayLengthResult(objId); emitted_ = true; return true; } if (obj->is<ArgumentsObject>() && !obj->as<ArgumentsObject>().hasOverriddenLength()) { if (obj->is<MappedArgumentsObject>()) { writer.guardClass(objId, GuardClassKind::MappedArguments); } else { MOZ_ASSERT(obj->is<UnmappedArgumentsObject>()); writer.guardClass(objId, GuardClassKind::UnmappedArguments); } writer.loadArgumentsObjectLengthResult(objId); emitted_ = true; return true; } return true; }