Exemple #1
0
ArrayData* MixedArray::EscalateForSort(ArrayData* ad, SortFunction sf) {
  auto a = asMixed(ad);
  // We can uncomment later if we want this feature.
  // if (a->m_size <= 1 && !isSortFamily(sf)) {
  //   return a;
  // }
  if (UNLIKELY(hasUserDefinedCmp(sf) || a->hasMultipleRefs())) {
    auto ret = a->copyMixed();
    assert(ret->hasExactlyOneRef());
    return ret;
  } else {
    return a;
  }
}
bool MixedArray::Uasort(ArrayData* ad, const Variant& cmp_function) {
  auto a = asMixed(ad);
  USER_SORT_BODY(ValAccessor, false);
}
void MixedArray::Asort(ArrayData* ad, int sort_flags, bool ascending) {
  auto a = asMixed(ad);
  SORT_BODY(ValAccessor, false);
}
ArrayData* MixedArray::EscalateForSort(ArrayData* ad) {
  // task #1910931 only do this for refCount() > 1
  return asMixed(ad)->copyMixed();
}
Exemple #5
0
bool HphpArray::Usort(ArrayData* ad, const Variant& cmp_function) {
    auto a = asMixed(ad);
    USER_SORT_BODY(ValAccessor, true);
}
Exemple #6
0
bool HphpArray::Uksort(ArrayData* ad, const Variant& cmp_function) {
    auto a = asMixed(ad);
    USER_SORT_BODY(KeyAccessor, false);
}
Exemple #7
0
void HphpArray::Sort(ArrayData* ad, int sort_flags, bool ascending) {
    auto a = asMixed(ad);
    SORT_BODY(ValAccessor, true);
}
Exemple #8
0
void HphpArray::Ksort(ArrayData* ad, int sort_flags, bool ascending) {
    auto a = asMixed(ad);
    SORT_BODY(KeyAccessor, false);
}
Exemple #9
0
bool MixedArray::Usort(ArrayData* ad, const Variant& cmp_function) {
  auto a = asMixed(ad);
  USER_SORT_BODY(AssocValAccessor<MixedArray::Elm>, true);
}
Exemple #10
0
void MixedArray::Asort(ArrayData* ad, int sort_flags, bool ascending) {
  auto a = asMixed(ad);
  auto data_begin = a->data();
  auto data_end = data_begin + a->m_size;
  SORT_BODY(AssocValAccessor<MixedArray::Elm>, false);
}
Exemple #11
0
bool MixedArray::WarnAndUsort(ArrayData* ad, const Variant& cmp_function) {
  assert(ad->kind() != kMixedKind);
  MixedArray::downgradeAndWarn(ad, Reason::kUsort);
  auto a = asMixed(ad);
  USER_SORT_BODY(ValAccessor, true);
}
Exemple #12
0
void MixedArray::WarnAndSort(ArrayData* ad, int sort_flags, bool ascending) {
  assert(ad->kind() != kMixedKind);
  MixedArray::downgradeAndWarn(ad, Reason::kSort);
  auto a = asMixed(ad);
  SORT_BODY(ValAccessor, true);
}