Permalink
Browse files

Webkit Sources Changes for BlackBerry - Bundle 695

  • Loading branch information...
1 parent f6253c0 commit 99677227ddfcb503051763360422598296d51f97 @sdevitt sdevitt committed Jul 8, 2011
Showing 2,053 changed files with 334,972 additions and 314,387 deletions.
@@ -106,7 +106,12 @@ def find_match(start_in_old, end_in_old, start_in_new, end_in_new)
best_match_size = 0
match_length_at = Hash.new { |h, index| h[index] = 0 }
-
+
+ # Tests with large amounts of diffs take too long to process.
+ if end_in_old > 10000 or end_in_new > 10000
+ puts "WARNING: pretty diff not executed due to a large amount of comparison indexes: [#{end_in_old}] <> [#{end_in_new}]"
+ return nil
+ end
start_in_old.upto(end_in_old - 1) do |index_in_old|
new_match_length_at = Hash.new { |h, index| h[index] = 0 }
@@ -213,6 +213,12 @@ JSValueRef JSValueMakeNumber(JSContextRef ctx, double value)
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
+ // Our JSValue representation relies on a standard bit pattern for NaN. NaNs
+ // generated internally to JavaScriptCore naturally have that representation,
+ // but an external NaN might not.
+ if (isnan(value))
+ value = NaN;
+
return toRef(exec, jsNumber(exec, value));
}
@@ -108,7 +108,7 @@ defineTest(addJavaScriptCoreLib) {
}
OLYMPIA_PTHREAD = $$(FEATURE_OLYMPIA_PTHREAD)
-!isEmpty(OLYMPIA_PTHREAD) {
+isEmpty(OLYMPIA_PTHREAD) {
DEFINES += ENABLE_JSC_MULTIPLE_THREADS=0
DEFINES += WTF_USE_PTHREADS=1
} else {
@@ -237,8 +237,7 @@ SOURCES += \
yarr/RegexJIT.cpp
-OLYMPIA_PTHREAD = $$(FEATURE_OLYMPIA_PTHREAD)
-!isEmpty(OLYMPIA_PTHREAD) {
+isEmpty(OLYMPIA_PTHREAD) {
SOURCES += wtf/ThreadingPthreads.cpp \
wtf/ThreadIdentifierDataPthreads.cpp
HEADERS += wtf/ThreadIdentifierDataPthreads.h
@@ -273,6 +273,7 @@ void JSGlobalData::resetDateCache()
cachedUTCOffset = NaN;
dstOffsetCache.reset();
cachedDateString = UString();
+ cachedDateStringValue = NaN;
dateInstanceCache.reset();
}
@@ -51,6 +51,7 @@ inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern)
, m_flagBits(0)
, m_constructionError(0)
, m_numSubpatterns(0)
+ , m_lastMatchStart(-1)
{
compile(globalData);
}
@@ -60,6 +61,7 @@ inline RegExp::RegExp(JSGlobalData* globalData, const UString& pattern, const US
, m_flagBits(0)
, m_constructionError(0)
, m_numSubpatterns(0)
+ , m_lastMatchStart(-1)
{
// NOTE: The global flag is handled on a case-by-case basis by functions like
// String::match and RegExpObject::match.
@@ -109,8 +111,24 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
if (ovector)
ovector->resize(0);
- if (static_cast<unsigned>(startOffset) > s.size() || s.isNull())
+ if (static_cast<unsigned>(startOffset) > s.size() || s.isNull()) {
+ m_lastMatchString = UString();
+ m_lastMatchStart = -1;
+ m_lastOVector.shrink(0);
return -1;
+ }
+
+ // Perform check to see if this match call is the same as the last match invocation
+ // and if it is return the prior result.
+ if ((startOffset == m_lastMatchStart) && (s.rep() == m_lastMatchString.rep())) {
+ if (ovector)
+ *ovector = m_lastOVector;
+
+ if (m_lastOVector.isEmpty())
+ return -1;
+
+ return m_lastOVector.at(0);
+ }
#if ENABLE(YARR_JIT)
if (!!m_regExpJITCode) {
@@ -147,9 +165,22 @@ int RegExp::match(const UString& s, int startOffset, Vector<int, 32>* ovector)
if (ovector)
ovector->clear();
}
+
+ m_lastMatchString = s;
+ m_lastMatchStart = startOffset;
+
+ if (ovector)
+ m_lastOVector = *ovector;
+ else
+ m_lastOVector = nonReturnedOvector;
+
return result;
}
+ m_lastMatchString = UString();
+ m_lastMatchStart = -1;
+ m_lastOVector.shrink(0);
+
return -1;
}
@@ -67,6 +67,9 @@ namespace JSC {
int m_flagBits;
const char* m_constructionError;
unsigned m_numSubpatterns;
+ UString m_lastMatchString;
+ int m_lastMatchStart;
+ Vector<int, 32> m_lastOVector;
#if ENABLE(YARR_JIT)
Yarr::RegexCodeBlock m_regExpJITCode;
@@ -158,21 +158,43 @@ namespace JSC {
ALWAYS_INLINE bool operator==(const UString& s1, const UString& s2)
{
- unsigned size = s1.size();
- switch (size) {
- case 0:
- return !s2.size();
+ UString::Rep* rep1 = s1.rep();
+ UString::Rep* rep2 = s2.rep();
+ unsigned size1 = 0;
+ unsigned size2 = 0;
+
+ if (rep1 == rep2) // If they're the same rep, they're equal.
+ return true;
+
+ if (rep1)
+ size1 = rep1->length();
+
+ if (rep2)
+ size2 = rep2->length();
+
+ if (size1 != size2) // If the lengths are not the same, we're done.
+ return false;
+
+ if (!size1)
+ return true;
+
+ // At this point we know
+ // (a) that the strings are the same length and
+ // (b) that they are greater than zero length.
+ const UChar* d1 = rep1->characters();
+ const UChar* d2 = rep2->characters();
+
+ if (d1 == d2) // Check to see if the data pointers are the same.
+ return true;
+
+ // Do quick checks for sizes 1 and 2.
+ switch (size1) {
case 1:
- return s2.size() == 1 && s1.data()[0] == s2.data()[0];
- case 2: {
- if (s2.size() != 2)
- return false;
- const UChar* d1 = s1.data();
- const UChar* d2 = s2.data();
+ return d1[0] == d2[0];
+ case 2:
return (d1[0] == d2[0]) & (d1[1] == d2[1]);
- }
default:
- return s2.size() == size && memcmp(s1.data(), s2.data(), size * sizeof(UChar)) == 0;
+ return memcmp(d1, d2, size1 * sizeof(UChar)) == 0;
}
}
@@ -947,7 +947,7 @@
|| CPU(ALPHA) \
|| CPU(SPARC64)
#define WTF_USE_JSVALUE64 1
-#elif CPU(ARM) || CPU(PPC64) || CPU(MIPS)
+#elif (CPU(ARM) && !OS(OLYMPIA)) || CPU(PPC64) || CPU(MIPS)
#define WTF_USE_JSVALUE32 1
#elif OS(WINDOWS) && COMPILER(MINGW)
/* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
@@ -33,10 +33,9 @@
#include <strings.h>
#endif
-#if COMPILER(MSVC)
+#if COMPILER(MSVC) && !PLATFORM(OLYMPIA)
// FIXME: why a COMPILER check instead of OS? also, these should be HAVE checks
-#if !PLATFORM(OLYMPIA)
inline int snprintf(char* buffer, size_t count, const char* format, ...)
{
int result;
@@ -46,7 +45,6 @@ inline int snprintf(char* buffer, size_t count, const char* format, ...)
va_end(args);
return result;
}
-#endif
#if COMPILER(MSVC7_OR_LOWER) || OS(WINCE)
@@ -168,6 +168,7 @@
#endif
#define INFNAN_CHECK
+#define No_Hex_NaN
#if defined(IEEE_8087) + defined(IEEE_MC68k) + defined(IEEE_ARM) != 1
Exactly one of IEEE_8087, IEEE_ARM or IEEE_MC68k should be defined.
Oops, something went wrong.

0 comments on commit 9967722

Please sign in to comment.