[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
barraclough at apple.com
barraclough at apple.com
Wed Dec 22 14:35:16 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 0d9181a431881cd07cd0d3ac18d578bc7423aabc
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 13 19:29:14 2010 +0000
JavaScriptCore: Bug 43987 - Downloading using XHR is much slower than before
Change StringBuilder to use overcapacity in a StringImpl, rather than a Vector.
Fundamentally this should be the same (copies current contents to expand capacity,
rather than using a rope), but this approach allows the intermadiate state of the
String to be inspected in the buffer without copying to resolve.
Reviewed by Oliver Hunt.
* runtime/JSONObject.cpp:
(JSC::Stringifier::appendQuotedString):
(JSC::Stringifier::Holder::appendNextProperty):
Renamed StringBuilder::size() -> length() (to match other String types).
* runtime/UStringBuilder.h:
(JSC::UStringBuilder::append):
(JSC::UStringBuilder::toUString):
Update for changes in parent class, can just 'using' the append methods.
* wtf/text/StringBuilder.cpp: Added.
(WTF::StringBuilder::reifyString):
(WTF::StringBuilder::resize):
(WTF::StringBuilder::reserveCapacity):
(WTF::StringBuilder::allocateBuffer):
(WTF::StringBuilder::appendUninitialized):
(WTF::StringBuilder::append):
(WTF::StringBuilder::shrinkToFit):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::StringBuilder):
(WTF::StringBuilder::append):
(WTF::StringBuilder::toString):
(WTF::StringBuilder::toStringPreserveCapacity):
(WTF::StringBuilder::length):
(WTF::StringBuilder::isEmpty):
(WTF::StringBuilder::operator[]):
(WTF::StringBuilder::clear):
Class updated to use overcapacity in a StringImpl, rather than a Vector.
* Android.mk:
* Android.v8.wtf.mk:
* GNUmakefile.am:
* JavaScriptCore.exp:
* JavaScriptCore.gypi:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
* JavaScriptCore.vcproj/WTF/WTF.vcproj:
* JavaScriptCore.vcproj/jsc/jsc.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/wtf.pri:
WebCore: Bug 43987 - Downloading using XHR is much slower than before
Reviewed by Oliver Hunt.
* svg/SVGPathStringBuilder.cpp:
(WebCore::SVGPathStringBuilder::result):
StringBuilder::size() -> StringBuilder::length().
WebKit/chromium: Bug 43987 - Downloading using XHR is much slower than before
Reviewed by Oliver Hunt.
* src/WebPageSerializerImpl.cpp:
(WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@69683 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/Android.mk b/JavaScriptCore/Android.mk
index 8dd53c1..932ebc0 100644
--- a/JavaScriptCore/Android.mk
+++ b/JavaScriptCore/Android.mk
@@ -177,6 +177,7 @@ LOCAL_SRC_FILES := \
\
wtf/text/AtomicString.cpp \
wtf/text/CString.cpp \
+ wtf/text/StringBuilder.cpp \
wtf/text/StringImpl.cpp \
wtf/text/WTFString.cpp \
\
diff --git a/JavaScriptCore/Android.v8.wtf.mk b/JavaScriptCore/Android.v8.wtf.mk
index 9249e47..cb5039b 100644
--- a/JavaScriptCore/Android.v8.wtf.mk
+++ b/JavaScriptCore/Android.v8.wtf.mk
@@ -54,6 +54,7 @@ LOCAL_SRC_FILES := \
\
wtf/text/AtomicString.cpp \
wtf/text/CString.cpp \
+ wtf/text/StringBuidler.cpp \
wtf/text/StringImpl.cpp \
wtf/text/WTFString.cpp \
\
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index d852518..e91ac83 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,54 @@
+2010-10-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43987 - Downloading using XHR is much slower than before
+ Change StringBuilder to use overcapacity in a StringImpl, rather than a Vector.
+ Fundamentally this should be the same (copies current contents to expand capacity,
+ rather than using a rope), but this approach allows the intermadiate state of the
+ String to be inspected in the buffer without copying to resolve.
+
+ * runtime/JSONObject.cpp:
+ (JSC::Stringifier::appendQuotedString):
+ (JSC::Stringifier::Holder::appendNextProperty):
+ Renamed StringBuilder::size() -> length() (to match other String types).
+
+ * runtime/UStringBuilder.h:
+ (JSC::UStringBuilder::append):
+ (JSC::UStringBuilder::toUString):
+ Update for changes in parent class, can just 'using' the append methods.
+
+ * wtf/text/StringBuilder.cpp: Added.
+ (WTF::StringBuilder::reifyString):
+ (WTF::StringBuilder::resize):
+ (WTF::StringBuilder::reserveCapacity):
+ (WTF::StringBuilder::allocateBuffer):
+ (WTF::StringBuilder::appendUninitialized):
+ (WTF::StringBuilder::append):
+ (WTF::StringBuilder::shrinkToFit):
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::StringBuilder):
+ (WTF::StringBuilder::append):
+ (WTF::StringBuilder::toString):
+ (WTF::StringBuilder::toStringPreserveCapacity):
+ (WTF::StringBuilder::length):
+ (WTF::StringBuilder::isEmpty):
+ (WTF::StringBuilder::operator[]):
+ (WTF::StringBuilder::clear):
+ Class updated to use overcapacity in a StringImpl, rather than a Vector.
+
+ * Android.mk:
+ * Android.v8.wtf.mk:
+ * GNUmakefile.am:
+ * JavaScriptCore.exp:
+ * JavaScriptCore.gypi:
+ * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops:
+ * JavaScriptCore.vcproj/WTF/WTF.vcproj:
+ * JavaScriptCore.vcproj/jsc/jsc.vcproj:
+ * JavaScriptCore.xcodeproj/project.pbxproj:
+ * wtf/CMakeLists.txt:
+ * wtf/wtf.pri:
+
2010-10-13 Adam Roben <aroben at apple.com>
Export tryFastRealloc for WebKit2's benefit
diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am
index 76a9bdf..0a31035 100644
--- a/JavaScriptCore/GNUmakefile.am
+++ b/JavaScriptCore/GNUmakefile.am
@@ -508,6 +508,7 @@ javascriptcore_sources += \
JavaScriptCore/wtf/text/CString.cpp \
JavaScriptCore/wtf/text/CString.h \
JavaScriptCore/wtf/text/StringBuffer.h \
+ JavaScriptCore/wtf/text/StringBuilder.cpp \
JavaScriptCore/wtf/text/StringBuilder.h \
JavaScriptCore/wtf/text/StringConcatenate.h \
JavaScriptCore/wtf/text/StringHash.h \
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 9ae5108..2dd66c1 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -132,6 +132,8 @@ __ZN3JSC12JSGlobalData14sharedInstanceEv
__ZN3JSC12JSGlobalData15dumpRegExpTraceEv
__ZN3JSC12JSGlobalData6createENS_15ThreadStackTypeE
__ZN3JSC12JSGlobalDataD1Ev
+__ZN3JSC12RegExpObject4infoE
+__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEENS4_INS_6RegExpEEE
__ZN3JSC12SamplingTool5setupEv
__ZN3JSC12SmallStrings17createEmptyStringEPNS_12JSGlobalDataE
__ZN3JSC12SmallStrings27createSingleCharacterStringEPNS_12JSGlobalDataEh
@@ -150,7 +152,6 @@ __ZN3JSC13SamplingFlags4stopEv
__ZN3JSC13SamplingFlags5startEv
__ZN3JSC13SamplingFlags7s_flagsE
__ZN3JSC13StatementNode6setLocEii
-__ZN3JSC14heapStatisticsEPNS_12JSGlobalDataE
__ZN3JSC14JSGlobalObject10globalExecEv
__ZN3JSC14JSGlobalObject12defineGetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
__ZN3JSC14JSGlobalObject12defineSetterEPNS_9ExecStateERKNS_10IdentifierEPNS_8JSObjectEj
@@ -165,6 +166,7 @@ __ZN3JSC14SamplingThread4stopEv
__ZN3JSC14SamplingThread5startEj
__ZN3JSC14TimeoutChecker10didTimeOutEPNS_9ExecStateE
__ZN3JSC14TimeoutChecker5resetEv
+__ZN3JSC14heapStatisticsEPNS_12JSGlobalDataE
__ZN3JSC14throwTypeErrorEPNS_9ExecStateE
__ZN3JSC15JSWrapperObject12markChildrenERNS_9MarkStackE
__ZN3JSC15createTypeErrorEPNS_9ExecStateERKNS_7UStringE
@@ -239,6 +241,8 @@ __ZN3JSC6JSLock4lockENS_14JSLockBehaviorE
__ZN3JSC6JSLock6unlockENS_14JSLockBehaviorE
__ZN3JSC6JSLock9lockCountEv
__ZN3JSC6JSLockC1EPNS_9ExecStateE
+__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringES5_
+__ZN3JSC6RegExpD1Ev
__ZN3JSC7JSArray12markChildrenERNS_9MarkStackE
__ZN3JSC7JSArray15setSubclassDataEPv
__ZN3JSC7JSArray18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
@@ -372,6 +376,11 @@ __ZN3WTF12createThreadEPFPvS0_ES0_PKc
__ZN3WTF12detachThreadEj
__ZN3WTF12isMainThreadEv
__ZN3WTF12randomNumberEv
+__ZN3WTF13StringBuilder11reifyStringEv
+__ZN3WTF13StringBuilder11shrinkToFitEv
+__ZN3WTF13StringBuilder6appendEPKcj
+__ZN3WTF13StringBuilder6appendEPKtj
+__ZN3WTF13StringBuilder6resizeEj
__ZN3WTF13WTFThreadData10staticDataE
__ZN3WTF13WTFThreadDataC1Ev
__ZN3WTF13WTFThreadDataD1Ev
@@ -484,8 +493,6 @@ __ZNK3JSC10JSFunction23isHostFunctionNonInlineEv
__ZNK3JSC11Interpreter14retrieveCallerEPNS_9ExecStateEPNS_10JSFunctionE
__ZNK3JSC11Interpreter18retrieveLastCallerEPNS_9ExecStateERiRlRNS_7UStringERNS_7JSValueE
__ZNK3JSC12PropertySlot14functionGetterEPNS_9ExecStateE
-__ZN3JSC12RegExpObject4infoE
-__ZN3JSC12RegExpObjectC1EPNS_14JSGlobalObjectEN3WTF17NonNullPassRefPtrINS_9StructureEEENS4_INS_6RegExpEEE
__ZNK3JSC14JSGlobalObject14isDynamicScopeERb
__ZNK3JSC16InternalFunction9classInfoEv
__ZNK3JSC16JSVariableObject16isVariableObjectEv
@@ -516,8 +523,6 @@ __ZNK3JSC6JSCell9getStringEPNS_9ExecStateE
__ZNK3JSC6JSCell9getStringEPNS_9ExecStateERNS_7UStringE
__ZNK3JSC6JSCell9getUInt32ERj
__ZNK3JSC6JSCell9toBooleanEPNS_9ExecStateE
-__ZN3JSC6RegExp6createEPNS_12JSGlobalDataERKNS_7UStringES5_
-__ZN3JSC6RegExpD1Ev
__ZNK3JSC7ArgList8getSliceEiRS0_
__ZNK3JSC7JSArray12subclassDataEv
__ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
diff --git a/JavaScriptCore/JavaScriptCore.gypi b/JavaScriptCore/JavaScriptCore.gypi
index 93b3392..00447b5 100644
--- a/JavaScriptCore/JavaScriptCore.gypi
+++ b/JavaScriptCore/JavaScriptCore.gypi
@@ -453,6 +453,7 @@
'wtf/text/CString.cpp',
'wtf/text/CString.h',
'wtf/text/StringBuffer.h',
+ 'wtf/text/StringBuilder.cpp',
'wtf/text/StringBuilder.h',
'wtf/text/StringConcatenate.h',
'wtf/text/StringHash.h',
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
index c92196e..a4749cf 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
+++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCoreCommon.vsprops
@@ -19,7 +19,7 @@
/>
<Tool
Name="VCPostBuildEventTool"
- CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\private\JavaScriptCore"

xcopy /y /d "$(ProjectDir)\..\..\wtf\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\unicode\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\parser\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\runtime\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\VM\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\bytecode\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\interpreter\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\assembler\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\jit\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\debugger\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\profiler\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\create_hash_table" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\pcre\pcre.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\AtomicString.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\StringImpl.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\WTFString.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"


mkdir 2>NUL "$(OutDir)\JavaScriptCore.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\include\private\JavaScriptCore"

xcopy /y /d "$(ProjectDir)\..\..\wtf\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\unicode\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\unicode\icu\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\parser\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\runtime\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\VM\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\bytecode\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\interpreter\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\assembler\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\jit\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\debugger\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\profiler\*.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\create_hash_table" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\pcre\pcre.h" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\AtomicString.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\StringBuilder.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\StringImpl.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"
xcopy /y /d "$(ProjectDir)\..\..\wtf\text\WTFString.cpp" "$(WebKitOutputDir)\include\private\JavaScriptCore"


mkdir 2>NUL "$(OutDir)\JavaScriptCore.resources"
xcopy /y /d "$(ProjectDir)..\$(ProjectName).resources\*" "$(OutDir)\$(ProjectName).resources"

if exist "$(WebKitOutputDir)\buildfailed" del "$(WebKitOutputDir)\buildfailed"
"
/>
<Tool
Name="VCPreBuildEventTool"
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
index f5c4059..2e30731 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
@@ -613,6 +613,10 @@
>
</File>
<File
+ RelativePath="..\..\wtf\text\StringBuilder.cpp"
+ >
+ </File>
+ <File
RelativePath="..\..\wtf\text\StringBuilder.h"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
index 0f3e145..029a4b0 100644
--- a/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
+++ b/JavaScriptCore/JavaScriptCore.vcproj/jsc/jsc.vcproj
@@ -334,6 +334,10 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\StringBuilder.cpp"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\include\private\JavaScriptCore\StringImpl.cpp"
>
</File>
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index a2ae894..adeb029 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -206,6 +206,7 @@
8627E5EC11F1281900A313B5 /* PageAllocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 8627E5EA11F1281900A313B5 /* PageAllocation.h */; settings = {ATTRIBUTES = (Private, ); }; };
862AF4B612239C7B0024E5B8 /* DecimalNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 862AF4B512239C7B0024E5B8 /* DecimalNumber.h */; };
863B23E00FC6118900703AA4 /* MacroAssemblerCodeRef.h in Headers */ = {isa = PBXBuildFile; fileRef = 863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86438FC31265503E00E0DFCA /* StringBuilder.cpp */; };
86565742115BE3DA00291F40 /* CString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86565740115BE3DA00291F40 /* CString.cpp */; };
86565743115BE3DA00291F40 /* CString.h in Headers */ = {isa = PBXBuildFile; fileRef = 86565741115BE3DA00291F40 /* CString.h */; settings = {ATTRIBUTES = (Private, ); }; };
865F408810E7D56300947361 /* APIShims.h in Headers */ = {isa = PBXBuildFile; fileRef = 865F408710E7D56300947361 /* APIShims.h */; };
@@ -811,6 +812,7 @@
8627E5EA11F1281900A313B5 /* PageAllocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageAllocation.h; sourceTree = "<group>"; };
862AF4B512239C7B0024E5B8 /* DecimalNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DecimalNumber.h; sourceTree = "<group>"; };
863B23DF0FC60E6200703AA4 /* MacroAssemblerCodeRef.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MacroAssemblerCodeRef.h; sourceTree = "<group>"; };
+ 86438FC31265503E00E0DFCA /* StringBuilder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringBuilder.cpp; path = text/StringBuilder.cpp; sourceTree = "<group>"; };
86565740115BE3DA00291F40 /* CString.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CString.cpp; path = text/CString.cpp; sourceTree = "<group>"; };
86565741115BE3DA00291F40 /* CString.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CString.h; path = text/CString.h; sourceTree = "<group>"; };
865F408710E7D56300947361 /* APIShims.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = APIShims.h; sourceTree = "<group>"; };
@@ -1840,6 +1842,7 @@
86565740115BE3DA00291F40 /* CString.cpp */,
86565741115BE3DA00291F40 /* CString.h */,
86B99AE1117E578100DF5A90 /* StringBuffer.h */,
+ 86438FC31265503E00E0DFCA /* StringBuilder.cpp */,
081469481264375E00DFF935 /* StringBuilder.h */,
0896C29E1265AB0900B1CDD3 /* StringConcatenate.h */,
868BFA05117CEFD100B908B1 /* StringHash.h */,
@@ -2787,6 +2790,7 @@
9714AF5E122F32070092D9F5 /* ParsedURL.cpp in Sources */,
90213E3D123A40C200D422F3 /* MemoryStatistics.cpp in Sources */,
A730B6131250068F009D25B1 /* StrictEvalActivation.cpp in Sources */,
+ 86438FC41265503E00E0DFCA /* StringBuilder.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/JavaScriptCore/runtime/JSONObject.cpp b/JavaScriptCore/runtime/JSONObject.cpp
index 1234b66..0794189 100644
--- a/JavaScriptCore/runtime/JSONObject.cpp
+++ b/JavaScriptCore/runtime/JSONObject.cpp
@@ -284,7 +284,7 @@ void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& val
int length = value.length();
// String length plus 2 for quote marks plus 8 so we can accomodate a few escaped characters.
- builder.reserveCapacity(builder.size() + length + 2 + 8);
+ builder.reserveCapacity(builder.length() + length + 2 + 8);
builder.append('"');
@@ -521,7 +521,7 @@ bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, UStringBu
// Last time through, finish up and return false.
if (m_index == m_size) {
stringifier.unindent();
- if (m_size && builder[builder.size() - 1] != '{')
+ if (m_size && builder[builder.length() - 1] != '{')
stringifier.startNewLine(builder);
builder.append(m_isArray ? ']' : '}');
return false;
@@ -562,7 +562,7 @@ bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, UStringBu
if (exec->hadException())
return false;
- rollBackPoint = builder.size();
+ rollBackPoint = builder.length();
// Append the separator string.
if (builder[rollBackPoint - 1] != '{')
diff --git a/JavaScriptCore/runtime/UStringBuilder.h b/JavaScriptCore/runtime/UStringBuilder.h
index 870c221..31ccf38 100644
--- a/JavaScriptCore/runtime/UStringBuilder.h
+++ b/JavaScriptCore/runtime/UStringBuilder.h
@@ -32,23 +32,10 @@ namespace JSC {
class UStringBuilder : public StringBuilder {
public:
- // Forward declare these methods, otherwhise append() is ambigious.
- void append(const UChar u) { StringBuilder::append(u); }
- void append(const char* str) { StringBuilder::append(str); }
- void append(const char* str, size_t len) { StringBuilder::append(str, len); }
- void append(const UChar* str, size_t len) { StringBuilder::append(str, len); }
+ using StringBuilder::append;
+ void append(const UString& str) { append(String(str.impl())); }
- void append(const UString& str)
- {
- m_buffer.append(str.characters(), str.length());
- }
-
- UString toUString()
- {
- m_buffer.shrinkToFit();
- ASSERT(m_buffer.data() || !m_buffer.size());
- return UString::adopt(m_buffer);
- }
+ UString toUString() { return toString().impl(); }
};
} // namespace JSC
diff --git a/JavaScriptCore/wtf/CMakeLists.txt b/JavaScriptCore/wtf/CMakeLists.txt
index 896794e..9c3d9fb 100644
--- a/JavaScriptCore/wtf/CMakeLists.txt
+++ b/JavaScriptCore/wtf/CMakeLists.txt
@@ -16,6 +16,7 @@ SET(WTF_SOURCES
text/AtomicString.cpp
text/CString.cpp
+ text/StringBuilder.cpp
text/StringImpl.cpp
text/StringStatics.cpp
text/WTFString.cpp
diff --git a/JavaScriptCore/wtf/text/StringBuilder.cpp b/JavaScriptCore/wtf/text/StringBuilder.cpp
new file mode 100644
index 0000000..dfc9ff3
--- /dev/null
+++ b/JavaScriptCore/wtf/text/StringBuilder.cpp
@@ -0,0 +1,172 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "StringBuilder.h"
+
+#include "WTFString.h"
+
+namespace WTF {
+
+void StringBuilder::reifyString()
+{
+ // Check if the string already exists.
+ if (!m_string.isNull()) {
+ ASSERT(m_string.length() == m_length);
+ return;
+ }
+
+ // Check for empty.
+ if (!m_length) {
+ m_string = StringImpl::empty();
+ return;
+ }
+
+ // Must be valid in the buffer, take a substring (unless string fills the buffer).
+ ASSERT(m_buffer && m_length <= m_buffer->length());
+ m_string = (m_length == m_buffer->length())
+ ? m_buffer.get()
+ : StringImpl::create(m_buffer, 0, m_length);
+}
+
+void StringBuilder::resize(unsigned newSize)
+{
+ // Check newSize < m_length, hence m_length > 0.
+ ASSERT(newSize <= m_length);
+ if (newSize == m_length)
+ return;
+ ASSERT(m_length);
+
+ // If there is a buffer, we only need to duplicate it if it has more than one ref.
+ if (m_buffer) {
+ if (!m_buffer->hasOneRef())
+ allocateBuffer(m_buffer->characters(), m_buffer->length());
+ m_length = newSize;
+ m_string = String();
+ return;
+ }
+
+ // Since m_length && !m_buffer, the string must be valid in m_string, and m_string.length() > 0.
+ ASSERT(!m_string.isEmpty());
+ ASSERT(m_length == m_string.length());
+ ASSERT(newSize < m_string.length());
+ m_length = newSize;
+ m_string = StringImpl::create(m_string.impl(), 0, newSize);
+}
+
+void StringBuilder::reserveCapacity(unsigned newCapacity)
+{
+ if (m_buffer) {
+ // If there is already a buffer, then grow if necessary.
+ if (newCapacity > m_buffer->length())
+ allocateBuffer(m_buffer->characters(), newCapacity);
+ } else {
+ // Grow the string, if necessary.
+ if (newCapacity > m_length)
+ allocateBuffer(m_string.characters(), newCapacity);
+ }
+}
+
+// Allocate a new buffer, copying in currentCharacters (these may come from either m_string
+// or m_buffer, neither will be reassigned until the copy has completed).
+void StringBuilder::allocateBuffer(const UChar* currentCharacters, unsigned requiredLength)
+{
+ // Copy the existing data into a new buffer, set result to point to the end of the existing data.
+ RefPtr<StringImpl> buffer = StringImpl::createUninitialized(requiredLength, m_bufferCharacters);
+ memcpy(m_bufferCharacters, currentCharacters, static_cast<size_t>(m_length) * sizeof(UChar)); // This can't overflow.
+
+ // Update the builder state.
+ m_buffer = buffer.release();
+ m_string = String();
+}
+
+// Make 'length' additional capacity be available in m_buffer, update m_string & m_length,
+// return a pointer to the newly allocated storage.
+UChar* StringBuilder::appendUninitialized(unsigned length)
+{
+ ASSERT(length);
+
+ // Calcuate the new size of the builder after appending.
+ unsigned requiredLength = length + m_length;
+ if (requiredLength < length)
+ CRASH();
+
+ if (m_buffer) {
+ // If the buffer is valid it must be at least as long as the current builder contents!
+ ASSERT(m_buffer->length() >= m_length);
+
+ // Check if the buffer already has sufficient capacity.
+ if (requiredLength <= m_buffer->length()) {
+ unsigned currentLength = m_length;
+ m_string = String();
+ m_length = requiredLength;
+ return m_bufferCharacters + currentLength;
+ }
+
+ // We need to realloc the buffer.
+ allocateBuffer(m_buffer->characters(), std::max(requiredLength, m_buffer->length() * 2));
+ } else {
+ ASSERT(m_string.length() == m_length);
+ allocateBuffer(m_string.characters(), std::max(requiredLength, requiredLength * 2));
+ }
+
+ UChar* result = m_bufferCharacters + m_length;
+ m_length = requiredLength;
+ return result;
+}
+
+void StringBuilder::append(const UChar* characters, unsigned length)
+{
+ if (!length)
+ return;
+ ASSERT(characters);
+
+ memcpy(appendUninitialized(length), characters, static_cast<size_t>(length) * 2);
+}
+
+void StringBuilder::append(const char* characters, unsigned length)
+{
+ if (!length)
+ return;
+ ASSERT(characters);
+
+ UChar* dest = appendUninitialized(length);
+ const char* end = characters + length;
+ while (characters < end)
+ *(dest++) = *(const unsigned char*)(characters++);
+}
+
+void StringBuilder::shrinkToFit()
+{
+ // If the buffer is at least 80% full, don't bother copying. Need to tune this heuristic!
+ if (m_buffer && m_buffer->length() > (m_length + (m_length >> 2))) {
+ UChar* result;
+ m_string = StringImpl::createUninitialized(m_length, result);
+ memcpy(result, m_buffer->characters(), static_cast<size_t>(m_length) * 2); // This can't overflow.
+ m_buffer = 0;
+ }
+}
+
+} // namespace WTF
diff --git a/JavaScriptCore/wtf/text/StringBuilder.h b/JavaScriptCore/wtf/text/StringBuilder.h
index 0ac0a7e..f10af64 100644
--- a/JavaScriptCore/wtf/text/StringBuilder.h
+++ b/JavaScriptCore/wtf/text/StringBuilder.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2009, 2010 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -33,57 +33,103 @@ namespace WTF {
class StringBuilder {
public:
- void append(const UChar u)
+ StringBuilder()
+ : m_length(0)
{
- m_buffer.append(u);
}
- void append(const char* str)
+ void append(const UChar*, unsigned);
+ void append(const char*, unsigned);
+
+ void append(const String& string)
{
- append(str, strlen(str));
+ // If we're appending to an empty string, and there is not buffer
+ // (in case reserveCapacity has been called) then just retain the
+ // string.
+ if (!m_length && !m_buffer) {
+ m_string = string;
+ m_length = string.length();
+ return;
+ }
+ append(string.characters(), string.length());
}
- void append(const char* str, size_t len)
+ void append(const char* characters)
{
- reserveCapacity(m_buffer.size() + len);
- for (size_t i = 0; i < len; i++)
- m_buffer.append(static_cast<unsigned char>(str[i]));
+ if (characters)
+ append(characters, strlen(characters));
}
- void append(const UChar* str, size_t len)
+ void append(UChar c)
{
- m_buffer.append(str, len);
+ if (m_buffer && m_length < m_buffer->length() && m_string.isNull())
+ m_bufferCharacters[m_length++] = c;
+ else
+ append(&c, 1);
}
- void append(const String& str)
+ void append(char c)
{
- m_buffer.append(str.characters(), str.length());
+ if (m_buffer && m_length < m_buffer->length() && m_string.isNull())
+ m_bufferCharacters[m_length++] = (unsigned char)c;
+ else
+ append(&c, 1);
}
- bool isEmpty() const { return m_buffer.isEmpty(); }
- void reserveCapacity(size_t newCapacity)
+ String toString()
{
- if (newCapacity < m_buffer.capacity())
- return;
- m_buffer.reserveCapacity(std::max(newCapacity, m_buffer.capacity() + m_buffer.capacity() / 4 + 1));
+ if (m_string.isNull()) {
+ shrinkToFit();
+ reifyString();
+ }
+ return m_string;
}
- void resize(size_t size) { m_buffer.resize(size); }
- size_t size() const { return m_buffer.size(); }
- // FIXME: remove size(), above (strings have a length, not a size).
- // also, should return an unsigned, not a size_t.
- size_t length() const { return size(); }
- UChar operator[](size_t i) const { return m_buffer.at(i); }
+ String toStringPreserveCapacity()
+ {
+ if (m_string.isNull())
+ reifyString();
+ return m_string;
+ }
- String toString()
+ unsigned length() const
+ {
+ return m_length;
+ }
+
+ bool isEmpty() const { return !length(); }
+
+ void reserveCapacity(unsigned newCapacity);
+
+ void resize(unsigned newSize);
+
+ void shrinkToFit();
+
+ UChar operator[](unsigned i) const
{
- m_buffer.shrinkToFit();
- ASSERT(m_buffer.data() || !m_buffer.size());
- return String::adopt(m_buffer);
+ ASSERT(i < m_length);
+ if (!m_string.isNull())
+ return m_string[i];
+ ASSERT(m_buffer);
+ return m_buffer->characters()[i];
}
-protected:
- Vector<UChar, 64> m_buffer;
+ void clear()
+ {
+ m_length = 0;
+ m_string = String();
+ m_buffer = 0;
+ }
+
+private:
+ void allocateBuffer(const UChar* currentCharacters, unsigned requiredLength);
+ UChar* appendUninitialized(unsigned length);
+ void reifyString();
+
+ unsigned m_length;
+ String m_string;
+ RefPtr<StringImpl> m_buffer;
+ UChar* m_bufferCharacters;
};
} // namespace WTF
diff --git a/JavaScriptCore/wtf/wtf.pri b/JavaScriptCore/wtf/wtf.pri
index 84ac20e..b176481 100644
--- a/JavaScriptCore/wtf/wtf.pri
+++ b/JavaScriptCore/wtf/wtf.pri
@@ -22,6 +22,7 @@ SOURCES += \
wtf/WTFThreadData.cpp \
wtf/text/AtomicString.cpp \
wtf/text/CString.cpp \
+ wtf/text/StringBuilder.cpp \
wtf/text/StringImpl.cpp \
wtf/text/StringStatics.cpp \
wtf/text/WTFString.cpp \
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index fc671fd..3bf8ac5 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43987 - Downloading using XHR is much slower than before
+
+ * svg/SVGPathStringBuilder.cpp:
+ (WebCore::SVGPathStringBuilder::result):
+ StringBuilder::size() -> StringBuilder::length().
+
2010-10-13 Yong Li <yoli at rim.com>
Reviewed by Oliver Hunt.
diff --git a/WebCore/svg/SVGPathStringBuilder.cpp b/WebCore/svg/SVGPathStringBuilder.cpp
index 418e367..e5f4419 100644
--- a/WebCore/svg/SVGPathStringBuilder.cpp
+++ b/WebCore/svg/SVGPathStringBuilder.cpp
@@ -26,7 +26,7 @@ namespace WebCore {
String SVGPathStringBuilder::result()
{
- unsigned size = m_stringBuilder.size();
+ unsigned size = m_stringBuilder.length();
if (!size)
return String();
diff --git a/WebKit/chromium/ChangeLog b/WebKit/chromium/ChangeLog
index e56db06..18b8c9b 100644
--- a/WebKit/chromium/ChangeLog
+++ b/WebKit/chromium/ChangeLog
@@ -1,3 +1,12 @@
+2010-10-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Bug 43987 - Downloading using XHR is much slower than before
+
+ * src/WebPageSerializerImpl.cpp:
+ (WebKit::WebPageSerializerImpl::encodeAndFlushBuffer):
+
2010-10-13 Adam Barth <abarth at webkit.org>
Reviewed by Tony Chang.
diff --git a/WebKit/chromium/src/WebPageSerializerImpl.cpp b/WebKit/chromium/src/WebPageSerializerImpl.cpp
index 7e7f27c..0d85d78 100644
--- a/WebKit/chromium/src/WebPageSerializerImpl.cpp
+++ b/WebKit/chromium/src/WebPageSerializerImpl.cpp
@@ -278,7 +278,7 @@ void WebPageSerializerImpl::encodeAndFlushBuffer(
FlushOption flushOption)
{
// Data buffer is not full nor do we want to force flush.
- if (flushOption != ForceFlush && m_dataBuffer.size() <= dataBufferCapacity)
+ if (flushOption != ForceFlush && m_dataBuffer.length() <= dataBufferCapacity)
return;
String content = m_dataBuffer.toString();
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list