[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
barraclough at apple.com
barraclough at apple.com
Wed Jan 20 22:25:36 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit 070ba18c5198b445ba66164eb2ada7013bc9722c
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Jan 15 07:48:03 2010 +0000
https://bugs.webkit.org/show_bug.cgi?id=33705
UStringImpl::create() should use internal storage
Reviewed by Oliver Hunt.
When creating a UStringImpl copying of a UChar*, we can use an internal buffer,
by calling UStringImpl::tryCreateUninitialized().
Also, remove duplicate of copyChars from JSString, call UStringImpl's version.
Small (max 0.5%) progression on Sunspidey.
* runtime/JSString.cpp:
(JSC::JSString::resolveRope):
* runtime/UStringImpl.h:
(JSC::UStringImpl::create):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53323 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d4b6d5d..1ae2804 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,24 @@
2010-01-14 Gavin Barraclough <barraclough at apple.com>
+ Reviewed by Oliver Hunt.
+
+ https://bugs.webkit.org/show_bug.cgi?id=33705
+ UStringImpl::create() should use internal storage
+
+ When creating a UStringImpl copying of a UChar*, we can use an internal buffer,
+ by calling UStringImpl::tryCreateUninitialized().
+
+ Also, remove duplicate of copyChars from JSString, call UStringImpl's version.
+
+ Small (max 0.5%) progression on Sunspidey.
+
+ * runtime/JSString.cpp:
+ (JSC::JSString::resolveRope):
+ * runtime/UStringImpl.h:
+ (JSC::UStringImpl::create):
+
+2010-01-14 Gavin Barraclough <barraclough at apple.com>
+
Reviewed by Sam Weinig.
Make naming & behaviour of UString[Impl] methods more consistent.
diff --git a/JavaScriptCore/runtime/JSString.cpp b/JavaScriptCore/runtime/JSString.cpp
index d180339..5045fbf 100644
--- a/JavaScriptCore/runtime/JSString.cpp
+++ b/JavaScriptCore/runtime/JSString.cpp
@@ -66,20 +66,6 @@ JSString::Rope::~Rope()
destructNonRecursive();
}
-#define ROPE_COPY_CHARS_INLINE_CUTOFF 20
-
-static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
-{
-#ifdef ROPE_COPY_CHARS_INLINE_CUTOFF
- if (numCharacters <= ROPE_COPY_CHARS_INLINE_CUTOFF) {
- for (unsigned i = 0; i < numCharacters; ++i)
- destination[i] = source[i];
- return;
- }
-#endif
- memcpy(destination, source, numCharacters * sizeof(UChar));
-}
-
// Overview: this methods converts a JSString from holding a string in rope form
// down to a simple UString representation. It does so by building up the string
// backwards, since we want to avoid recursion, we expect that the tree structure
@@ -128,7 +114,7 @@ void JSString::resolveRope(ExecState* exec) const
UString::Rep* string = currentFiber.string();
unsigned length = string->size();
position -= length;
- copyChars(position, string->data(), length);
+ UStringImpl::copyChars(position, string->data(), length);
// Was this the last item in the work queue?
if (workQueue.isEmpty()) {
diff --git a/JavaScriptCore/runtime/UStringImpl.h b/JavaScriptCore/runtime/UStringImpl.h
index 15e56a8..abed637 100644
--- a/JavaScriptCore/runtime/UStringImpl.h
+++ b/JavaScriptCore/runtime/UStringImpl.h
@@ -95,10 +95,11 @@ public:
static PassRefPtr<UStringImpl> create(const UChar* buffer, int length)
{
UChar* newBuffer;
- if (!UStringImpl::allocChars(length).getValue(newBuffer))
- return &null();
- copyChars(newBuffer, buffer, length);
- return adoptRef(new UStringImpl(newBuffer, length, BufferOwned));
+ if (PassRefPtr<UStringImpl> impl = tryCreateUninitialized(length, newBuffer)) {
+ copyChars(newBuffer, buffer, length);
+ return impl;
+ }
+ return &null();
}
static PassRefPtr<UStringImpl> create(PassRefPtr<UStringImpl> rep, int offset, int length)
@@ -166,14 +167,6 @@ public:
UStringImpl* ref() { m_refCount += s_refCountIncrement; return this; }
ALWAYS_INLINE void deref() { if (!(m_refCount -= s_refCountIncrement)) delete this; }
- static WTF::PossiblyNull<UChar*> allocChars(size_t length)
- {
- ASSERT(length);
- if (length > std::numeric_limits<size_t>::max() / sizeof(UChar))
- return 0;
- return tryFastMalloc(sizeof(UChar) * length);
- }
-
static void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
{
if (numCharacters <= s_copyCharsInlineCutOff) {
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list