зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 71190bec18a7 (bug 817058) for build bustage.
This commit is contained in:
Родитель
fbc4c4e6af
Коммит
7f7d7b43ab
|
@ -160,12 +160,6 @@ ifneq (,$(INTEL_ARCHITECTURE))
|
|||
CPPSRCS += nsTextFragmentSSE2.cpp
|
||||
endif
|
||||
|
||||
ifeq (ppc,$(CPU_ARCH))
|
||||
ifdef GNU_CC
|
||||
CPPSRCS += nsTextFragmentAltiVec.cpp
|
||||
endif
|
||||
endif
|
||||
|
||||
GQI_SRCS = contentbase.gqi
|
||||
|
||||
# we don't want the shared lib, but we want to force the creation of a
|
||||
|
@ -229,10 +223,3 @@ ifdef SOLARIS_SUNPRO_CXX
|
|||
nsTextFragmentSSE2.$(OBJ_SUFFIX): CXXFLAGS+=-xarch=sse2 -xO4
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq (ppc,$(CPU_ARCH))
|
||||
ifdef GNU_CC
|
||||
nsTextFragmentAltiVec.$(OBJ_SUFFIX): CXXFLAGS+=-maltivec
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
#include "nsUnicharUtils.h"
|
||||
#include "nsUTF8Utils.h"
|
||||
#include "mozilla/SSE.h"
|
||||
#include "mozilla/AltiVec.h"
|
||||
#include "nsTextFragmentImpl.h"
|
||||
#include <algorithm>
|
||||
|
||||
|
@ -159,13 +158,6 @@ namespace mozilla {
|
|||
}
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZILLA_MAY_SUPPORT_ALTIVEC
|
||||
namespace mozilla {
|
||||
namespace altivec {
|
||||
PRInt32 FirstNon8Bit(const PRUnichar* str, const PRUnichar* end);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* This function returns -1 if all characters in str are 8 bit characters.
|
||||
|
@ -182,11 +174,6 @@ FirstNon8Bit(const PRUnichar *str, const PRUnichar *end)
|
|||
return mozilla::SSE2::FirstNon8Bit(str, end);
|
||||
}
|
||||
#endif
|
||||
#ifdef MOZILLA_MAY_SUPPORT_ALTIVEC
|
||||
if (mozilla::supports_altivec()) {
|
||||
return mozilla::altivec::FirstNon8Bit(str, end);
|
||||
}
|
||||
#endif
|
||||
|
||||
return FirstNon8BitUnvectorized(str, end);
|
||||
}
|
||||
|
|
|
@ -1,97 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsAlgorithm.h"
|
||||
#include "nsTextFragmentImpl.h"
|
||||
#include <altivec.h>
|
||||
|
||||
namespace mozilla {
|
||||
namespace altivec {
|
||||
|
||||
int32_t
|
||||
FirstNon8Bit(const PRUnichar* str, const PRUnichar* end)
|
||||
{
|
||||
const uint32_t numUnicharsPerVector = 8;
|
||||
const uint32_t numCharsPerVector = 16;
|
||||
|
||||
typedef Non8BitParameters<sizeof(size_t)> p;
|
||||
const uint32_t alignMask = p::alignMask();
|
||||
const size_t mask = p::mask();
|
||||
const uint32_t numUnicharsPerWord = p::numUnicharsPerWord();
|
||||
|
||||
const uint32_t len = end - str;
|
||||
uint32_t i = 0;
|
||||
|
||||
// Align ourselves to a 16-byte boundary, as required by AltiVec loads.
|
||||
uint32_t alignLen =
|
||||
NS_MIN(len,
|
||||
uint32_t(((-NS_PTR_TO_UINT32(str)) & 0xf) / sizeof(PRUnichar)));
|
||||
|
||||
if ((len - alignLen) >= numUnicharsPerVector) {
|
||||
for (; i < alignLen; i++) {
|
||||
if (str[i] > 255)
|
||||
return i;
|
||||
}
|
||||
|
||||
register const vector unsigned short gtcompare =
|
||||
reinterpret_cast<vector unsigned short>(vec_mergel(vec_splat_s8(0),
|
||||
vec_splat_s8(-1)));
|
||||
// Check one AltiVec register (16 bytes) at a time.
|
||||
// This is simpler on AltiVec and involves no mucking about with masks,
|
||||
// since the vec_any_gt intrinsic does exactly what we want.
|
||||
const uint32_t vectWalkEnd = ((len - i) / numUnicharsPerVector)
|
||||
* numUnicharsPerVector;
|
||||
// We use this a lot, so let's calculate it now.
|
||||
const uint32_t vectFactor = (numCharsPerVector/numUnicharsPerVector);
|
||||
uint32_t i2 = i * vectFactor;
|
||||
while (1) {
|
||||
register vector unsigned short vect;
|
||||
|
||||
// This loop is manually unrolled because
|
||||
// that way performance is significantly improved
|
||||
#define CheckForASCII \
|
||||
vect = vec_ld(i2, reinterpret_cast<const unsigned short*>(str)); \
|
||||
if (vec_any_gt(vect, gtcompare)) \
|
||||
return (i2 / vectFactor); \
|
||||
i2 += numCharsPerVector; \
|
||||
if (!(i2 < vectWalkEnd)) \
|
||||
break;
|
||||
|
||||
CheckForASCII
|
||||
CheckForASCII
|
||||
}
|
||||
i = i2 / vectFactor;
|
||||
} else {
|
||||
// Align ourselves to a word boundary.
|
||||
alignLen =
|
||||
NS_MIN(len, uint32_t(((-NS_PTR_TO_UINT32(str)) & alignMask)
|
||||
/ sizeof(PRUnichar)));
|
||||
for (; i < alignLen; i++) {
|
||||
if (str[i] > 255)
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
// Check one word at a time.
|
||||
const uint32_t wordWalkEnd = ((len - i) / numUnicharsPerWord)
|
||||
* numUnicharsPerWord;
|
||||
for(; i < wordWalkEnd; i += numUnicharsPerWord) {
|
||||
const size_t word = *reinterpret_cast<const size_t*>(str + i);
|
||||
if (word & mask)
|
||||
return i;
|
||||
}
|
||||
|
||||
// Take care of the remainder one character at a time.
|
||||
for (; i < len; i++) {
|
||||
if (str[i] > 255) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
} // namespace altivec
|
||||
} // namespace mozilla
|
Загрузка…
Ссылка в новой задаче