{
}
-void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const UString& name)
+void JSCallbackFunction::finishCreation(JSGlobalData& globalData, const String& name)
{
Base::finishCreation(globalData, name);
ASSERT(inherits(&s_info));
class JSCallbackFunction : public InternalFunction {
protected:
JSCallbackFunction(JSGlobalObject*, JSObjectCallAsFunctionCallback);
- void finishCreation(JSGlobalData&, const UString& name);
+ void finishCreation(JSGlobalData&, const String& name);
public:
typedef InternalFunction Base;
- static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const UString& name)
+ static JSCallbackFunction* create(ExecState* exec, JSGlobalObject* globalObject, JSObjectCallAsFunctionCallback callback, const String& name)
{
JSCallbackFunction* function = new (NotNull, allocateCell<JSCallbackFunction>(*exec->heap())) JSCallbackFunction(globalObject, callback);
function->finishCreation(exec->globalData(), name);
static const unsigned StructureFlags = ProhibitsPropertyCaching | OverridesGetOwnPropertySlot | ImplementsHasInstance | OverridesHasInstance | OverridesVisitChildren | OverridesGetPropertyNames | Parent::StructureFlags;
private:
- static UString className(const JSObject*);
+ static String className(const JSObject*);
static void destroy(JSCell*);
}
template <class Parent>
-UString JSCallbackObject<Parent>::className(const JSObject* object)
+String JSCallbackObject<Parent>::className(const JSObject* object)
{
const JSCallbackObject* thisObject = jsCast<const JSCallbackObject*>(object);
- UString thisClassName = thisObject->classRef()->className();
+ String thisClassName = thisObject->classRef()->className();
if (!thisClassName.isEmpty())
return thisClassName;
const JSClassDefinition kJSClassDefinitionEmpty = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
-static inline UString tryCreateStringFromUTF8(const char* string)
-{
- if (!string)
- return UString();
-
- size_t length = strlen(string);
- Vector<UChar, 1024> buffer(length);
- UChar* p = buffer.data();
- if (conversionOK != convertUTF8ToUTF16(&string, string + length, &p, p + length))
- return UString();
-
- return UString(buffer.data(), p - buffer.data());
-}
-
OpaqueJSClass::OpaqueJSClass(const JSClassDefinition* definition, OpaqueJSClass* protoClass)
: parentClass(definition->parentClass)
, prototypeClass(0)
, callAsConstructor(definition->callAsConstructor)
, hasInstance(definition->hasInstance)
, convertToType(definition->convertToType)
- , m_className(tryCreateStringFromUTF8(definition->className))
+ , m_className(String::fromUTF8(definition->className))
{
initializeThreading();
if (const JSStaticValue* staticValue = definition->staticValues) {
m_staticValues = adoptPtr(new OpaqueJSClassStaticValuesTable);
while (staticValue->name) {
- UString valueName = tryCreateStringFromUTF8(staticValue->name);
+ String valueName = String::fromUTF8(staticValue->name);
if (!valueName.isNull())
m_staticValues->set(valueName.impl(), adoptPtr(new StaticValueEntry(staticValue->getProperty, staticValue->setProperty, staticValue->attributes)));
++staticValue;
if (const JSStaticFunction* staticFunction = definition->staticFunctions) {
m_staticFunctions = adoptPtr(new OpaqueJSClassStaticFunctionsTable);
while (staticFunction->name) {
- UString functionName = tryCreateStringFromUTF8(staticFunction->name);
+ String functionName = String::fromUTF8(staticFunction->name);
if (!functionName.isNull())
m_staticFunctions->set(functionName.impl(), adoptPtr(new StaticFunctionEntry(staticFunction->callAsFunction, staticFunction->attributes)));
++staticFunction;
return *contextData;
}
-UString OpaqueJSClass::className()
+String OpaqueJSClass::className()
{
// Make a deep copy, so that the caller has no chance to put the original into IdentifierTable.
- return UString(m_className.characters(), m_className.length());
+ return m_className.isolatedCopy();
}
OpaqueJSClassStaticValuesTable* OpaqueJSClass::staticValues(JSC::ExecState* exec)
#include "Weak.h"
#include "JSObject.h"
#include "Protect.h"
-#include "UString.h"
#include <wtf/HashMap.h>
+#include <wtf/text/WTFString.h>
struct StaticValueEntry {
WTF_MAKE_FAST_ALLOCATED;
static PassRefPtr<OpaqueJSClass> createNoAutomaticPrototype(const JSClassDefinition*);
~OpaqueJSClass();
- JSC::UString className();
+ String className();
OpaqueJSClassStaticValuesTable* staticValues(JSC::ExecState*);
OpaqueJSClassStaticFunctionsTable* staticFunctions(JSC::ExecState*);
JSC::JSObject* prototype(JSC::ExecState*);
OpaqueJSClassContextData& contextData(JSC::ExecState*);
- // UStrings in these data members should not be put into any IdentifierTable.
- JSC::UString m_className;
+ // Strings in these data members should not be put into any IdentifierTable.
+ String m_className;
OwnPtr<OpaqueJSClassStaticValuesTable> m_staticValues;
OwnPtr<OpaqueJSClassStaticFunctionsTable> m_staticFunctions;
};
#include "JSClassRef.h"
#include "JSGlobalObject.h"
#include "JSObject.h"
-#include "UStringBuilder.h"
+#include <wtf/text/StringBuilder.h>
#include <wtf/text/StringHash.h>
#if OS(DARWIN)
JSLockHolder lock(exec);
unsigned count = 0;
- UStringBuilder builder;
+ StringBuilder builder;
CallFrame* callFrame = exec;
- UString functionName;
+ String functionName;
if (exec->callee()) {
if (asObject(exec->callee())->inherits(&InternalFunction::s_info)) {
functionName = asInternalFunction(exec->callee())->name(exec);
ASSERT(callFrame);
int signedLineNumber;
intptr_t sourceID;
- UString urlString;
+ String urlString;
JSValue function;
- UString levelStr = UString::number(count);
+ String levelStr = String::number(count);
exec->interpreter()->retrieveLastCaller(callFrame, signedLineNumber, sourceID, urlString, function);
builder.append("() at ");
builder.append(urlString);
builder.append(":");
- builder.append(UString::number(lineNumber));
+ builder.append(String::number(lineNumber));
if (!function || ++count == maxStackSize)
break;
callFrame = callFrame->callerFrame();
}
- return OpaqueJSString::create(builder.toUString()).leakRef();
+ return OpaqueJSString::create(builder.toString()).leakRef();
}
#include "InitializeThreading.h"
#include "JSStringRef.h"
#include "OpaqueJSString.h"
-#include <runtime/UString.h>
#include <runtime/JSValue.h>
#include <wtf/OwnArrayPtr.h>
#include <runtime/LiteralParser.h>
#include <runtime/Operations.h>
#include <runtime/Protect.h>
-#include <runtime/UString.h>
#include <runtime/JSValue.h>
#include <wtf/Assertions.h>
#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
#include <algorithm> // for std::min
{
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
- UString str = string->ustring();
+ String str = string->ustring();
if (str.is8Bit()) {
LiteralParser<LChar> parser(exec, str.characters8(), str.length(), StrictJSON);
return toRef(exec, parser.tryLiteralParse());
ExecState* exec = toJS(ctx);
APIEntryShim entryShim(exec);
JSValue value = toJS(exec, apiValue);
- UString result = JSONStringify(exec, value, indent);
+ String result = JSONStringify(exec, value, indent);
if (exception)
*exception = 0;
if (exec->hadException()) {
using namespace JSC;
-PassRefPtr<OpaqueJSString> OpaqueJSString::create(const UString& ustring)
+PassRefPtr<OpaqueJSString> OpaqueJSString::create(const String& string)
{
- if (!ustring.isNull())
- return adoptRef(new OpaqueJSString(ustring.characters(), ustring.length()));
+ if (!string.isNull())
+ return adoptRef(new OpaqueJSString(string.characters(), string.length()));
return 0;
}
-UString OpaqueJSString::ustring() const
+String OpaqueJSString::ustring() const
{
if (this && m_characters)
- return UString(m_characters, m_length);
- return UString();
+ return String(m_characters, m_length);
+ return String();
}
Identifier OpaqueJSString::identifier(JSGlobalData* globalData) const
#define OpaqueJSString_h
#include <wtf/ThreadSafeRefCounted.h>
-#include <runtime/UString.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
class Identifier;
return adoptRef(new OpaqueJSString(characters, length));
}
- JS_EXPORT_PRIVATE static PassRefPtr<OpaqueJSString> create(const JSC::UString&);
+ JS_EXPORT_PRIVATE static PassRefPtr<OpaqueJSString> create(const String&);
UChar* characters() { return this ? m_characters : 0; }
unsigned length() { return this ? m_length : 0; }
- JSC::UString ustring() const;
+ // FIXME: rename to string().
+ String ustring() const;
JSC::Identifier identifier(JSC::JSGlobalData*) const;
private:
runtime/StructureChain.cpp
runtime/SymbolTable.cpp
runtime/TimeoutChecker.cpp
- runtime/UString.cpp
tools/CodeProfile.cpp
tools/CodeProfiling.cpp
+2012-08-30 Benjamin Poulain <bpoulain@apple.com>
+
+ Replace JSC::UString by WTF::String
+ https://bugs.webkit.org/show_bug.cgi?id=95271
+
+ Reviewed by Geoffrey Garen.
+
+ Having JSC::UString and WTF::String increase the complexity of working on WebKit, and
+ add useless conversions in the bindings. It also cause some code bloat.
+
+ The performance advantages of UString have been ported over in previous patches. This patch
+ is the last step: getting rid of UString.
+
+ In addition to the simplified code, this also reduce the binary size by 15kb on x86_64.
+
+ * API/OpaqueJSString.cpp:
+ (OpaqueJSString::ustring):
+ * runtime/Identifier.h:
+ (JSC::Identifier::ustring):
+ To avoid changing everything at once, the function named ustring() were kept as is. They
+ will be renamed in a follow up patch.
+
+ * runtime/JSString.h:
+ (JSC::JSString::string):
+ (JSC::JSValue::toWTFString):
+ (JSC::inlineJSValueNotStringtoString):
+ (JSC::JSValue::toWTFStringInline):
+ Since JSValue::toString() already exist (and return the JSString), the direct accessor is renamed
+ to ::toWTFString(). We may change ::string() to ::jsString() and ::toWTFString() to ::toString()
+ in the future.
+
+ * runtime/StringPrototype.cpp:
+ (JSC::substituteBackreferencesSlow): Replace the use of UString::getCharacters<>() by String::getCharactersWithUpconvert<>().
+
2012-08-24 Mark Hahnenberg <mhahnenberg@apple.com>
Remove uses of ClassInfo in StrictEq and CompareEq in the DFG
Source/JavaScriptCore/runtime/TimeoutChecker.h \
Source/JavaScriptCore/runtime/Tracing.h \
Source/JavaScriptCore/runtime/Uint16WithFraction.h \
- Source/JavaScriptCore/runtime/UString.cpp \
- Source/JavaScriptCore/runtime/UString.h \
- Source/JavaScriptCore/runtime/UStringBuilder.h \
- Source/JavaScriptCore/runtime/UStringConcatenate.h \
Source/JavaScriptCore/runtime/WeakGCMap.h \
Source/JavaScriptCore/runtime/WeakRandom.h \
Source/JavaScriptCore/runtime/WriteBarrier.h \
??0StringObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@@Z
??0Structure@JSC@@AAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@VJSValue@1@ABVTypeInfo@1@PBUClassInfo@1@@Z
??0ThreadCondition@WTF@@QAE@XZ
- ??0UString@JSC@@QAE@PBD@Z
- ??0UString@JSC@@QAE@PBDI@Z
- ??0UString@JSC@@QAE@PB_W@Z
- ??0UString@JSC@@QAE@PB_WI@Z
??0WTFThreadData@WTF@@QAE@XZ
- ??0YarrPattern@Yarr@JSC@@QAE@ABVUString@2@_N1PAPBD@Z
+ ??0YarrPattern@Yarr@JSC@@QAE@ABVString@WTF@@_N1PAPBD@Z
??1ArrayBufferView@WTF@@UAE@XZ
??1ClientData@JSGlobalData@JSC@@UAE@XZ
??1Collator@WTF@@QAE@XZ
??1ThreadCondition@WTF@@QAE@XZ
??1WTFThreadData@WTF@@QAE@XZ
??1WeakHandleOwner@JSC@@UAE@XZ
- ??8JSC@@YA_NABVUString@0@0@Z
??8WTF@@YA_NABVCString@0@0@Z
?EcmaScriptConverter@DoubleToStringConverter@double_conversion@WTF@@SAABV123@XZ
?StringToDouble@StringToDoubleConverter@double_conversion@WTF@@SANPBDIPAI@Z
?allocateSlowCase@MarkedAllocator@JSC@@AAEPAXXZ
?append@StringBuilder@WTF@@QAEXPBEI@Z
?append@StringBuilder@WTF@@QAEXPB_WI@Z
- ?ascii@UString@JSC@@QBE?AVCString@WTF@@XZ
?attach@Debugger@JSC@@QAEXPAVJSGlobalObject@2@@Z
?base64Decode@WTF@@YA_NABVString@1@AAV?$Vector@D$0A@@1@W4Base64DecodePolicy@1@@Z
?base64Encode@WTF@@YA?AVString@1@PBDIW4Base64EncodePolicy@1@@Z
?calculateDSTOffset@WTF@@YANNN@Z
?calculateStringHashAndLengthFromUTF8MaskingTop8Bits@Unicode@WTF@@YAIPBD0AAI1@Z
?calculateUTCOffset@WTF@@YAHXZ
- ?calculatedFunctionName@DebuggerCallFrame@JSC@@QBE?AVUString@2@XZ
+ ?calculatedFunctionName@DebuggerCallFrame@JSC@@QBE?AVString@WTF@@XZ
?call@JSC@@YA?AVJSValue@1@PAVExecState@1@V21@W4CallType@1@ABTCallData@1@1ABVArgList@1@@Z
?callHostFunctionAsConstructor@JSC@@YI_JPAVExecState@1@@Z
?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
?checkCurrentIdentifierTable@Identifier@JSC@@CAXPAVJSGlobalData@2@@Z
?checkSyntax@JSC@@YA_NPAVExecState@1@ABVSourceCode@1@PAVJSValue@1@@Z
?checksum@MD5@WTF@@QAEXAAV?$Vector@E$0BA@@2@@Z
- ?className@JSObject@JSC@@SA?AVUString@2@PBV12@@Z
+ ?className@JSObject@JSC@@SA?AVString@WTF@@PBV12@@Z
?clear@SourceProviderCache@JSC@@QAEXXZ
?clearRareData@JSGlobalObject@JSC@@CAXPAVJSCell@2@@Z
?collate@Collator@WTF@@QBE?AW4Result@12@PB_WI0I@Z
?construct@JSC@@YAPAVJSObject@1@PAVExecState@1@VJSValue@1@W4ConstructType@1@ABTConstructData@1@ABVArgList@1@@Z
?constructArray@JSC@@YAPAVJSArray@1@PAVExecState@1@ABVArgList@1@@Z
?constructEmptyObject@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
- ?constructFunctionSkippingEvalEnabledCheck@JSC@@YAPAVJSObject@1@PAVExecState@1@PAVJSGlobalObject@1@ABVArgList@1@ABVIdentifier@1@ABVUString@1@ABVTextPosition@WTF@@@Z
+ ?constructFunctionSkippingEvalEnabledCheck@JSC@@YAPAVJSObject@1@PAVExecState@1@PAVJSGlobalObject@1@ABVArgList@1@ABVIdentifier@1@ABVString@WTF@@ABVTextPosition@8@@Z
?constructNumber@JSC@@YAPAVNumberObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z
?constructString@JSC@@YAPAVStringObject@1@PAVExecState@1@PAVJSGlobalObject@1@VJSValue@1@@Z
?convertLatin1ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBEPBEPAPADPAD@Z
?convertUTF16ToUTF8@Unicode@WTF@@YA?AW4ConversionResult@12@PAPB_WPB_WPAPADPAD_N@Z
?convertUTF8ToUTF16@Unicode@WTF@@YA?AW4ConversionResult@12@PAPBDPBDPAPA_WPA_W_N@Z
- ?create@JSFunction@JSC@@SAPAV12@PAVExecState@2@PAVJSGlobalObject@2@HABVUString@2@P6I_J0@ZW4Intrinsic@2@3@Z
+ ?create@JSFunction@JSC@@SAPAV12@PAVExecState@2@PAVJSGlobalObject@2@HABVString@WTF@@P6I_J0@ZW4Intrinsic@2@3@Z
?create@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapType@2@@Z
- ?create@OpaqueJSString@@SA?AV?$PassRefPtr@UOpaqueJSString@@@WTF@@ABVUString@JSC@@@Z
- ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVUString@2@W4RegExpFlags@2@@Z
+ ?create@RegExp@JSC@@SAPAV12@AAVJSGlobalData@2@ABVString@WTF@@W4RegExpFlags@2@@Z
?createEmptyString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@@Z
- ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
?createInterruptedExecutionException@JSC@@YAPAVJSObject@1@PAVJSGlobalData@1@@Z
?createLeaked@JSGlobalData@JSC@@SA?AV?$PassRefPtr@VJSGlobalData@JSC@@@WTF@@W4ThreadStackType@2@W4HeapType@2@@Z
?createNotEnoughArgumentsError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
- ?createRangeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
- ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createRangeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
+ ?createReferenceError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
?createSingleCharacterString@SmallStrings@JSC@@AAEXPAVJSGlobalData@2@E@Z
?createStackOverflowError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
- ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
?createTable@HashTable@JSC@@ABEXPAVJSGlobalData@2@@Z
?createThread@WTF@@YAIP6APAXPAX@Z0@Z
?createThread@WTF@@YAIP6APAXPAX@Z0PBD@Z
?createThread@WTF@@YAIP6AXPAX@Z0PBD@Z
- ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?createTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
?cryptographicallyRandomNumber@WTF@@YAIXZ
?cryptographicallyRandomValues@WTF@@YAXPAXI@Z
?currentThread@WTF@@YAIXZ
?detachThread@WTF@@YAXI@Z
?didTimeOut@TimeoutChecker@JSC@@QAE_NPAVExecState@2@@Z
?deleteAllCompiledCode@Heap@JSC@@QAEXXZ
- ?displayName@JSFunction@JSC@@QAE?BVUString@2@PAVExecState@2@@Z
+ ?displayName@JSFunction@JSC@@QAE?BVString@WTF@@PAVExecState@2@@Z
?dtoa@WTF@@YAXQADNAA_NAAHAAI@Z
?dumpAllOptions@Options@JSC@@SAXPAU_iobuf@@@Z
?dumpCallFrame@Interpreter@JSC@@QAEXPAVExecState@2@@Z
?empty@StringImpl@WTF@@SAPAV12@XZ
?enumerable@PropertyDescriptor@JSC@@QBE_NXZ
?equalUTF16WithUTF8@Unicode@WTF@@YA_NPB_W0PBD1@Z
- ?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVUString@2@AAV32@@Z
+ ?evaluate@DebuggerCallFrame@JSC@@QBE?AVJSValue@2@ABVString@WTF@@AAV32@@Z
?evaluate@JSC@@YA?AVJSValue@1@PAVExecState@1@PAVScopeChainNode@1@ABVSourceCode@1@V21@PAV21@@Z
?exclude@Profile@JSC@@QAEXPBVProfileNode@2@@Z
?execute@ParallelEnvironment@WTF@@QAEXPAX@Z
?findAllocator@WeakSet@JSC@@AAEPAUFreeCell@WeakBlock@2@XZ
?finishCreation@BooleanObject@JSC@@IAEXAAVJSGlobalData@2@@Z
?finishCreation@DateInstance@JSC@@IAEXAAVJSGlobalData@2@N@Z
- ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVUString@2@@Z
+ ?finishCreation@InternalFunction@JSC@@IAEXAAVJSGlobalData@2@ABVString@WTF@@@Z
?finishCreation@JSArray@JSC@@IAEXAAVJSGlobalData@2@I@Z
?finishCreation@RegExpObject@JSC@@IAEXPAVJSGlobalObject@2@@Z
?finishCreation@StringObject@JSC@@IAEXAAVJSGlobalData@2@PAVJSString@2@@Z
?from@Identifier@JSC@@SA?AV12@PAVExecState@2@H@Z
?from@Identifier@JSC@@SA?AV12@PAVExecState@2@I@Z
?functionGetter@PropertySlot@JSC@@ABE?AVJSValue@2@PAVExecState@2@@Z
- ?functionName@DebuggerCallFrame@JSC@@QBEPBVUString@2@XZ
- ?getCalculatedDisplayName@JSC@@YA?AVUString@1@PAVExecState@1@PAVJSObject@1@@Z
+ ?getCalculatedDisplayName@JSC@@YA?AVString@WTF@@PAVExecState@1@PAVJSObject@1@@Z
?getCallData@JSCell@JSC@@SA?AW4CallType@2@PAV12@AATCallData@2@@Z
?getCallableObjectSlow@JSC@@YAPAVJSCell@1@PAV21@@Z
?getConstructData@JSCell@JSC@@SA?AW4ConstructType@2@PAV12@AATConstructData@2@@Z
?getPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
?getSlice@ArgList@JSC@@QBEXHAAV12@@Z
?getStackTrace@Interpreter@JSC@@SAXPAVJSGlobalData@2@AAV?$Vector@UStackFrame@JSC@@$0A@@WTF@@@Z
- ?getString@JSCell@JSC@@QBE?AVUString@2@PAVExecState@2@@Z
- ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVUString@2@@Z
+ ?getString@JSCell@JSC@@QBE?AVString@WTF@@PAVExecState@2@@Z
+ ?getString@JSCell@JSC@@QBE_NPAVExecState@2@AAVString@WTF@@@Z
?get@Structure@JSC@@QAEHAAVJSGlobalData@2@VPropertyName@2@AAIAAPAVJSCell@2@@Z
?getter@PropertyDescriptor@JSC@@QBE?AVJSValue@2@XZ
?globalExec@JSGlobalObject@JSC@@QAEPAVExecState@2@XZ
?initializeMainThread@WTF@@YAXXZ
?initializeThreading@JSC@@YAXXZ
?initializeThreading@WTF@@YAXXZ
- ?interpret@Yarr@JSC@@YAIPAUBytecodePattern@12@ABVUString@2@IPAI@Z
+ ?interpret@Yarr@JSC@@YAIPAUBytecodePattern@12@ABVString@WTF@@IPAI@Z
?isAccessorDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isBusy@Heap@JSC@@QAE_NXZ
?isDataDescriptor@PropertyDescriptor@JSC@@QBE_NXZ
?isTerminatedExecutionException@JSC@@YA_NVJSValue@1@@Z
?isValidAllocation@Heap@JSC@@AAE_NI@Z
?isValidCallee@JSValue@JSC@@QAE_NXZ
- ?jsOwnedString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z
- ?jsString@JSC@@YAPAVJSString@1@PAVJSGlobalData@1@ABVUString@1@@Z
?length@CString@WTF@@QBEIXZ
?lock@JSLock@JSC@@QAEXXZ
?lock@Mutex@WTF@@QAEXXZ
?lockAtomicallyInitializedStaticMutex@WTF@@YAXXZ
- ?match@RegExp@JSC@@QAEHAAVJSGlobalData@2@ABVUString@2@IAAV?$Vector@H$0CA@@WTF@@@Z
+ ?match@RegExp@JSC@@QAEHAAVJSGlobalData@2@ABVString@WTF@@IAAV?$Vector@H$0CA@@5@@Z
?materializePropertyMap@Structure@JSC@@AAEXAAVJSGlobalData@2@@Z
?monotonicallyIncreasingTime@WTF@@YANXZ
?monthFromDayInYear@WTF@@YAHH_N@Z
?msToYear@WTF@@YAHN@Z
- ?name@InternalFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
- ?name@JSFunction@JSC@@QAEABVUString@2@PAVExecState@2@@Z
+ ?name@JSFunction@JSC@@QAEABVString@WTF@@PAVExecState@2@@Z
?neuter@ArrayBufferView@WTF@@MAEXXZ
?newUninitialized@CString@WTF@@SA?AV12@IAAPAD@Z
?notifyWriteSlow@SymbolTableEntry@JSC@@AAEXXZ
?putDirectVirtual@JSObject@JSC@@SAXPAV12@PAVExecState@2@VPropertyName@2@VJSValue@2@I@Z
?randomNumber@WTF@@YANXZ
?recompileAllJSFunctions@Debugger@JSC@@QAEXPAVJSGlobalData@2@@Z
- ?regExpFlags@JSC@@YA?AW4RegExpFlags@1@ABVUString@1@@Z
+ ?regExpFlags@JSC@@YA?AW4RegExpFlags@1@ABVString@WTF@@@Z
?reifyString@StringBuilder@WTF@@ABEXXZ
?releaseDecommitted@OSAllocator@WTF@@SAXPAXI@Z
?releaseExecutableMemory@JSGlobalData@JSC@@QAEXXZ
?resolveRope@JSRopeString@JSC@@ABEXPAVExecState@2@@Z
?restoreAll@Profile@JSC@@QAEXXZ
?retrieveCallerFromVMCode@Interpreter@JSC@@QBE?AVJSValue@2@PAVExecState@2@PAVJSFunction@2@@Z
- ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVUString@2@AAVJSValue@2@@Z
+ ?retrieveLastCaller@Interpreter@JSC@@QBEXPAVExecState@2@AAH1AAVString@WTF@@AAVJSValue@2@@Z
?setConfigurable@PropertyDescriptor@JSC@@QAEX_N@Z
?setDescriptor@PropertyDescriptor@JSC@@QAEXVJSValue@2@I@Z
?setDumpsGeneratedCode@BytecodeGenerator@JSC@@SAX_N@Z
?slowValidateCell@JSC@@YAXPAVJSCell@1@@Z
?slowValidateCell@JSC@@YAXPAVJSGlobalObject@1@@Z
?sourceCode@JSFunction@JSC@@QBEPBVSourceCode@2@XZ
- ?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVUString@2@@Z
+ ?startProfiling@Profiler@JSC@@QAEXPAVExecState@2@ABVString@WTF@@@Z
?startSampling@JSGlobalData@JSC@@QAEXXZ
- ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVUString@2@@Z
+ ?stopProfiling@Profiler@JSC@@QAE?AV?$PassRefPtr@VProfile@JSC@@@WTF@@PAVExecState@2@ABVString@4@@Z
?stopSampling@JSGlobalData@JSC@@QAEXXZ
- ?substringSharingImpl@UString@JSC@@QBE?AV12@II@Z
?suggestedNewOutOfLineStorageCapacity@Structure@JSC@@QAEIXZ
?sweeper@Heap@JSC@@QAEPAVIncrementalSweeper@2@XZ
?synthesizePrototype@JSValue@JSC@@QBEPAVJSObject@2@PAVExecState@2@@Z
?throwError@JSC@@YAPAVJSObject@1@PAVExecState@1@PAV21@@Z
?throwSyntaxError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@@Z
- ?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVUString@1@@Z
+ ?throwTypeError@JSC@@YAPAVJSObject@1@PAVExecState@1@ABVString@WTF@@@Z
?timedWait@ThreadCondition@WTF@@QAE_NAAVMutex@2@N@Z
?tlsKeyCount@WTF@@YAAAJXZ
?tlsKeys@WTF@@YAPAKXZ
?toStringSlowCase@JSValue@JSC@@ABEPAVJSString@2@PAVExecState@2@@Z
?toThisObject@JSObject@JSC@@SAPAV12@PAVJSCell@2@PAVExecState@2@@Z
?toThisObjectSlowCase@JSValue@JSC@@ABEPAVJSObject@2@PAVExecState@2@@Z
+ ?toWTFStringSlowCase@JSValue@JSC@@ABE?AVString@WTF@@PAVExecState@2@@Z
?transfer@ArrayBuffer@WTF@@QAE_NAAVArrayBufferContents@2@AAV?$Vector@V?$RefPtr@VArrayBufferView@WTF@@@WTF@@$0A@@2@@Z
?tryFastCalloc@WTF@@YA?AUTryMallocReturnValue@1@II@Z
?tryFastMalloc@WTF@@YA?AUTryMallocReturnValue@1@I@Z
?unlock@Mutex@WTF@@QAEXXZ
?unlockAtomicallyInitializedStaticMutex@WTF@@YAXXZ
?unprotect@Heap@JSC@@QAE_NVJSValue@2@@Z
- ?utf8@UString@JSC@@QBE?AVCString@WTF@@_N@Z
?validate@MarkStack@JSC@@KAXPAVJSCell@2@@Z
?visitChildren@JSGlobalObject@JSC@@SAXPAVJSCell@2@AAVSlotVisitor@2@@Z
?visitChildren@JSGlobalThis@JSC@@KAXPAVJSCell@2@AAVSlotVisitor@2@@Z
RelativePath="..\..\runtime\TimeoutChecker.h"
>
</File>
- <File
- RelativePath="..\..\runtime\UString.cpp"
- >
- </File>
- <File
- RelativePath="..\..\runtime\UString.h"
- >
- </File>
- <File
- RelativePath="..\..\runtime\UStringBuilder.h"
- >
- </File>
- <File
- RelativePath="..\..\runtime\UStringConcatenate.h"
- >
- </File>
- <File
- RelativePath="..\..\runtime\UStringImpl.h"
- >
- </File>
<File
RelativePath="..\..\runtime\WeakGCMap.h"
>
/* End PBXAggregateTarget section */
/* Begin PBXBuildFile section */
- 08DDA5C11264631700751732 /* UStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 08DDA5BB12645F1D00751732 /* UStringBuilder.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0776BF14FF002B00102332 /* JITCompilationEffort.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0776BD14FF002800102332 /* JITCompilationEffort.h */; settings = {ATTRIBUTES = (Private, ); }; };
0F0B839A14BCF45D00885B4F /* LLIntEntrypoints.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 0F0B839514BCF45A00885B4F /* LLIntEntrypoints.cpp */; };
0F0B839B14BCF46000885B4F /* LLIntEntrypoints.h in Headers */ = {isa = PBXBuildFile; fileRef = 0F0B839614BCF45A00885B4F /* LLIntEntrypoints.h */; settings = {ATTRIBUTES = (Private, ); }; };
14469DEB107EC7E700650446 /* StringConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C00E16EE3300B34460 /* StringConstructor.cpp */; };
14469DEC107EC7E700650446 /* StringObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C20E16EE3300B34460 /* StringObject.cpp */; };
14469DED107EC7E700650446 /* StringPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C3C50E16EE3300B34460 /* StringPrototype.cpp */; };
- 14469DEE107EC7E700650446 /* UString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F692A8850255597D01FF60F7 /* UString.cpp */; };
144836E7132DA7BE005BE785 /* ConservativeRoots.h in Headers */ = {isa = PBXBuildFile; fileRef = 149DAAF212EB559D0083B12B /* ConservativeRoots.h */; settings = {ATTRIBUTES = (Private, ); }; };
145722861437E140005FDE26 /* StrongInlines.h in Headers */ = {isa = PBXBuildFile; fileRef = 145722851437E140005FDE26 /* StrongInlines.h */; settings = {ATTRIBUTES = (Private, ); }; };
146AAB380B66A94400E55F16 /* JSStringRefCF.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 146AAB370B66A94400E55F16 /* JSStringRefCF.cpp */; };
BC18C4680E16F5CD00B34460 /* StringObject.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C30E16EE3300B34460 /* StringObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C46A0E16F5CD00B34460 /* StringPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C3C60E16EE3300B34460 /* StringPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */ = {isa = PBXBuildFile; fileRef = 14A396A60CD2933100B5B4FF /* SymbolTable.h */; settings = {ATTRIBUTES = (Private, ); }; };
- BC18C4760E16F5CD00B34460 /* UString.h in Headers */ = {isa = PBXBuildFile; fileRef = F692A8860255597D01FF60F7 /* UString.h */; settings = {ATTRIBUTES = (Private, ); }; };
BC18C47A0E16F5CD00B34460 /* WebKitAvailability.h in Headers */ = {isa = PBXBuildFile; fileRef = 5DE3D0F40DD8DDFB00468714 /* WebKitAvailability.h */; settings = {ATTRIBUTES = (Public, ); }; };
BC18C5240E16FC8A00B34460 /* ArrayPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5230E16FC8A00B34460 /* ArrayPrototype.lut.h */; };
BC18C5260E16FCA700B34460 /* StringPrototype.lut.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5250E16FCA700B34460 /* StringPrototype.lut.h */; };
/* End PBXCopyFilesBuildPhase section */
/* Begin PBXFileReference section */
- 0896C29B1265AAF600B1CDD3 /* UStringConcatenate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringConcatenate.h; sourceTree = "<group>"; };
- 08DDA5BB12645F1D00751732 /* UStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UStringBuilder.h; sourceTree = "<group>"; };
0F0776BD14FF002800102332 /* JITCompilationEffort.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JITCompilationEffort.h; sourceTree = "<group>"; };
0F0B839514BCF45A00885B4F /* LLIntEntrypoints.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LLIntEntrypoints.cpp; path = llint/LLIntEntrypoints.cpp; sourceTree = "<group>"; };
0F0B839614BCF45A00885B4F /* LLIntEntrypoints.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LLIntEntrypoints.h; path = llint/LLIntEntrypoints.h; sourceTree = "<group>"; };
F692A87C0255597D01FF60F7 /* RegExpObject.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RegExpObject.h; sourceTree = "<group>"; tabWidth = 8; };
F692A87D0255597D01FF60F7 /* RegExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RegExp.cpp; sourceTree = "<group>"; tabWidth = 8; };
F692A87E0255597D01FF60F7 /* RegExp.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = RegExp.h; sourceTree = "<group>"; tabWidth = 8; };
- F692A8850255597D01FF60F7 /* UString.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UString.cpp; sourceTree = "<group>"; tabWidth = 8; };
- F692A8860255597D01FF60F7 /* UString.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = UString.h; sourceTree = "<group>"; tabWidth = 8; };
F692A8870255597D01FF60F7 /* JSValue.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSValue.cpp; sourceTree = "<group>"; tabWidth = 8; };
FE4A331D15BD2E07006F54F3 /* VMInspector.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = VMInspector.cpp; sourceTree = "<group>"; };
FE4A331E15BD2E07006F54F3 /* VMInspector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VMInspector.h; sourceTree = "<group>"; };
5D53726D0E1C546B0021E549 /* Tracing.d */,
5D53726E0E1C54880021E549 /* Tracing.h */,
866739D113BFDE710023D87C /* Uint16WithFraction.h */,
- F692A8850255597D01FF60F7 /* UString.cpp */,
- F692A8860255597D01FF60F7 /* UString.h */,
- 08DDA5BB12645F1D00751732 /* UStringBuilder.h */,
- 0896C29B1265AAF600B1CDD3 /* UStringConcatenate.h */,
14BFCE6810CDB1FC00364CCE /* WeakGCMap.h */,
1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */,
A7DCB77912E3D90500911940 /* WriteBarrier.h */,
5D53726F0E1C54880021E549 /* Tracing.h in Headers */,
866739D313BFDE710023D87C /* Uint16WithFraction.h in Headers */,
0F5F08CF146C7633000472A9 /* UnconditionalFinalizer.h in Headers */,
- BC18C4760E16F5CD00B34460 /* UString.h in Headers */,
- 08DDA5C11264631700751732 /* UStringBuilder.h in Headers */,
0F963B3813FC6FE90002D9B2 /* ValueProfile.h in Headers */,
0F426A481460CBB300131F8F /* ValueRecovery.h in Headers */,
0F426A491460CBB700131F8F /* VirtualRegister.h in Headers */,
BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */,
A7386555118697B400540279 /* ThunkGenerators.cpp in Sources */,
14A42E3F0F4F60EE00599099 /* TimeoutChecker.cpp in Sources */,
- 14469DEE107EC7E700650446 /* UString.cpp in Sources */,
0FC81516140511B500CFA603 /* VTableSpectrum.cpp in Sources */,
0FC8150B14043C0E00CFA603 /* WriteBarrierSupport.cpp in Sources */,
86704B8412DBA33700A9FE7B /* YarrInterpreter.cpp in Sources */,
runtime/Structure.cpp \
runtime/SymbolTable.cpp \
runtime/TimeoutChecker.cpp \
- runtime/UString.cpp \
tools/CodeProfile.cpp \
tools/CodeProfiling.cpp \
yarr/YarrJIT.cpp \
#include "LowLevelInterpreter.h"
#include "MethodCallLinkStatus.h"
#include "RepatchBuffer.h"
-#include "UStringConcatenate.h"
#include <stdio.h>
#include <wtf/StringExtras.h>
#include <wtf/UnusedParam.h>
using namespace DFG;
#endif
-static UString escapeQuotes(const UString& str)
+static String escapeQuotes(const String& str)
{
- UString result = str;
+ String result = str;
size_t pos = 0;
while ((pos = result.find('\"', pos)) != notFound) {
- result = makeUString(result.substringSharingImpl(0, pos), "\"\\\"\"", result.substringSharingImpl(pos + 1));
+ result = makeString(result.substringSharingImpl(0, pos), "\"\\\"\"", result.substringSharingImpl(pos + 1));
pos += 4;
}
return result;
}
-static UString valueToSourceString(ExecState* exec, JSValue val)
+static String valueToSourceString(ExecState* exec, JSValue val)
{
if (!val)
return "0";
if (val.isString())
- return makeUString("\"", escapeQuotes(val.toString(exec)->value(exec)), "\"");
+ return makeString("\"", escapeQuotes(val.toString(exec)->value(exec)), "\"");
return val.description();
}
static CString constantName(ExecState* exec, int k, JSValue value)
{
- return makeUString(valueToSourceString(exec, value), "(@k", UString::number(k - FirstConstantRegisterIndex), ")").utf8();
+ return makeString(valueToSourceString(exec, value), "(@k", String::number(k - FirstConstantRegisterIndex), ")").utf8();
}
static CString idName(int id0, const Identifier& ident)
{
- return makeUString(ident.ustring(), "(@id", UString::number(id0), ")").utf8();
+ return makeString(ident.ustring(), "(@id", String::number(id0), ")").utf8();
}
void CodeBlock::dumpBytecodeCommentAndNewLine(int location)
if (isConstantRegisterIndex(r))
return constantName(exec, r, getConstant(r));
- return makeUString("r", UString::number(r)).utf8();
+ return makeString("r", String::number(r)).utf8();
}
-static UString regexpToSourceString(RegExp* regExp)
+static String regexpToSourceString(RegExp* regExp)
{
char postfix[5] = { '/', 0, 0, 0, 0 };
int index = 1;
if (regExp->multiline())
postfix[index] = 'm';
- return makeUString("/", regExp->pattern(), postfix);
+ return makeString("/", regExp->pattern(), postfix);
}
static CString regexpName(int re, RegExp* regexp)
{
- return makeUString(regexpToSourceString(regexp), "(@re", UString::number(re), ")").utf8();
+ return makeString(regexpToSourceString(regexp), "(@re", String::number(re), ")").utf8();
}
-static UString pointerToSourceString(void* p)
+static String pointerToSourceString(void* p)
{
char buffer[2 + 2 * sizeof(void*) + 1]; // 0x [two characters per byte] \0
snprintf(buffer, sizeof(buffer), "%p", p);
continue;
ASSERT(!((i + m_rareData->m_characterSwitchJumpTables[i].min) & ~0xFFFF));
UChar ch = static_cast<UChar>(entry + m_rareData->m_characterSwitchJumpTables[i].min);
- dataLog("\t\t\"%s\" => %04d\n", UString(&ch, 1).utf8().data(), *iter);
+ dataLog("\t\t\"%s\" => %04d\n", String(&ch, 1).utf8().data(), *iter);
}
dataLog(" }\n");
++i;
dataLog(" %1d = {\n", i);
StringJumpTable::StringOffsetTable::const_iterator end = m_rareData->m_stringSwitchJumpTables[i].offsetTable.end();
for (StringJumpTable::StringOffsetTable::const_iterator iter = m_rareData->m_stringSwitchJumpTables[i].offsetTable.begin(); iter != end; ++iter)
- dataLog("\t\t\"%s\" => %04d\n", UString(iter->first).utf8().data(), iter->second.branchOffset);
+ dataLog("\t\t\"%s\" => %04d\n", String(iter->first).utf8().data(), iter->second.branchOffset);
dataLog(" }\n");
++i;
} while (i < m_rareData->m_stringSwitchJumpTables.size());
return false;
}
-UString CodeBlock::nameForRegister(int registerNumber)
+String CodeBlock::nameForRegister(int registerNumber)
{
SymbolTable::iterator end = m_symbolTable->end();
for (SymbolTable::iterator ptr = m_symbolTable->begin(); ptr != end; ++ptr) {
if (ptr->second.getIndex() == registerNumber)
- return UString(ptr->first);
+ return String(ptr->first);
}
if (needsActivation() && registerNumber == activationRegister())
return "activation";
#include "Nodes.h"
#include "RegExpObject.h"
#include "StructureStubInfo.h"
-#include "UString.h"
#include "UnconditionalFinalizer.h"
#include "ValueProfile.h"
#include "Watchpoint.h"
#include <wtf/RefPtr.h>
#include <wtf/SegmentedVector.h>
#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
// Set ENABLE_BYTECODE_COMMENTS to 1 to enable recording bytecode generator
// comments for the bytecodes that it generates. This will allow
void clearEvalCache();
- UString nameForRegister(int registerNumber);
+ String nameForRegister(int registerNumber);
void addPropertyAccessInstruction(unsigned propertyAccessInstruction)
{
#include "Nodes.h"
#include "Parser.h"
#include "SourceCode.h"
-#include "UString.h"
#include <wtf/HashMap.h>
#include <wtf/RefPtr.h>
#include <wtf/text/StringHash.h>
class EvalCodeCache {
public:
- EvalExecutable* tryGet(bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain)
+ EvalExecutable* tryGet(bool inStrictContext, const String& evalSource, ScopeChainNode* scopeChain)
{
if (!inStrictContext && evalSource.length() < maxCacheableSourceLength && scopeChain->begin()->isVariableObject())
return m_cacheMap.get(evalSource.impl()).get();
return 0;
}
- EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
{
EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext);
exceptionValue = evalExecutable->compile(exec, scopeChain);
return evalExecutable;
}
- EvalExecutable* get(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const UString& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
+ EvalExecutable* get(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const String& evalSource, ScopeChainNode* scopeChain, JSValue& exceptionValue)
{
EvalExecutable* evalExecutable = tryGet(inStrictContext, evalSource, scopeChain);
#define JumpTable_h
#include "MacroAssembler.h"
-#include "UString.h"
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
#include "LowLevelInterpreter.h"
#include "ScopeChain.h"
#include "StrongInlines.h"
-#include "UString.h"
+#include <wtf/text/WTFString.h>
using namespace std;
&& src1->isTemporary()
&& m_codeBlock->isConstantRegisterIndex(src2->index())
&& m_codeBlock->constantRegister(src2->index()).get().isString()) {
- const UString& value = asString(m_codeBlock->constantRegister(src2->index()).get())->tryGetValue();
+ const String& value = asString(m_codeBlock->constantRegister(src2->index()).get())->tryGetValue();
if (value == "undefined") {
rewindUnaryOp();
emitOpcode(op_is_undefined);
return targetRegister;
}
-void BytecodeGenerator::emitThrowReferenceError(const UString& message)
+void BytecodeGenerator::emitThrowReferenceError(const String& message)
{
emitOpcode(op_throw_reference_error);
instructions().append(addConstantValue(jsString(globalData(), message))->index());
emitUnaryNoDstOp(op_throw, exc);
}
- void emitThrowReferenceError(const UString& message);
+ void emitThrowReferenceError(const String& message);
void emitPushNewScope(RegisterID* dst, const Identifier& property, RegisterID* value);
#include "RegExpCache.h"
#include "RegExpObject.h"
#include "SamplingTool.h"
-#include "UStringConcatenate.h"
#include <wtf/Assertions.h>
#include <wtf/RefCountedLeakCounter.h>
#include <wtf/Threading.h>
// ------------------------------ ThrowableExpressionData --------------------------------
-RegisterID* ThrowableExpressionData::emitThrowReferenceError(BytecodeGenerator& generator, const UString& message)
+RegisterID* ThrowableExpressionData::emitThrowReferenceError(BytecodeGenerator& generator, const String& message)
{
generator.emitExpressionInfo(divot(), startOffset(), endOffset());
generator.emitThrowReferenceError(message);
typeForTable = SwitchNeither;
break;
}
- const UString& value = static_cast<StringNode*>(clauseExpression)->value().ustring();
+ const String& value = static_cast<StringNode*>(clauseExpression)->value().ustring();
if (singleCharacterSwitch &= value.length() == 1) {
int32_t intVal = value[0];
if (intVal < min_num)
// JavaScript in the inspector.
SourceProviderMap::const_iterator end = m_sourceProviders.end();
for (SourceProviderMap::const_iterator iter = m_sourceProviders.begin(); iter != end; ++iter)
- m_debugger->sourceParsed(iter->second, iter->first, -1, UString());
+ m_debugger->sourceParsed(iter->second, iter->first, -1, String());
}
inline void Recompiler::operator()(JSCell* cell)
globalData->heap.objectSpace().forEachCell(recompiler);
}
-JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject)
+JSValue evaluateInGlobalCallFrame(const String& script, JSValue& exception, JSGlobalObject* globalObject)
{
CallFrame* globalCallFrame = globalObject->globalExec();
JSGlobalData& globalData = globalObject->globalData();
class JSGlobalObject;
class JSValue;
class SourceProvider;
- class UString;
class JS_EXPORT_PRIVATE Debugger {
public:
void attach(JSGlobalObject*);
virtual void detach(JSGlobalObject*);
- virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const UString& errorMessage) = 0;
+ virtual void sourceParsed(ExecState*, SourceProvider*, int errorLineNumber, const WTF::String& errorMessage) = 0;
virtual void exception(const DebuggerCallFrame&, intptr_t, int, int, bool) = 0;
virtual void atStatement(const DebuggerCallFrame&, intptr_t, int, int) = 0;
};
// This function exists only for backwards compatibility with existing WebScriptDebugger clients.
- JS_EXPORT_PRIVATE JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*);
+ JS_EXPORT_PRIVATE JSValue evaluateInGlobalCallFrame(const WTF::String&, JSValue& exception, JSGlobalObject*);
} // namespace JSC
visitor.append(&thisObject->m_activation);
}
-UString DebuggerActivation::className(const JSObject* object)
+String DebuggerActivation::className(const JSObject* object)
{
const DebuggerActivation* thisObject = jsCast<const DebuggerActivation*>(object);
return thisObject->m_activation->methodTable()->className(thisObject->m_activation.get());
}
static void visitChildren(JSCell*, SlotVisitor&);
- static UString className(const JSObject*);
+ static String className(const JSObject*);
static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
static void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
namespace JSC {
-const UString* DebuggerCallFrame::functionName() const
+const String* DebuggerCallFrame::functionName() const
{
if (!m_callFrame->codeBlock())
return 0;
return &jsCast<JSFunction*>(function)->name(m_callFrame);
}
-UString DebuggerCallFrame::calculatedFunctionName() const
+String DebuggerCallFrame::calculatedFunctionName() const
{
if (!m_callFrame->codeBlock())
- return UString();
+ return String();
JSObject* function = m_callFrame->callee();
if (!function)
- return UString();
+ return String();
return getCalculatedDisplayName(m_callFrame, function);
}
return asObject(thisValue);
}
-JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const
+JSValue DebuggerCallFrame::evaluate(const String& script, JSValue& exception) const
{
if (!m_callFrame->codeBlock())
return JSValue();
CallFrame* callFrame() const { return m_callFrame; }
JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); }
ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); }
- JS_EXPORT_PRIVATE const UString* functionName() const;
- JS_EXPORT_PRIVATE UString calculatedFunctionName() const;
+ JS_EXPORT_PRIVATE const String* functionName() const;
+ JS_EXPORT_PRIVATE String calculatedFunctionName() const;
JS_EXPORT_PRIVATE Type type() const;
JS_EXPORT_PRIVATE JSObject* thisObject() const;
- JS_EXPORT_PRIVATE JSValue evaluate(const UString&, JSValue& exception) const;
+ JS_EXPORT_PRIVATE JSValue evaluate(const String&, JSValue& exception) const;
JSValue exception() const { return m_exception; }
private:
Handle<JSObject> asObject() const;
bool isObject() const { return jsValue().isObject(); }
bool getNumber(double number) const { return jsValue().getNumber(number); }
- UString getString(ExecState*) const;
+ WTF::String getString(ExecState*) const;
bool isUndefinedOrNull() const { return jsValue().isUndefinedOrNull(); }
private:
class LLIntOffsetsExtractor;
class MarkedArgumentBuffer;
class RegisterFile;
- class UString;
class WeakGCHandlePool;
class SlotVisitor;
- typedef std::pair<JSValue, UString> ValueStringPair;
+ typedef std::pair<JSValue, WTF::String> ValueStringPair;
typedef HashCountedSet<JSCell*> ProtectCountSet;
typedef HashCountedSet<const char*> TypeCountSet;
#include "ScopeChain.h"
#include "SlotVisitorInlineMethods.h"
#include "Structure.h"
-#include "UString.h"
#include "WriteBarrier.h"
#include <wtf/Atomics.h>
#include <wtf/DataLog.h>
{
int signedLineNumber;
intptr_t sourceID;
- UString urlString;
+ String urlString;
JSValue function;
interpreter()->retrieveLastCaller(this, signedLineNumber, sourceID, urlString, function);
#include "SamplingTool.h"
#include "StrictEvalActivation.h"
#include "StrongInlines.h"
-#include "UStringConcatenate.h"
#include <limits.h>
#include <stdio.h>
#include <wtf/Threading.h>
return program;
TopCallFrameSetter topCallFrame(callFrame->globalData(), callFrame);
- UString programSource = asString(program)->value(callFrame);
+ String programSource = asString(program)->value(callFrame);
if (callFrame->hadException())
return JSValue();
while (it < end) {
JSValue v = it->jsValue();
int registerNumber = it - callFrame->registers();
- UString name = codeBlock->nameForRegister(registerNumber);
+ String name = codeBlock->nameForRegister(registerNumber);
#if USE(JSVALUE32_64)
dataLog("[r% 3d %14s] | %10p | %-16s 0x%llx \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v));
#else
do {
JSValue v = it->jsValue();
int registerNumber = it - callFrame->registers();
- UString name = codeBlock->nameForRegister(registerNumber);
+ String name = codeBlock->nameForRegister(registerNumber);
#if USE(JSVALUE32_64)
dataLog("[r% 3d %14s] | %10p | %-16s 0x%llx \n", registerNumber, name.ascii().data(), it, v.description(), JSValue::encode(v));
#else
if (!jsMessage || !jsMessage.isString())
return;
- UString message = asString(jsMessage)->value(callFrame);
+ String message = asString(jsMessage)->value(callFrame);
if (expressionStart < expressionStop)
- message = makeUString(message, " (evaluating '", codeBlock->source()->getRange(expressionStart, expressionStop), "')");
+ message = makeString(message, " (evaluating '", codeBlock->source()->getRange(expressionStart, expressionStop), "')");
else {
// No range information, so give a few characters of context
const StringImpl* data = codeBlock->source()->data();
stop++;
while (stop > expressionStart && isStrWhiteSpace((*data)[stop - 1]))
stop--;
- message = makeUString(message, " (near '...", codeBlock->source()->getRange(start, stop), "...')");
+ message = makeString(message, " (near '...", codeBlock->source()->getRange(start, stop), "...')");
}
exception->putDirect(*globalData, globalData->propertyNames->message, jsString(globalData, message));
return callerFrame;
}
-static ALWAYS_INLINE const UString getSourceURLFromCallFrame(CallFrame* callFrame)
+static ALWAYS_INLINE const String getSourceURLFromCallFrame(CallFrame* callFrame)
{
ASSERT(!callFrame->hasHostCallFrameFlag());
#if ENABLE(CLASSIC_INTERPRETER)
callFrame = callFrame->trueCallFrameFromVMCode();
while (callFrame && callFrame != CallFrame::noCaller()) {
- UString sourceURL;
+ String sourceURL;
if (callFrame->codeBlock()) {
sourceURL = getSourceURLFromCallFrame(callFrame);
StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), getStackFrameCodeType(callFrame), Strong<ExecutableBase>(*globalData, callFrame->codeBlock()->ownerExecutable()), line, sourceURL};
results.append(s);
} else {
- StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), -1, UString()};
+ StackFrame s = { Strong<JSObject>(*globalData, callFrame->callee()), StackFrameNativeCode, Strong<ExecutableBase>(), -1, String()};
results.append(s);
}
unsigned unusedBytecodeOffset = 0;
builder.append('\n');
}
- error->putDirect(*globalData, globalData->propertyNames->stack, jsString(globalData, UString(builder.toString().impl())), ReadOnly | DontDelete);
+ error->putDirect(*globalData, globalData->propertyNames->stack, jsString(globalData, builder.toString()), ReadOnly | DontDelete);
}
NEVER_INLINE HandlerInfo* Interpreter::throwException(CallFrame*& callFrame, JSValue& exceptionValue, unsigned bytecodeOffset)
DynamicGlobalObjectScope globalObjectScope(*scopeChain->globalData, scopeChain->globalObject.get());
Vector<JSONPData> JSONPData;
bool parseResult;
- const UString programSource = program->source().toString();
+ const String programSource = program->source().toString();
if (programSource.isNull())
return jsUndefined();
if (programSource.is8Bit()) {
original constructor, using constant message as the
message string. The result is thrown.
*/
- UString message = callFrame->r(vPC[1].u.operand).jsValue().toString(callFrame)->value(callFrame);
+ String message = callFrame->r(vPC[1].u.operand).jsValue().toString(callFrame)->value(callFrame);
exceptionValue = JSValue(createReferenceError(callFrame, message));
goto vm_throw;
}
return caller;
}
-void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const
+void Interpreter::retrieveLastCaller(CallFrame* callFrame, int& lineNumber, intptr_t& sourceID, String& sourceURL, JSValue& function) const
{
function = JSValue();
lineNumber = -1;
- sourceURL = UString();
+ sourceURL = String();
CallFrame* callerFrame = callFrame->callerFrame();
if (callerFrame->hasHostCallFrameFlag())
StackFrameCodeType codeType;
Strong<ExecutableBase> executable;
int line;
- UString sourceURL;
- UString toString(CallFrame* callFrame) const
+ String sourceURL;
+ String toString(CallFrame* callFrame) const
{
StringBuilder traceBuild;
String functionName = friendlyFunctionName(callFrame);
JSValue retrieveArgumentsFromVMCode(CallFrame*, JSFunction*) const;
JSValue retrieveCallerFromVMCode(CallFrame*, JSFunction*) const;
- JS_EXPORT_PRIVATE void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, UString& sourceURL, JSValue& function) const;
+ JS_EXPORT_PRIVATE void retrieveLastCaller(CallFrame*, int& lineNumber, intptr_t& sourceID, String& sourceURL, JSValue& function) const;
void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc);
NEVER_INLINE HandlerInfo* throwException(CallFrame*&, JSValue&, unsigned bytecodeOffset);
NEVER_INLINE void debug(CallFrame*, DebugHookID, int firstLine, int lastLine, int column);
- static const UString getTraceLine(CallFrame*, StackFrameCodeType, const UString&, int);
+ static const String getTraceLine(CallFrame*, StackFrameCodeType, const String&, int);
JS_EXPORT_PRIVATE static void getStackTrace(JSGlobalData*, Vector<StackFrame>& results);
static void addStackTraceIfNecessary(CallFrame*, JSObject* error);
STUB_INIT_STACK_FRAME(stackFrame);
CallFrame* callFrame = stackFrame.callFrame;
- UString message = stackFrame.args[0].jsValue().toString(callFrame)->value(callFrame);
+ String message = stackFrame.args[0].jsValue().toString(callFrame)->value(callFrame);
stackFrame.globalData->exception = createReferenceError(callFrame, message);
VM_THROW_EXCEPTION_AT_END();
}
using namespace JSC;
using namespace WTF;
-static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer);
+static bool fillBufferWithContentsOfFile(const String& fileName, Vector<char>& buffer);
static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
bool m_dump;
bool m_exitCode;
Vector<Script> m_scripts;
- Vector<UString> m_arguments;
+ Vector<String> m_arguments;
void parseArguments(int, char**);
};
public:
typedef JSGlobalObject Base;
- static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<UString>& arguments)
+ static GlobalObject* create(JSGlobalData& globalData, Structure* structure, const Vector<String>& arguments)
{
GlobalObject* object = new (NotNull, allocateCell<GlobalObject>(globalData.heap)) GlobalObject(globalData, structure);
object->finishCreation(globalData, arguments);
static bool javaScriptExperimentsEnabled(const JSGlobalObject*) { return true; }
protected:
- void finishCreation(JSGlobalData& globalData, const Vector<UString>& arguments)
+ void finishCreation(JSGlobalData& globalData, const Vector<String>& arguments)
{
Base::finishCreation(globalData);
{
}
-static inline SourceCode jscSource(const char* utf8, const UString& filename)
+static inline SourceCode jscSource(const char* utf8, const String& filename)
{
// Find the the first non-ascii character, or nul.
const char* pos = utf8;
// Fast case - string is all ascii.
if (!*pos)
- return makeSource(UString(utf8, asciiLength), filename);
+ return makeSource(String(utf8, asciiLength), filename);
// Slow case - contains non-ascii characters, use fromUTF8WithLatin1Fallback.
ASSERT(*pos < 0);
EncodedJSValue JSC_HOST_CALL functionRun(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec)->value(exec);
+ String fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
- GlobalObject* globalObject = GlobalObject::create(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), Vector<UString>());
+ GlobalObject* globalObject = GlobalObject::create(exec->globalData(), GlobalObject::createStructure(exec->globalData(), jsNull()), Vector<String>());
JSValue exception;
StopWatch stopWatch;
EncodedJSValue JSC_HOST_CALL functionLoad(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec)->value(exec);
+ String fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState* exec)
{
- UString fileName = exec->argument(0).toString(exec)->value(exec);
+ String fileName = exec->argument(0).toString(exec)->value(exec);
Vector<char> script;
if (!fillBufferWithContentsOfFile(fileName, script))
return JSValue::encode(throwError(exec, createError(exec, "Could not open file.")));
static bool runWithScripts(GlobalObject* globalObject, const Vector<Script>& scripts, bool dump)
{
const char* script;
- UString fileName;
+ String fileName;
Vector<char> scriptBuffer;
if (dump)
static void runInteractive(GlobalObject* globalObject)
{
- UString interpreterName("Interpreter");
+ String interpreterName("Interpreter");
while (true) {
#if HAVE(READLINE) && !RUNNING_FROM_XCODE
return result;
}
-static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer)
+static bool fillBufferWithContentsOfFile(const String& fileName, Vector<char>& buffer)
{
FILE* f = fopen(fileName.utf8().data(), "r");
if (!f) {
}
template <typename T>
-UString Lexer<T>::invalidCharacterMessage() const
+String Lexer<T>::invalidCharacterMessage() const
{
switch (m_current) {
case 0:
m_error = false;
m_atLineStart = true;
m_columnNumber = 0;
- m_lexErrorMessage = UString();
+ m_lexErrorMessage = String();
m_buffer8.reserveInitialCapacity(initialReadBufferCapacity);
m_buffer16.reserveInitialCapacity((m_codeEnd - m_code) / 2);
// Functions for use after parsing.
bool sawError() const { return m_error; }
- UString getErrorMessage() const { return m_lexErrorMessage; }
+ String getErrorMessage() const { return m_lexErrorMessage; }
void clear();
void setOffset(int offset)
{
m_error = 0;
- m_lexErrorMessage = UString();
+ m_lexErrorMessage = String();
m_code = m_codeStart + offset;
m_buffer8.resize(0);
m_buffer16.resize(0);
int parseFourDigitUnicodeHex();
void shiftLineTerminator();
- UString invalidCharacterMessage() const;
+ String invalidCharacterMessage() const;
ALWAYS_INLINE const T* currentCharacter() const;
ALWAYS_INLINE int currentOffset() const { return m_code - m_codeStart; }
ALWAYS_INLINE void setOffsetFromCharOffset(const T* charOffset) { setOffset(charOffset - m_codeStart); }
bool m_isReparsing;
bool m_atLineStart;
bool m_error;
- UString m_lexErrorMessage;
+ String m_lexErrorMessage;
T m_current;
uint16_t endOffset() const { return m_endOffset; }
protected:
- RegisterID* emitThrowReferenceError(BytecodeGenerator&, const UString& message);
+ RegisterID* emitThrowReferenceError(BytecodeGenerator&, const String& message);
private:
uint32_t m_divot;
}
const SourceCode& source() const { return m_source; }
- const UString& sourceURL() const { return m_source.provider()->url(); }
+ const String& sourceURL() const { return m_source.provider()->url(); }
intptr_t sourceID() const { return m_source.providerID(); }
void setFeatures(CodeFeatures features) { m_features = features; }
}
template <typename LexerType>
-UString Parser<LexerType>::parseInner()
+String Parser<LexerType>::parseInner()
{
- UString parseError = UString();
+ String parseError = String();
unsigned oldFunctionCacheSize = m_functionCache ? m_functionCache->byteSize() : 0;
ASTBuilder context(const_cast<JSGlobalData*>(m_globalData), const_cast<SourceCode*>(m_source));
class JSGlobalData;
class ProgramNode;
class SourceCode;
-class UString;
#define fail() do { if (!m_error) updateErrorMessage(); return 0; } while (0)
#define failWithToken(tok) do { if (!m_error) updateErrorMessage(tok); return 0; } while (0)
}
Parser();
- UString parseInner();
+ String parseInner();
void didFinishParsing(SourceElements*, ParserArenaData<DeclarationStacks::VarStack>*,
ParserArenaData<DeclarationStacks::FunctionStack>*, CodeFeatures,
return result;
}
- ALWAYS_INLINE UString getToken() {
+ ALWAYS_INLINE String getToken() {
SourceProvider* sourceProvider = m_source->provider();
- return UString(sourceProvider->getRange(tokenStart(), tokenEnd()).impl());
+ return sourceProvider->getRange(tokenStart(), tokenEnd());
}
ALWAYS_INLINE bool match(JSTokenType expected)
if (!name)
updateErrorMessageSpecialCase(m_token.m_type);
else
- m_errorMessage = UString(String::format("Unexpected token '%s'", name).impl());
+ m_errorMessage = String::format("Unexpected token '%s'", name);
}
NEVER_INLINE void updateErrorMessage(JSTokenType expectedToken)
m_error = true;
const char* name = getTokenName(expectedToken);
if (name)
- m_errorMessage = UString(String::format("Expected token '%s'", name).impl());
+ m_errorMessage = String::format("Expected token '%s'", name);
else {
if (!getTokenName(m_token.m_type))
updateErrorMessageSpecialCase(m_token.m_type);
}
}
- NEVER_INLINE void updateErrorWithNameAndMessage(const char* beforeMsg, UString name, const char* afterMsg)
+ NEVER_INLINE void updateErrorWithNameAndMessage(const char* beforeMsg, String name, const char* afterMsg)
{
m_error = true;
String prefix(beforeMsg);
NEVER_INLINE void updateErrorMessage(const char* msg)
{
m_error = true;
- m_errorMessage = UString(msg);
+ m_errorMessage = String(msg);
}
void startLoop() { currentScope()->startLoop(); }
StackBounds m_stack;
bool m_error;
- UString m_errorMessage;
+ String m_errorMessage;
JSToken m_token;
bool m_allowsIn;
int m_lastLine;
ASSERT(lexicalGlobalObject);
ASSERT(exception && !*exception);
int errLine;
- UString errMsg;
+ String errMsg;
if (ParsedNode::scopeIsFunction)
m_lexer->setIsReparsing();
m_sourceElements = 0;
errLine = -1;
- errMsg = UString();
+ errMsg = String();
- UString parseError = parseInner();
+ String parseError = parseInner();
int lineNumber = m_lexer->lineNumber();
bool lexError = m_lexer->sawError();
- UString lexErrorMessage = lexError ? m_lexer->getErrorMessage() : UString();
+ String lexErrorMessage = lexError ? m_lexer->getErrorMessage() : String();
ASSERT(lexErrorMessage.isNull() != lexError);
m_lexer->clear();
inline const Identifier& IdentifierArena::makeNumericIdentifier(JSGlobalData* globalData, double number)
{
- m_identifiers.append(Identifier(globalData, UString::numberToStringECMAScript(number)));
+ m_identifiers.append(Identifier(globalData, String::numberToStringECMAScript(number)));
return m_identifiers.last();
}
{
}
- UString toString() const
+ String toString() const
{
if (!m_provider)
- return UString();
+ return String();
return m_provider->getRange(m_startChar, m_endChar);
}
int m_firstLine;
};
- inline SourceCode makeSource(const UString& source, const UString& url = UString(), const TextPosition& startPosition = TextPosition::minimumPosition())
+ inline SourceCode makeSource(const String& source, const String& url = String(), const TextPosition& startPosition = TextPosition::minimumPosition())
{
- return SourceCode(UStringSourceProvider::create(source, url, startPosition), startPosition.m_line.oneBasedInt());
+ return SourceCode(StringSourceProvider::create(source, url, startPosition), startPosition.m_line.oneBasedInt());
}
inline SourceCode SourceCode::subExpression(unsigned openBrace, unsigned closeBrace, int firstLine)
#define SourceProvider_h
#include "SourceProviderCache.h"
-#include "UString.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/UnusedParam.h>
public:
static const intptr_t nullID = 1;
- SourceProvider(const UString& url, const TextPosition& startPosition, SourceProviderCache* cache = 0)
+ SourceProvider(const String& url, const TextPosition& startPosition, SourceProviderCache* cache = 0)
: m_url(url)
, m_startPosition(startPosition)
, m_validated(false)
delete m_cache;
}
- virtual UString getRange(int start, int end) const = 0;
+ virtual String getRange(int start, int end) const = 0;
virtual const StringImpl* data() const = 0;
virtual int length() const = 0;
- const UString& url() { return m_url; }
+ const String& url() { return m_url; }
TextPosition startPosition() const { return m_startPosition; }
intptr_t asID()
{
private:
virtual void cacheSizeChanged(int delta) { UNUSED_PARAM(delta); }
- UString m_url;
+ String m_url;
TextPosition m_startPosition;
bool m_validated;
SourceProviderCache* m_cache;
bool m_cacheOwned;
};
- class UStringSourceProvider : public SourceProvider {
+ class StringSourceProvider : public SourceProvider {
public:
- static PassRefPtr<UStringSourceProvider> create(const UString& source, const UString& url, const TextPosition& startPosition = TextPosition::minimumPosition())
+ static PassRefPtr<StringSourceProvider> create(const String& source, const String& url, const TextPosition& startPosition = TextPosition::minimumPosition())
{
- return adoptRef(new UStringSourceProvider(source, url, startPosition));
+ return adoptRef(new StringSourceProvider(source, url, startPosition));
}
- virtual UString getRange(int start, int end) const OVERRIDE
+ virtual String getRange(int start, int end) const OVERRIDE
{
return m_source.substringSharingImpl(start, end - start);
}
int length() const { return m_source.length(); }
private:
- UStringSourceProvider(const UString& source, const UString& url, const TextPosition& startPosition)
+ StringSourceProvider(const String& source, const String& url, const TextPosition& startPosition)
: SourceProvider(url, startPosition)
, m_source(source)
{
}
- UString m_source;
+ String m_source;
};
} // namespace JSC
#ifndef CallIdentifier_h
#define CallIdentifier_h
-#include <runtime/UString.h>
#include <wtf/text/CString.h>
#include <wtf/text/StringHash.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
struct CallIdentifier {
WTF_MAKE_FAST_ALLOCATED;
public:
- UString m_name;
- UString m_url;
+ String m_name;
+ String m_url;
unsigned m_lineNumber;
CallIdentifier()
{
}
- CallIdentifier(const UString& name, const UString& url, int lineNumber)
+ CallIdentifier(const String& name, const String& url, int lineNumber)
: m_name(name)
, m_url(!url.isNull() ? url : "")
, m_lineNumber(lineNumber)
template<> struct HashTraits<JSC::CallIdentifier> : GenericHashTraits<JSC::CallIdentifier> {
static void constructDeletedValue(JSC::CallIdentifier& slot)
{
- new (NotNull, &slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits<unsigned>::max());
+ new (NotNull, &slot) JSC::CallIdentifier(String(), String(), std::numeric_limits<unsigned>::max());
}
static bool isDeletedValue(const JSC::CallIdentifier& value)
{
namespace JSC {
-PassRefPtr<Profile> Profile::create(const UString& title, unsigned uid)
+PassRefPtr<Profile> Profile::create(const String& title, unsigned uid)
{
return adoptRef(new Profile(title, uid));
}
-Profile::Profile(const UString& title, unsigned uid)
+Profile::Profile(const String& title, unsigned uid)
: m_title(title)
, m_uid(uid)
{
// FIXME: When multi-threading is supported this will be a vector and calls
// into the profiler will need to know which thread it is executing on.
- m_head = ProfileNode::create(0, CallIdentifier("Thread_1", UString(), 0), 0, 0);
+ m_head = ProfileNode::create(0, CallIdentifier("Thread_1", String(), 0), 0, 0);
}
Profile::~Profile()
std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator);
for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it)
- dataLog(" %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
+ dataLog(" %-12d%s\n", (*it).second, String((*it).first).utf8().data());
dataLog("\nSort by top of stack, same collapsed (when >= 5):\n");
}
#define Profile_h
#include "ProfileNode.h"
-#include <runtime/UString.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
class Profile : public RefCounted<Profile> {
public:
- static PassRefPtr<Profile> create(const UString& title, unsigned uid);
+ static PassRefPtr<Profile> create(const String& title, unsigned uid);
virtual ~Profile();
- const UString& title() const { return m_title; }
+ const String& title() const { return m_title; }
ProfileNode* head() const { return m_head.get(); }
void setHead(PassRefPtr<ProfileNode> head) { m_head = head; }
double totalTime() const { return m_head->totalTime(); }
#endif
protected:
- Profile(const UString& title, unsigned uid);
+ Profile(const String& title, unsigned uid);
private:
void removeProfileStart();
void removeProfileEnd();
- UString m_title;
+ String m_title;
RefPtr<ProfileNode> m_head;
unsigned int m_uid;
};
static const char* NonJSExecution = "(idle)";
-PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const UString& title, unsigned uid)
+PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const String& title, unsigned uid)
{
return adoptRef(new ProfileGenerator(exec, title, uid));
}
-ProfileGenerator::ProfileGenerator(ExecState* exec, const UString& title, unsigned uid)
+ProfileGenerator::ProfileGenerator(ExecState* exec, const String& title, unsigned uid)
: m_origin(exec ? exec->lexicalGlobalObject() : 0)
, m_profileGroup(exec ? exec->lexicalGlobalObject()->profileGroup() : 0)
{
{
int lineNumber;
intptr_t sourceID;
- UString sourceURL;
+ String sourceURL;
JSValue function;
exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function);
m_head->insertNode(m_currentNode.get());
}
-const UString& ProfileGenerator::title() const
+const String& ProfileGenerator::title() const
{
return m_profile->title();
}
m_currentNode = m_currentNode->parent();
if (double headSelfTime = m_head->selfTime()) {
- RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get());
+ RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, String(), 0), m_head.get(), m_head.get());
idleNode->setTotalTime(headSelfTime);
idleNode->setSelfTime(headSelfTime);
class JSGlobalObject;
class Profile;
class ProfileNode;
- class UString;
struct CallIdentifier;
class ProfileGenerator : public RefCounted<ProfileGenerator> {
public:
- static PassRefPtr<ProfileGenerator> create(ExecState*, const UString& title, unsigned uid);
+ static PassRefPtr<ProfileGenerator> create(ExecState*, const WTF::String& title, unsigned uid);
// Members
- const UString& title() const;
+ const WTF::String& title() const;
PassRefPtr<Profile> profile() const { return m_profile; }
JSGlobalObject* origin() const { return m_origin; }
unsigned profileGroup() const { return m_profileGroup; }
typedef void (ProfileGenerator::*ProfileFunction)(ExecState* callerOrHandlerCallFrame, const CallIdentifier& callIdentifier);
private:
- ProfileGenerator(ExecState*, const UString& title, unsigned uid);
+ ProfileGenerator(ExecState*, const WTF::String& title, unsigned uid);
void addParentForConsoleStart(ExecState*);
void removeProfileStart();
// CallIdentifier members
ExecState* callerCallFrame() const { return m_callerCallFrame; }
const CallIdentifier& callIdentifier() const { return m_callIdentifier; }
- const UString& functionName() const { return m_callIdentifier.m_name; }
- const UString& url() const { return m_callIdentifier.m_url; }
+ const String& functionName() const { return m_callIdentifier.m_name; }
+ const String& url() const { return m_callIdentifier.m_url; }
unsigned lineNumber() const { return m_callIdentifier.m_lineNumber; }
// Relationships
static inline bool selfTimeAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->selfTime() < b->selfTime(); }
static inline bool callsDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() > b->numberOfCalls(); }
static inline bool callsAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() < b->numberOfCalls(); }
- static inline bool functionNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() > b->functionName(); }
- static inline bool functionNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() < b->functionName(); }
+ static inline bool functionNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return codePointCompareLessThan(b->functionName(), a->functionName()); }
+ static inline bool functionNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return codePointCompareLessThan(a->functionName(), b->functionName()); }
ExecState* m_callerCallFrame;
CallIdentifier m_callIdentifier;
#include "Profile.h"
#include "ProfileGenerator.h"
#include "ProfileNode.h"
-#include "UStringConcatenate.h"
#include <stdio.h>
namespace JSC {
static const char* AnonymousFunction = "(anonymous function)";
static unsigned ProfilesUID = 0;
-static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSObject*, const UString& defaultSourceURL, int defaultLineNumber);
+static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSObject*, const String& defaultSourceURL, int defaultLineNumber);
Profiler* Profiler::s_sharedProfiler = 0;
return s_sharedProfiler;
}
-void Profiler::startProfiling(ExecState* exec, const UString& title)
+void Profiler::startProfiling(ExecState* exec, const String& title)
{
ASSERT_ARG(title, !title.isNull());
m_currentProfiles.append(profileGenerator);
}
-PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title)
+PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const String& title)
{
JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0;
for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup());
}
-void Profiler::willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber)
+void Profiler::willExecute(ExecState* callerCallFrame, const String& sourceURL, int startingLineNumber)
{
ASSERT(!m_currentProfiles.isEmpty());
dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup());
}
-void Profiler::didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber)
+void Profiler::didExecute(ExecState* callerCallFrame, const String& sourceURL, int startingLineNumber)
{
ASSERT(!m_currentProfiles.isEmpty());
dispatchFunctionToProfiles(handlerCallFrame, m_currentProfiles, &ProfileGenerator::exceptionUnwind, createCallIdentifier(handlerCallFrame, JSValue(), "", 0), handlerCallFrame->lexicalGlobalObject()->profileGroup());
}
-CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const UString& defaultSourceURL, int defaultLineNumber)
+CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const String& defaultSourceURL, int defaultLineNumber)
{
if (!functionValue)
return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber);
return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
if (asObject(functionValue)->inherits(&JSFunction::s_info) || asObject(functionValue)->inherits(&InternalFunction::s_info))
return createCallIdentifierFromFunctionImp(exec, asObject(functionValue), defaultSourceURL, defaultLineNumber);
- return CallIdentifier(makeUString("(", asObject(functionValue)->methodTable()->className(asObject(functionValue)), " object)"), defaultSourceURL, defaultLineNumber);
+ return CallIdentifier(makeString("(", asObject(functionValue)->methodTable()->className(asObject(functionValue)), " object)"), defaultSourceURL, defaultLineNumber);
}
-CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSObject* function, const UString& defaultSourceURL, int defaultLineNumber)
+CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSObject* function, const String& defaultSourceURL, int defaultLineNumber)
{
- const UString& name = getCalculatedDisplayName(exec, function);
+ const String& name = getCalculatedDisplayName(exec, function);
JSFunction* jsFunction = jsDynamicCast<JSFunction*>(function);
if (jsFunction && !jsFunction->isHostFunction())
return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, jsFunction->jsExecutable()->sourceURL(), jsFunction->jsExecutable()->lineNo());
class JSObject;
class JSValue;
class ProfileGenerator;
- class UString;
- struct CallIdentifier;
+ struct CallIdentifier;
class Profiler {
WTF_MAKE_FAST_ALLOCATED;
public:
JS_EXPORT_PRIVATE static Profiler* profiler();
- static CallIdentifier createCallIdentifier(ExecState* exec, JSValue, const UString& sourceURL, int lineNumber);
+ static CallIdentifier createCallIdentifier(ExecState*, JSValue, const WTF::String& sourceURL, int lineNumber);
- JS_EXPORT_PRIVATE void startProfiling(ExecState*, const UString& title);
- JS_EXPORT_PRIVATE PassRefPtr<Profile> stopProfiling(ExecState*, const UString& title);
+ JS_EXPORT_PRIVATE void startProfiling(ExecState*, const WTF::String& title);
+ JS_EXPORT_PRIVATE PassRefPtr<Profile> stopProfiling(ExecState*, const WTF::String& title);
void stopProfiling(JSGlobalObject*);
void willExecute(ExecState* callerCallFrame, JSValue function);
- void willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber);
+ void willExecute(ExecState* callerCallFrame, const WTF::String& sourceURL, int startingLineNumber);
void didExecute(ExecState* callerCallFrame, JSValue function);
- void didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber);
+ void didExecute(ExecState* callerCallFrame, const WTF::String& sourceURL, int startingLineNumber);
void exceptionUnwind(ExecState* handlerCallFrame);
return true;
}
- return JSObject::getOwnPropertySlot(thisObject, exec, Identifier(exec, UString::number(i)), slot);
+ return JSObject::getOwnPropertySlot(thisObject, exec, Identifier(exec, String::number(i)), slot);
}
void Arguments::createStrictModeCallerIfNecessary(ExecState* exec)
Arguments* thisObject = jsCast<Arguments*>(object);
for (unsigned i = 0; i < thisObject->d->numArguments; ++i) {
if (!thisObject->d->deletedArguments || !thisObject->d->deletedArguments[i])
- propertyNames.add(Identifier(exec, UString::number(i)));
+ propertyNames.add(Identifier(exec, String::number(i)));
}
if (mode == IncludeDontEnumProperties) {
propertyNames.add(exec->propertyNames().callee);
}
PutPropertySlot slot(shouldThrow);
- JSObject::put(thisObject, exec, Identifier(exec, UString::number(i)), value, slot);
+ JSObject::put(thisObject, exec, Identifier(exec, String::number(i)), value, slot);
}
void Arguments::put(JSCell* cell, ExecState* exec, PropertyName propertyName, JSValue value, PutPropertySlot& slot)
}
}
- return JSObject::deleteProperty(thisObject, exec, Identifier(exec, UString::number(i)));
+ return JSObject::deleteProperty(thisObject, exec, Identifier(exec, String::number(i)));
}
bool Arguments::deleteProperty(JSCell* cell, ExecState* exec, PropertyName propertyName)
if (element.isUndefinedOrNull())
continue;
- UString str = element.toUString(exec);
+ String str = element.toWTFString(exec);
strBuffer[k] = str.impl();
totalSize += str.length();
allStrings8Bit = allStrings8Bit && str.is8Bit();
buffer.append(rep->characters8(), rep->length());
}
ASSERT(buffer.size() == totalSize);
- return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+ return JSValue::encode(jsString(exec, String::adopt(buffer)));
}
Vector<UChar> buffer;
buffer.append(rep->characters(), rep->length());
}
ASSERT(buffer.size() == totalSize);
- return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+ return JSValue::encode(jsString(exec, String::adopt(buffer)));
}
EncodedJSValue JSC_HOST_CALL arrayProtoFuncToLocaleString(ExecState* exec)
if (JSValue earlyReturnValue = checker.earlyReturnValue())
return JSValue::encode(earlyReturnValue);
- UString separator(",");
+ String separator(",", String::ConstructFromLiteral);
JSStringJoiner stringJoiner(separator, length);
for (unsigned k = 0; k < length; k++) {
JSValue element = thisObj->get(exec, k);
JSValue conversionFunction = o->get(exec, exec->propertyNames().toLocaleString);
if (exec->hadException())
return JSValue::encode(jsUndefined());
- UString str;
+ String str;
CallData callData;
CallType callType = getCallData(conversionFunction, callData);
if (callType != CallTypeNone)
- str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toUString(exec);
+ str = call(exec, conversionFunction, callType, callData, element, exec->emptyList()).toWTFString(exec);
else
- str = element.toUString(exec);
+ str = element.toWTFString(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
stringJoiner.append(str);
if (JSValue earlyReturnValue = checker.earlyReturnValue())
return JSValue::encode(earlyReturnValue);
- UString separator;
+ String separator;
if (!exec->argument(0).isUndefined())
- separator = exec->argument(0).toUString(exec);
+ separator = exec->argument(0).toWTFString(exec);
if (separator.isNull())
- separator = UString(",");
+ separator = String(",", String::ConstructFromLiteral);
JSStringJoiner stringJoiner(separator, length);
JSValue element = array->getIndex(k);
if (!element.isUndefinedOrNull())
- stringJoiner.append(element.toUStringInline(exec));
+ stringJoiner.append(element.toWTFStringInline(exec));
else
- stringJoiner.append(UString());
+ stringJoiner.append(String());
}
}
for (; k < length; k++) {
JSValue element = thisObj->get(exec, k);
if (!element.isUndefinedOrNull())
- stringJoiner.append(element.toUStringInline(exec));
+ stringJoiner.append(element.toWTFStringInline(exec));
else
- stringJoiner.append(UString());
+ stringJoiner.append(String());
}
return JSValue::encode(stringJoiner.build(exec));
thisObj->methodTable()->putByIndex(thisObj, exec, length + n, exec->argument(n), true);
else {
PutPropertySlot slot;
- Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toUString(exec));
+ Identifier propertyName(exec, JSValue(static_cast<int64_t>(length) + static_cast<int64_t>(n)).toWTFString(exec));
thisObj->methodTable()->put(thisObj, exec, propertyName, exec->argument(n), slot);
}
if (exec->hadException())
l.append(minObj);
compareResult = call(exec, function, callType, callData, jsUndefined(), l).toNumber(exec);
} else
- compareResult = (jObj.toUStringInline(exec) < minObj.toUStringInline(exec)) ? -1 : 1;
+ compareResult = codePointCompareLessThan(jObj.toWTFStringInline(exec), minObj.toWTFStringInline(exec)) ? -1 : 1;
if (compareResult < 0) {
themin = j;
typedef void (*GetPropertyNamesFunctionPtr)(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
GetPropertyNamesFunctionPtr getPropertyNames;
- typedef UString (*ClassNameFunctionPtr)(const JSObject*);
+ typedef String (*ClassNameFunctionPtr)(const JSObject*);
ClassNameFunctionPtr className;
typedef bool (*HasInstanceFunctionPtr)(JSObject*, ExecState*, JSValue, JSValue);
#include "config.h"
#include "DateConversion.h"
-#include "UString.h"
#include <wtf/Assertions.h>
#include <wtf/DateMath.h>
#include <wtf/text/StringBuilder.h>
+#include <wtf/text/WTFString.h>
#if OS(WINDOWS)
#include <windows.h>
builder.append(static_cast<char>('0' + value % 10));
}
-UString formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool asUTCVariant)
+String formatDateTime(const GregorianDateTime& t, DateTimeFormat format, bool asUTCVariant)
{
bool appendDate = format & DateTimeFormatDate;
bool appendTime = format & DateTimeFormatTime;
#include <wtf/GregorianDateTime.h>
-namespace JSC {
+namespace WTF {
+class String;
+} // namespace WTF
-class UString;
+namespace JSC {
enum DateTimeFormat {
DateTimeFormatDate = 1,
DateTimeFormatDateAndTime = DateTimeFormatDate | DateTimeFormatTime
};
-UString formatDateTime(const GregorianDateTime&, DateTimeFormat, bool asUTCVariant);
+WTF::String formatDateTime(const GregorianDateTime&, DateTimeFormat, bool asUTCVariant);
} // namespace JSC
// FIXME: Since this is superior to the strftime-based version, why limit this to PLATFORM(MAC)?
// Instead we should consider using this whenever USE(CF) is true.
-static CFDateFormatterStyle styleFromArgString(const UString& string, CFDateFormatterStyle defaultStyle)
+static CFDateFormatterStyle styleFromArgString(const String& string, CFDateFormatterStyle defaultStyle)
{
if (string == "short")
return kCFDateFormatterShortStyle;
CFDateFormatterStyle timeStyle = (format != LocaleDate ? kCFDateFormatterLongStyle : kCFDateFormatterNoStyle);
bool useCustomFormat = false;
- UString customFormatString;
+ String customFormatString;
- UString arg0String = exec->argument(0).toString(exec)->value(exec);
+ String arg0String = exec->argument(0).toString(exec)->value(exec);
if (arg0String == "custom" && !exec->argument(1).isUndefined()) {
useCustomFormat = true;
customFormatString = exec->argument(1).toString(exec)->value(exec);
CFRelease(string);
- return jsNontrivialString(exec, UString(buffer, length));
+ return jsNontrivialString(exec, String(buffer, length));
}
#elif USE(ICU_UNICODE) && !UCONFIG_NO_FORMATTING
if (status != U_ZERO_ERROR)
return jsEmptyString(exec);
- return jsNontrivialString(exec, UString(buffer, length));
+ return jsNontrivialString(exec, String(buffer, length));
}
#else
if (length)
length--;
- return jsNontrivialString(exec, UString(buffer.data(), length));
+ return jsNontrivialString(exec, String(buffer.data(), length));
#else // OS(WINDOWS)
if (length != static_cast<size_t>(-1)) {
for (size_t i = 0; i < length; ++i)
buffer[i] = static_cast<UChar>(tempbuffer[i]);
- return jsNontrivialString(exec, UString(buffer, length));
+ return jsNontrivialString(exec, String(buffer, length));
}
#endif
static const char* linePropertyName = "line";
static const char* sourceURLPropertyName = "sourceURL";
-JSObject* createError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->errorStructure(), message);
}
-JSObject* createEvalError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createEvalError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->evalErrorConstructor()->errorStructure(), message);
}
-JSObject* createRangeError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createRangeError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->rangeErrorConstructor()->errorStructure(), message);
}
-JSObject* createReferenceError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createReferenceError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->referenceErrorConstructor()->errorStructure(), message);
}
-JSObject* createSyntaxError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createSyntaxError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->syntaxErrorConstructor()->errorStructure(), message);
}
-JSObject* createTypeError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createTypeError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->typeErrorConstructor()->errorStructure(), message);
return createTypeError(globalObject, "Not enough arguments");
}
-JSObject* createURIError(JSGlobalObject* globalObject, const UString& message)
+JSObject* createURIError(JSGlobalObject* globalObject, const String& message)
{
ASSERT(!message.isEmpty());
return ErrorInstance::create(globalObject->globalData(), globalObject->URIErrorConstructor()->errorStructure(), message);
}
-JSObject* createError(ExecState* exec, const UString& message)
+JSObject* createError(ExecState* exec, const String& message)
{
return createError(exec->lexicalGlobalObject(), message);
}
-JSObject* createEvalError(ExecState* exec, const UString& message)
+JSObject* createEvalError(ExecState* exec, const String& message)
{
return createEvalError(exec->lexicalGlobalObject(), message);
}
-JSObject* createRangeError(ExecState* exec, const UString& message)
+JSObject* createRangeError(ExecState* exec, const String& message)
{
return createRangeError(exec->lexicalGlobalObject(), message);
}
-JSObject* createReferenceError(ExecState* exec, const UString& message)
+JSObject* createReferenceError(ExecState* exec, const String& message)
{
return createReferenceError(exec->lexicalGlobalObject(), message);
}
-JSObject* createSyntaxError(ExecState* exec, const UString& message)
+JSObject* createSyntaxError(ExecState* exec, const String& message)
{
return createSyntaxError(exec->lexicalGlobalObject(), message);
}
-JSObject* createTypeError(ExecState* exec, const UString& message)
+JSObject* createTypeError(ExecState* exec, const String& message)
{
return createTypeError(exec->lexicalGlobalObject(), message);
}
return createNotEnoughArgumentsError(exec->lexicalGlobalObject());
}
-JSObject* createURIError(ExecState* exec, const UString& message)
+JSObject* createURIError(ExecState* exec, const String& message)
{
return createURIError(exec->lexicalGlobalObject(), message);
}
JSObject* addErrorInfo(CallFrame* callFrame, JSObject* error, int line, const SourceCode& source)
{
JSGlobalData* globalData = &callFrame->globalData();
- const UString& sourceURL = source.provider()->url();
+ const String& sourceURL = source.provider()->url();
if (line != -1)
error->putDirect(*globalData, Identifier(globalData, linePropertyName), jsNumber(line), ReadOnly | DontDelete);
class JSObject;
class SourceCode;
class Structure;
- class UString;
// Methods to create a range of internal errors.
- JSObject* createError(JSGlobalObject*, const UString&);
- JSObject* createEvalError(JSGlobalObject*, const UString&);
- JSObject* createRangeError(JSGlobalObject*, const UString&);
- JSObject* createReferenceError(JSGlobalObject*, const UString&);
- JSObject* createSyntaxError(JSGlobalObject*, const UString&);
- JSObject* createTypeError(JSGlobalObject*, const UString&);
+ JSObject* createError(JSGlobalObject*, const String&);
+ JSObject* createEvalError(JSGlobalObject*, const String&);
+ JSObject* createRangeError(JSGlobalObject*, const String&);
+ JSObject* createReferenceError(JSGlobalObject*, const String&);
+ JSObject* createSyntaxError(JSGlobalObject*, const String&);
+ JSObject* createTypeError(JSGlobalObject*, const String&);
JSObject* createNotEnoughArgumentsError(JSGlobalObject*);
- JSObject* createURIError(JSGlobalObject*, const UString&);
+ JSObject* createURIError(JSGlobalObject*, const String&);
// ExecState wrappers.
- JS_EXPORT_PRIVATE JSObject* createError(ExecState*, const UString&);
- JSObject* createEvalError(ExecState*, const UString&);
- JS_EXPORT_PRIVATE JSObject* createRangeError(ExecState*, const UString&);
- JS_EXPORT_PRIVATE JSObject* createReferenceError(ExecState*, const UString&);
- JS_EXPORT_PRIVATE JSObject* createSyntaxError(ExecState*, const UString&);
- JS_EXPORT_PRIVATE JSObject* createTypeError(ExecState*, const UString&);
+ JS_EXPORT_PRIVATE JSObject* createError(ExecState*, const String&);
+ JSObject* createEvalError(ExecState*, const String&);
+ JS_EXPORT_PRIVATE JSObject* createRangeError(ExecState*, const String&);
+ JS_EXPORT_PRIVATE JSObject* createReferenceError(ExecState*, const String&);
+ JS_EXPORT_PRIVATE JSObject* createSyntaxError(ExecState*, const String&);
+ JS_EXPORT_PRIVATE JSObject* createTypeError(ExecState*, const String&);
JS_EXPORT_PRIVATE JSObject* createNotEnoughArgumentsError(ExecState*);
- JSObject* createURIError(ExecState*, const UString&);
+ JSObject* createURIError(ExecState*, const String&);
// Methods to add
bool hasErrorInfo(ExecState*, JSObject* error);
class StrictModeTypeErrorFunction : public InternalFunction {
private:
- StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const UString& message)
+ StrictModeTypeErrorFunction(JSGlobalObject* globalObject, Structure* structure, const String& message)
: InternalFunction(globalObject, structure)
, m_message(message)
{
public:
typedef InternalFunction Base;
- static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& message)
+ static StrictModeTypeErrorFunction* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& message)
{
StrictModeTypeErrorFunction* function = new (NotNull, allocateCell<StrictModeTypeErrorFunction>(*exec->heap())) StrictModeTypeErrorFunction(globalObject, structure, message);
function->finishCreation(exec->globalData(), "");
}
private:
- UString m_message;
+ String m_message;
};
} // namespace JSC
return Structure::create(globalData, globalObject, prototype, TypeInfo(ErrorInstanceType, StructureFlags), &s_info);
}
- static ErrorInstance* create(JSGlobalData& globalData, Structure* structure, const UString& message)
+ static ErrorInstance* create(JSGlobalData& globalData, Structure* structure, const String& message)
{
ErrorInstance* instance = new (NotNull, allocateCell<ErrorInstance>(globalData.heap)) ErrorInstance(globalData, structure);
instance->finishCreation(globalData, message);
static ErrorInstance* create(ExecState* exec, Structure* structure, JSValue message)
{
- return create(exec->globalData(), structure, message.isUndefined() ? UString() : message.toString(exec)->value(exec));
+ return create(exec->globalData(), structure, message.isUndefined() ? String() : message.toString(exec)->value(exec));
}
bool appendSourceToMessage() { return m_appendSourceToMessage; }
protected:
explicit ErrorInstance(JSGlobalData&, Structure*);
- void finishCreation(JSGlobalData& globalData, const UString& message)
+ void finishCreation(JSGlobalData& globalData, const String& message)
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
#include "JSStringBuilder.h"
#include "ObjectPrototype.h"
#include "StringRecursionChecker.h"
-#include "UString.h"
namespace JSC {
return JSValue::encode(jsUndefined());
// 4. If name is undefined, then let name be "Error"; else let name be ToString(name).
- UString nameString;
+ String nameString;
if (name.isUndefined())
nameString = "Error";
else {
// (sic)
// 6. If msg is undefined, then let msg be the empty String; else let msg be ToString(msg).
// 7. If msg is undefined, then let msg be the empty String; else let msg be ToString(msg).
- UString messageString;
+ String messageString;
if (message.isUndefined())
messageString = "";
else {
#include "JSNotAnObject.h"
#include "Interpreter.h"
#include "Nodes.h"
-#include "UStringConcatenate.h"
namespace JSC {
JSObject* createUndefinedVariableError(ExecState* exec, const Identifier& ident)
{
- UString message(makeUString("Can't find variable: ", ident.ustring()));
+ String message(makeString("Can't find variable: ", ident.ustring()));
return createReferenceError(exec, message);
}
JSObject* createInvalidParamError(ExecState* exec, const char* op, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a valid argument for '", op, "'");
+ String errorMessage = makeString("'", value.toString(exec)->value(exec), "' is not a valid argument for '", op, "'");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAConstructorError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a constructor");
+ String errorMessage = makeString("'", value.toString(exec)->value(exec), "' is not a constructor");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAFunctionError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not a function");
+ String errorMessage = makeString("'", value.toString(exec)->value(exec), "' is not a function");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
JSObject* createNotAnObjectError(ExecState* exec, JSValue value)
{
- UString errorMessage = makeUString("'", value.toString(exec)->value(exec), "' is not an object");
+ String errorMessage = makeString("'", value.toString(exec)->value(exec), "' is not an object");
JSObject* exception = createTypeError(exec, errorMessage);
ASSERT(exception->isErrorInstance());
static_cast<ErrorInstance*>(exception)->setAppendSourceToMessage();
return exception;
}
-JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const UString& propertyName)
+JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const String& propertyName)
{
- return createReferenceError(exec, makeUString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
+ return createReferenceError(exec, makeString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
}
JSObject* createOutOfMemoryError(JSGlobalObject* globalObject)
JSObject* createInvalidParamError(ExecState*, const char* op, JSValue);
JSObject* createNotAConstructorError(ExecState*, JSValue);
JSObject* createNotAFunctionError(ExecState*, JSValue);
-JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const UString&);
+JSObject* createErrorForInvalidGlobalAssignment(ExecState*, const String&);
JSObject* throwOutOfMemoryError(ExecState*);
JSObject* throwStackOverflowError(ExecState*);
#include "JIT.h"
#include "JITDriver.h"
#include "Parser.h"
-#include "UStringBuilder.h"
#include <wtf/Vector.h>
+#include <wtf/text/StringBuilder.h>
namespace JSC {
return FunctionExecutable::create(exec->globalData(), functionName, functionName, body->source(), body->usesArguments(), body->parameters(), body->isStrictMode(), body->lineNo(), body->lastLine());
}
-UString FunctionExecutable::paramString() const
+String FunctionExecutable::paramString() const
{
FunctionParameters& parameters = *m_parameters;
- UStringBuilder builder;
+ StringBuilder builder;
for (size_t pos = 0; pos < parameters.size(); ++pos) {
if (!builder.isEmpty())
builder.append(", ");
builder.append(parameters[pos].ustring());
}
- return builder.toUString();
+ return builder.toString();
}
}
const SourceCode& source() { return m_source; }
intptr_t sourceID() const { return m_source.providerID(); }
- const UString& sourceURL() const { return m_source.provider()->url(); }
+ const String& sourceURL() const { return m_source.provider()->url(); }
int lineNo() const { return m_firstLine; }
int lastLine() const { return m_lastLine; }
JSString* nameValue() const { return m_nameValue.get(); }
size_t parameterCount() const { return m_parameters->size(); } // Excluding 'this'!
unsigned capturedVariableCount() const { return m_numCapturedVariables; }
- UString paramString() const;
+ String paramString() const;
SharedSymbolTable* symbolTable() const { return m_symbolTable.get(); }
void clearCodeIfNotCompiling();
#include "Lexer.h"
#include "Nodes.h"
#include "Parser.h"
-#include "UStringBuilder.h"
-#include "UStringConcatenate.h"
+#include <wtf/text/StringBuilder.h>
namespace JSC {
}
// ECMA 15.3.2 The Function Constructor
-JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, const Identifier& functionName, const UString& sourceURL, const TextPosition& position)
+JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, const Identifier& functionName, const String& sourceURL, const TextPosition& position)
{
if (!globalObject->evalEnabled())
return throwError(exec, createEvalError(exec, "Function constructor is disabled"));
return constructFunctionSkippingEvalEnabledCheck(exec, globalObject, args, functionName, sourceURL, position);
}
-JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, const Identifier& functionName, const UString& sourceURL, const TextPosition& position)
+JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args, const Identifier& functionName, const String& sourceURL, const TextPosition& position)
{
// Functions need to have a space following the opening { due to for web compatibility
// see https://bugs.webkit.org/show_bug.cgi?id=24350
// We also need \n before the closing } to handle // comments at the end of the last line
- UString program;
+ String program;
if (args.isEmpty())
program = "(function() { \n})";
else if (args.size() == 1)
- program = makeUString("(function() { ", args.at(0).toString(exec)->value(exec), "\n})");
+ program = makeString("(function() { ", args.at(0).toString(exec)->value(exec), "\n})");
else {
- UStringBuilder builder;
+ StringBuilder builder;
builder.append("(function(");
builder.append(args.at(0).toString(exec)->value(exec));
for (size_t i = 1; i < args.size() - 1; i++) {
builder.append(") { ");
builder.append(args.at(args.size() - 1).toString(exec)->value(exec));
builder.append("\n})");
- program = builder.toUString();
+ program = builder.toString();
}
JSGlobalData& globalData = globalObject->globalData();
// ECMA 15.3.2 The Function Constructor
JSObject* constructFunction(ExecState* exec, JSGlobalObject* globalObject, const ArgList& args)
{
- return constructFunction(exec, globalObject, args, Identifier(exec, "anonymous"), UString(), TextPosition::minimumPosition());
+ return constructFunction(exec, globalObject, args, Identifier(exec, "anonymous"), String(), TextPosition::minimumPosition());
}
} // namespace JSC
static CallType getCallData(JSCell*, CallData&);
};
- JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const UString& sourceURL, const WTF::TextPosition&);
+ JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&, const Identifier& functionName, const String& sourceURL, const WTF::TextPosition&);
JSObject* constructFunction(ExecState*, JSGlobalObject*, const ArgList&);
- JS_EXPORT_PRIVATE JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState*, JSGlobalObject*, const ArgList&, const Identifier&, const UString&, const WTF::TextPosition&);
+ JS_EXPORT_PRIVATE JSObject* constructFunctionSkippingEvalEnabledCheck(ExecState*, JSGlobalObject*, const ArgList&, const Identifier&, const String&, const WTF::TextPosition&);
} // namespace JSC
{
}
-void FunctionPrototype::finishCreation(ExecState* exec, const UString& name)
+void FunctionPrototype::finishCreation(ExecState* exec, const String& name)
{
Base::finishCreation(exec->globalData(), name);
putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
// Functions
// Compatibility hack for the Optimost JavaScript library. (See <rdar://problem/6595040>.)
-static inline void insertSemicolonIfNeeded(UString& functionBody)
+static inline void insertSemicolonIfNeeded(String& functionBody)
{
ASSERT(functionBody[0] == '{');
ASSERT(functionBody[functionBody.length() - 1] == '}');
UChar ch = functionBody[i];
if (!Lexer<UChar>::isWhiteSpace(ch) && !Lexer<UChar>::isLineTerminator(ch)) {
if (ch != ';' && ch != '}')
- functionBody = makeUString(functionBody.substringSharingImpl(0, i + 1), ";", functionBody.substringSharingImpl(i + 1, functionBody.length() - (i + 1)));
+ functionBody = makeString(functionBody.substringSharingImpl(0, i + 1), ";", functionBody.substringSharingImpl(i + 1, functionBody.length() - (i + 1)));
return;
}
}
if (function->isHostFunction())
return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "() {\n [native code]\n}"));
FunctionExecutable* executable = function->jsExecutable();
- UString sourceString = executable->source().toString();
+ String sourceString = executable->source().toString();
insertSemicolonIfNeeded(sourceString);
return JSValue::encode(jsMakeNontrivialString(exec, "function ", function->name(exec), "(", executable->paramString(), ") ", sourceString));
}
static const ClassInfo s_info;
protected:
- void finishCreation(ExecState*, const UString& name);
+ void finishCreation(ExecState*, const String& name);
private:
FunctionPrototype(JSGlobalObject*, Structure*);
#include "JSGlobalData.h"
#include <wtf/ThreadSpecific.h>
-#include "UString.h"
#include <wtf/WTFThreadData.h>
#include <wtf/text/CString.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
Identifier(JSGlobalData* globalData, const char (&characters)[charactersCount]) : m_string(add(globalData, characters)) { }
Identifier(ExecState* exec, StringImpl* rep) : m_string(add(exec, rep)) { }
- Identifier(ExecState* exec, const UString& s) : m_string(add(exec, s.impl())) { }
+ Identifier(ExecState* exec, const String& s) : m_string(add(exec, s.impl())) { }
Identifier(JSGlobalData* globalData, const LChar* s, int length) : m_string(add(globalData, s, length)) { }
Identifier(JSGlobalData* globalData, const UChar* s, int length) : m_string(add(globalData, s, length)) { }
Identifier(JSGlobalData* globalData, StringImpl* rep) : m_string(add(globalData, rep)) { }
- Identifier(JSGlobalData* globalData, const UString& s) : m_string(add(globalData, s.impl())) { }
+ Identifier(JSGlobalData* globalData, const String& s) : m_string(add(globalData, s.impl())) { }
- const UString& ustring() const { return m_string; }
+ // FIXME: fix this name.
+ const String& ustring() const { return m_string; }
StringImpl* impl() const { return m_string.impl(); }
const UChar* characters() const { return m_string.characters(); }
JS_EXPORT_PRIVATE static PassRefPtr<StringImpl> add(ExecState*, const char*);
private:
- UString m_string;
+ String m_string;
template <typename CharType>
ALWAYS_INLINE static uint32_t toUInt32FromCharacters(const CharType* characters, unsigned length, bool& ok);
#include "JSDateMath.h"
#include "JSGlobalObject.h"
#include "LLIntData.h"
-#include "UString.h"
#include "WriteBarrier.h"
#include <wtf/dtoa.h>
#include <wtf/Threading.h>
{
}
-void InternalFunction::finishCreation(JSGlobalData& globalData, const UString& name)
+void InternalFunction::finishCreation(JSGlobalData& globalData, const String& name)
{
Base::finishCreation(globalData);
ASSERT(inherits(&s_info));
putDirect(globalData, globalData.propertyNames->name, jsString(&globalData, name.isNull() ? "" : name), DontDelete | ReadOnly | DontEnum);
}
-const UString& InternalFunction::name(ExecState* exec)
+const String& InternalFunction::name(ExecState* exec)
{
return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue();
}
-const UString InternalFunction::displayName(ExecState* exec)
+const String InternalFunction::displayName(ExecState* exec)
{
JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName);
if (displayName && isJSString(displayName))
return asString(displayName)->tryGetValue();
- return UString();
+ return String();
}
CallType InternalFunction::getCallData(JSCell*, CallData&)
return CallTypeNone;
}
-const UString InternalFunction::calculatedDisplayName(ExecState* exec)
+const String InternalFunction::calculatedDisplayName(ExecState* exec)
{
- const UString explicitName = displayName(exec);
+ const String explicitName = displayName(exec);
if (!explicitName.isEmpty())
return explicitName;
static JS_EXPORTDATA const ClassInfo s_info;
- JS_EXPORT_PRIVATE const UString& name(ExecState*);
- const UString displayName(ExecState*);
- const UString calculatedDisplayName(ExecState*);
+ JS_EXPORT_PRIVATE const String& name(ExecState*);
+ const String displayName(ExecState*);
+ const String calculatedDisplayName(ExecState*);
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue proto)
{
JS_EXPORT_PRIVATE InternalFunction(JSGlobalObject*, Structure*);
- JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const UString& name);
+ JS_EXPORT_PRIVATE void finishCreation(JSGlobalData&, const String& name);
static CallType getCallData(JSCell*, CallData&);
};
#include "JSAPIValueWrapper.h"
#include "NumberObject.h"
-#include "UString.h"
namespace JSC {
// a toString call raises an exception.
for (size_t i = 0; i < lengthNotIncludingUndefined; i++)
- values[i].second = values[i].first.toUStringInline(exec);
+ values[i].second = values[i].first.toWTFStringInline(exec);
if (exec->hadException()) {
Heap::heap(this)->popTempSortVector(&values);
return JSValue::encode(construct(exec, targetFunction, constructType, constructData, args));
}
-JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const UString& name)
+JSBoundFunction* JSBoundFunction::create(ExecState* exec, JSGlobalObject* globalObject, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int length, const String& name)
{
ConstructData constructData;
ConstructType constructType = JSC::getConstructData(targetFunction, constructData);
{
}
-void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name)
+void JSBoundFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
{
Base::finishCreation(exec, executable, length, name);
ASSERT(inherits(&s_info));
public:
typedef JSFunction Base;
- static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const UString&);
+ static JSBoundFunction* create(ExecState*, JSGlobalObject*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs, int, const String&);
static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue proto);
private:
JSBoundFunction(ExecState*, JSGlobalObject*, Structure*, JSObject* targetFunction, JSValue boundThis, JSValue boundArgs);
- void finishCreation(ExecState*, NativeExecutable*, int, const UString&);
+ void finishCreation(ExecState*, NativeExecutable*, int, const String&);
WriteBarrier<JSObject> m_targetFunction;
WriteBarrier<Unknown> m_boundThis;
cell->JSCell::~JSCell();
}
-bool JSCell::getString(ExecState* exec, UString&stringValue) const
+bool JSCell::getString(ExecState* exec, String& stringValue) const
{
if (!isString())
return false;
return true;
}
-UString JSCell::getString(ExecState* exec) const
+String JSCell::getString(ExecState* exec) const
{
- return isString() ? static_cast<const JSString*>(this)->value(exec) : UString();
+ return isString() ? static_cast<const JSString*>(this)->value(exec) : String();
}
JSObject* JSCell::getObject()
ASSERT_NOT_REACHED();
}
-UString JSCell::className(const JSObject*)
+String JSCell::className(const JSObject*)
{
ASSERT_NOT_REACHED();
- return UString();
+ return String();
}
const char* JSCell::className()
const char* className();
// Extracting the value.
- JS_EXPORT_PRIVATE bool getString(ExecState* exec, UString&) const;
- JS_EXPORT_PRIVATE UString getString(ExecState* exec) const; // null string if not a string
+ JS_EXPORT_PRIVATE bool getString(ExecState*, String&) const;
+ JS_EXPORT_PRIVATE String getString(ExecState*) const; // null string if not a string
JS_EXPORT_PRIVATE JSObject* getObject(); // NULL if not an object
const JSObject* getObject() const; // NULL if not an object
// call this function, not its slower virtual counterpart. (For integer
// property names, we want a similar interface with appropriate optimizations.)
bool fastGetOwnPropertySlot(ExecState*, PropertyName, PropertySlot&);
- JSValue fastGetOwnProperty(ExecState*, const UString&);
+ JSValue fastGetOwnProperty(ExecState*, const String&);
static ptrdiff_t structureOffset()
{
static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
static NO_RETURN_DUE_TO_ASSERT void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
static NO_RETURN_DUE_TO_ASSERT void getPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
- static UString className(const JSObject*);
+ static String className(const JSObject*);
static bool hasInstance(JSObject*, ExecState*, JSValue, JSValue prototypeProperty);
static NO_RETURN_DUE_TO_ASSERT void putDirectVirtual(JSObject*, ExecState*, PropertyName, JSValue, unsigned attributes);
static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, PropertyDescriptor&, bool shouldThrow);
return isCell() && asCell()->isObject();
}
- inline bool JSValue::getString(ExecState* exec, UString& s) const
+ inline bool JSValue::getString(ExecState* exec, String& s) const
{
return isCell() && asCell()->getString(exec, s);
}
- inline UString JSValue::getString(ExecState* exec) const
+ inline String JSValue::getString(ExecState* exec) const
{
- return isCell() ? asCell()->getString(exec) : UString();
+ return isCell() ? asCell()->getString(exec) : String();
}
- template <typename Base> UString HandleConverter<Base, Unknown>::getString(ExecState* exec) const
+ template <typename Base> String HandleConverter<Base, Unknown>::getString(ExecState* exec) const
{
return jsValue().getString(exec);
}
return ms - (offset * WTF::msPerMinute);
}
-double parseDate(ExecState* exec, const UString& date)
+double parseDate(ExecState* exec, const String& date)
{
if (date == exec->globalData().cachedDateString)
return exec->globalData().cachedDateStringValue;
namespace JSC {
class ExecState;
-class UString;
void msToGregorianDateTime(ExecState*, double, bool outputIsUTC, GregorianDateTime&);
double gregorianDateTimeToMS(ExecState*, const GregorianDateTime&, double, bool inputIsUTC);
double getUTCOffset(ExecState*);
double parseDateFromNullTerminatedCharacters(ExecState*, const char* dateString);
-double parseDate(ExecState*, const UString&);
+double parseDate(ExecState*, const WTF::String&);
} // namespace JSC
return isHostFunction();
}
-JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const UString& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
+JSFunction* JSFunction::create(ExecState* exec, JSGlobalObject* globalObject, int length, const String& name, NativeFunction nativeFunction, Intrinsic intrinsic, NativeFunction nativeConstructor)
{
NativeExecutable* executable;
#if !ENABLE(JIT)
{
}
-void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const UString& name)
+void JSFunction::finishCreation(ExecState* exec, NativeExecutable* executable, int length, const String& name)
{
Base::finishCreation(exec->globalData());
ASSERT(inherits(&s_info));
return m_cachedInheritorID.get();
}
-const UString& JSFunction::name(ExecState* exec)
+const String& JSFunction::name(ExecState* exec)
{
return asString(getDirect(exec->globalData(), exec->globalData().propertyNames->name))->tryGetValue();
}
-const UString JSFunction::displayName(ExecState* exec)
+const String JSFunction::displayName(ExecState* exec)
{
JSValue displayName = getDirect(exec->globalData(), exec->globalData().propertyNames->displayName);
if (displayName && isJSString(displayName))
return asString(displayName)->tryGetValue();
- return UString();
+ return String();
}
-const UString JSFunction::calculatedDisplayName(ExecState* exec)
+const String JSFunction::calculatedDisplayName(ExecState* exec)
{
- const UString explicitName = displayName(exec);
+ const String explicitName = displayName(exec);
if (!explicitName.isEmpty())
return explicitName;
- const UString actualName = name(exec);
+ const String actualName = name(exec);
if (!actualName.isEmpty() || isHostFunction())
return actualName;
}
-UString getCalculatedDisplayName(CallFrame* callFrame, JSObject* object)
+String getCalculatedDisplayName(CallFrame* callFrame, JSObject* object)
{
if (JSFunction* function = jsDynamicCast<JSFunction*>(object))
return function->calculatedDisplayName(callFrame);
JS_EXPORT_PRIVATE EncodedJSValue JSC_HOST_CALL callHostFunctionAsConstructor(ExecState*);
- JS_EXPORT_PRIVATE UString getCalculatedDisplayName(CallFrame*, JSObject*);
+ JS_EXPORT_PRIVATE String getCalculatedDisplayName(CallFrame*, JSObject*);
class JSFunction : public JSNonFinalObject {
friend class JIT;
public:
typedef JSNonFinalObject Base;
- JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const UString& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
+ JS_EXPORT_PRIVATE static JSFunction* create(ExecState*, JSGlobalObject*, int length, const String& name, NativeFunction, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
static JSFunction* create(ExecState* exec, FunctionExecutable* executable, ScopeChainNode* scopeChain)
{
return function;
}
- JS_EXPORT_PRIVATE const UString& name(ExecState*);
- JS_EXPORT_PRIVATE const UString displayName(ExecState*);
- const UString calculatedDisplayName(ExecState*);
+ JS_EXPORT_PRIVATE const String& name(ExecState*);
+ JS_EXPORT_PRIVATE const String displayName(ExecState*);
+ const String calculatedDisplayName(ExecState*);
ScopeChainNode* scope()
{
JS_EXPORT_PRIVATE JSFunction(ExecState*, JSGlobalObject*, Structure*);
JSFunction(ExecState*, FunctionExecutable*, ScopeChainNode*);
- void finishCreation(ExecState*, NativeExecutable*, int length, const UString& name);
+ void finishCreation(ExecState*, NativeExecutable*, int length, const String& name);
void finishCreation(ExecState*, FunctionExecutable*, ScopeChainNode*);
Structure* cacheInheritorID(ExecState*);
{
cachedUTCOffset = std::numeric_limits<double>::quiet_NaN();
dstOffsetCache.reset();
- cachedDateString = UString();
+ cachedDateString = String();
cachedDateStringValue = std::numeric_limits<double>::quiet_NaN();
dateInstanceCache.reset();
}
class RegExpCache;
class Stringifier;
class Structure;
- class UString;
#if ENABLE(REGEXP_TRACING)
class RegExp;
#endif
double cachedUTCOffset;
DSTOffsetCache dstOffsetCache;
- UString cachedDateString;
+ String cachedDateString;
double cachedDateStringValue;
int maxReentryDepth;
#include "LiteralParser.h"
#include "Nodes.h"
#include "Parser.h"
-#include "UStringBuilder.h"
#include <wtf/dtoa.h>
#include <stdio.h>
#include <stdlib.h>
#include <wtf/Assertions.h>
#include <wtf/MathExtras.h>
#include <wtf/StringExtras.h>
+#include <wtf/text/StringBuilder.h>
#include <wtf/unicode/UTF8.h>
using namespace WTF;
static JSValue decode(ExecState* exec, const char* doNotUnescape, bool strict)
{
JSStringBuilder builder;
- UString str = exec->argument(0).toString(exec)->value(exec);
+ String str = exec->argument(0).toString(exec)->value(exec);
if (str.is8Bit())
return decode(exec, str.characters8(), str.length(), doNotUnescape, strict);
// ES5.1 15.1.2.2
template <typename CharType>
ALWAYS_INLINE
-static double parseInt(const UString& s, const CharType* data, int radix)
+static double parseInt(const String& s, const CharType* data, int radix)
{
// 1. Let inputString be ToString(string).
// 2. Let S be a newly created substring of inputString consisting of the first character that is not a
return sign * number;
}
-static double parseInt(const UString& s, int radix)
+static double parseInt(const String& s, int radix)
{
if (s.is8Bit())
return parseInt(s, s.characters8(), radix);
}
// See ecma-262 9.3.1
-double jsToNumber(const UString& s)
+double jsToNumber(const String& s)
{
unsigned size = s.length();
return toDouble(s.characters16(), size);
}
-static double parseFloat(const UString& s)
+static double parseFloat(const String& s)
{
unsigned size = s.length();
if (!x.isString())
return JSValue::encode(x);
- UString s = x.toString(exec)->value(exec);
+ String s = x.toString(exec)->value(exec);
if (s.is8Bit()) {
LiteralParser<LChar> preparser(exec, s.characters8(), s.length(), NonStrictJSON);
}
// If ToString throws, we shouldn't call ToInt32.
- UString s = value.toString(exec)->value(exec);
+ String s = value.toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsUndefined());
"*+-./@_";
JSStringBuilder builder;
- UString str = exec->argument(0).toString(exec)->value(exec);
+ String str = exec->argument(0).toString(exec)->value(exec);
if (str.is8Bit()) {
const LChar* c = str.characters8();
for (unsigned k = 0; k < str.length(); k++, c++) {
EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
{
- UStringBuilder builder;
- UString str = exec->argument(0).toString(exec)->value(exec);
+ StringBuilder builder;
+ String str = exec->argument(0).toString(exec)->value(exec);
int k = 0;
int len = str.length();
}
}
- return JSValue::encode(jsString(exec, builder.toUString()));
+ return JSValue::encode(jsString(exec, builder.toString()));
}
EncodedJSValue JSC_HOST_CALL globalFuncThrowTypeError(ExecState* exec)
ALWAYS_INLINE double parseIntOverflow(const char* s, int length, int radix) { return parseIntOverflow(reinterpret_cast<const LChar*>(s), length, radix); }
double parseIntOverflow(const UChar*, int length, int radix);
bool isStrWhiteSpace(UChar);
- double jsToNumber(const UString& s);
+ double jsToNumber(const WTF::String&);
} // namespace JSC
#include "LocalScope.h"
#include "Lookup.h"
#include "PropertyNameArray.h"
-#include "UStringBuilder.h"
-#include "UStringConcatenate.h"
#include <wtf/MathExtras.h>
+#include <wtf/text/StringBuilder.h>
namespace JSC {
JSObject* object() const { return m_object.get(); }
- bool appendNextProperty(Stringifier&, UStringBuilder&);
+ bool appendNextProperty(Stringifier&, StringBuilder&);
private:
Local<JSObject> m_object;
friend class Holder;
- static void appendQuotedString(UStringBuilder&, const UString&);
+ static void appendQuotedString(StringBuilder&, const String&);
JSValue toJSON(JSValue, const PropertyNameForFunctionCall&);
enum StringifyResult { StringifyFailed, StringifySucceeded, StringifyFailedDueToUndefinedValue };
- StringifyResult appendStringifiedValue(UStringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
+ StringifyResult appendStringifiedValue(StringBuilder&, JSValue, JSObject* holder, const PropertyNameForFunctionCall&);
bool willIndent() const;
void indent();
void unindent();
- void startNewLine(UStringBuilder&) const;
+ void startNewLine(StringBuilder&) const;
ExecState* const m_exec;
const Local<Unknown> m_replacer;
PropertyNameArray m_arrayReplacerPropertyNames;
CallType m_replacerCallType;
CallData m_replacerCallData;
- const UString m_gap;
+ const String m_gap;
Vector<Holder, 16> m_holderStack;
- UString m_repeatedGap;
- UString m_indent;
+ String m_repeatedGap;
+ String m_indent;
};
// ------------------------------ helper functions --------------------------------
return value;
}
-static inline UString gap(ExecState* exec, JSValue space)
+static inline String gap(ExecState* exec, JSValue space)
{
const unsigned maxGapLength = 10;
space = unwrapBoxedPrimitive(exec, space);
UChar spaces[maxGapLength];
for (int i = 0; i < count; ++i)
spaces[i] = ' ';
- return UString(spaces, count);
+ return String(spaces, count);
}
// If the space value is a string, use it as the gap string, otherwise use no gap string.
- UString spaces = space.getString(exec);
+ String spaces = space.getString(exec);
if (spaces.length() > maxGapLength) {
spaces = spaces.substringSharingImpl(0, maxGapLength);
}
PropertyNameForFunctionCall emptyPropertyName(m_exec->globalData().propertyNames->emptyIdentifier);
object->putDirect(m_exec->globalData(), m_exec->globalData().propertyNames->emptyIdentifier, value.get());
- UStringBuilder result;
+ StringBuilder result;
if (appendStringifiedValue(result, value.get(), object, emptyPropertyName) != StringifySucceeded)
return Local<Unknown>(m_exec->globalData(), jsUndefined());
if (m_exec->hadException())
return Local<Unknown>(m_exec->globalData(), jsNull());
- return Local<Unknown>(m_exec->globalData(), jsString(m_exec, result.toUString()));
+ return Local<Unknown>(m_exec->globalData(), jsString(m_exec, result.toString()));
}
template <typename CharType>
-static void appendStringToUStringBuilder(UStringBuilder& builder, const CharType* data, int length)
+static void appendStringToStringBuilder(StringBuilder& builder, const CharType* data, int length)
{
for (int i = 0; i < length; ++i) {
int start = i;
}
}
-void Stringifier::appendQuotedString(UStringBuilder& builder, const UString& value)
+void Stringifier::appendQuotedString(StringBuilder& builder, const String& value)
{
int length = value.length();
builder.append('"');
if (value.is8Bit())
- appendStringToUStringBuilder<LChar>(builder, value.characters8(), length);
+ appendStringToStringBuilder<LChar>(builder, value.characters8(), length);
else
- appendStringToUStringBuilder<UChar>(builder, value.characters16(), length);
+ appendStringToStringBuilder<UChar>(builder, value.characters16(), length);
builder.append('"');
}
return call(m_exec, object, callType, callData, value, args);
}
-Stringifier::StringifyResult Stringifier::appendStringifiedValue(UStringBuilder& builder, JSValue value, JSObject* holder, const PropertyNameForFunctionCall& propertyName)
+Stringifier::StringifyResult Stringifier::appendStringifiedValue(StringBuilder& builder, JSValue value, JSObject* holder, const PropertyNameForFunctionCall& propertyName)
{
// Call the toJSON function.
value = toJSON(value, propertyName);
return StringifySucceeded;
}
- UString stringValue;
+ String stringValue;
if (value.getString(m_exec, stringValue)) {
appendQuotedString(builder, stringValue);
return StringifySucceeded;
if (!isfinite(number))
builder.append("null");
else
- builder.append(UString::numberToStringECMAScript(number));
+ builder.append(String::numberToStringECMAScript(number));
return StringifySucceeded;
}
// Use a single shared string, m_repeatedGap, so we don't keep allocating new ones as we indent and unindent.
unsigned newSize = m_indent.length() + m_gap.length();
if (newSize > m_repeatedGap.length())
- m_repeatedGap = makeUString(m_repeatedGap, m_gap);
+ m_repeatedGap = makeString(m_repeatedGap, m_gap);
ASSERT(newSize <= m_repeatedGap.length());
m_indent = m_repeatedGap.substringSharingImpl(0, newSize);
}
m_indent = m_repeatedGap.substringSharingImpl(0, m_indent.length() - m_gap.length());
}
-inline void Stringifier::startNewLine(UStringBuilder& builder) const
+inline void Stringifier::startNewLine(StringBuilder& builder) const
{
if (m_gap.isEmpty())
return;
{
}
-bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, UStringBuilder& builder)
+bool Stringifier::Holder::appendNextProperty(Stringifier& stringifier, StringBuilder& builder)
{
ASSERT(m_index <= m_size);
}
case ArrayEndVisitMember: {
JSArray* array = arrayStack.peek();
- JSValue filteredValue = callReviver(array, jsString(m_exec, UString::number(indexStack.last())), outValue);
+ JSValue filteredValue = callReviver(array, jsString(m_exec, String::number(indexStack.last())), outValue);
if (filteredValue.isUndefined())
array->methodTable()->deletePropertyByIndex(array, m_exec, indexStack.last());
else
{
if (!exec->argumentCount())
return throwVMError(exec, createError(exec, "JSON.parse requires at least one parameter"));
- UString source = exec->argument(0).toString(exec)->value(exec);
+ String source = exec->argument(0).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
return JSValue::encode(Stringifier(exec, replacer, space).stringify(value).get());
}
-UString JSONStringify(ExecState* exec, JSValue value, unsigned indent)
+String JSONStringify(ExecState* exec, JSValue value, unsigned indent)
{
LocalScope scope(exec->globalData());
Local<Unknown> result = Stringifier(exec, Local<Unknown>(exec->globalData(), jsNull()), Local<Unknown>(exec->globalData(), jsNumber(indent))).stringify(Local<Unknown>(exec->globalData(), value));
if (result.isUndefinedOrNull())
- return UString();
+ return String();
return result.getString(exec);
}
};
- UString JSONStringify(ExecState* exec, JSValue value, unsigned indent);
+ String JSONStringify(ExecState*, JSValue, unsigned indent);
} // namespace JSC
#endif
}
-UString JSObject::className(const JSObject* object)
+String JSObject::className(const JSObject* object)
{
const ClassInfo* info = object->classInfo();
ASSERT(info);
return true;
}
-JSObject* throwTypeError(ExecState* exec, const UString& message)
+JSObject* throwTypeError(ExecState* exec, const String& message)
{
return throwError(exec, createTypeError(exec, message));
}
class Structure;
struct HashTable;
- JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*, const UString&);
+ JS_EXPORT_PRIVATE JSObject* throwTypeError(ExecState*, const String&);
extern JS_EXPORTDATA const char* StrictModeReadonlyPropertyWriteError;
// ECMA 262-3 8.6.1
JS_EXPORT_PRIVATE static void visitChildren(JSCell*, SlotVisitor&);
- JS_EXPORT_PRIVATE static UString className(const JSObject*);
+ JS_EXPORT_PRIVATE static String className(const JSObject*);
JSValue prototype() const;
void setPrototype(JSGlobalData&, JSValue prototype);
// identifier. The first time we perform a property access with a given string, try
// performing the property map lookup without forming an identifier. We detect this
// case by checking whether the hash has yet been set for this string.
-ALWAYS_INLINE JSValue JSCell::fastGetOwnProperty(ExecState* exec, const UString& name)
+ALWAYS_INLINE JSValue JSCell::fastGetOwnProperty(ExecState* exec, const String& name)
{
if (!structure()->typeInfo().overridesGetOwnPropertySlot() && !structure()->hasGetterSetterProperties()) {
PropertyOffset offset = name.impl()->hasHash()
}
// Overview: These functions convert a JSString from holding a string in rope form
-// down to a simple UString representation. It does so by building up the string
+// down to a simple String representation. It does so by building up the string
// backwards, since we want to avoid recursion, we expect that the tree structure
// representing the rope is likely imbalanced with more nodes down the left side
// (since appending to the string is likely more common) - and as such resolving
for (size_t i = 0; i < s_maxInternalRopeLength && m_fibers[i]; ++i)
m_fibers[i].clear();
ASSERT(isRope());
- ASSERT(m_value == UString());
+ ASSERT(m_value.isNull());
if (exec)
throwOutOfMemoryError(exec);
}
JSString* jsEmptyString(JSGlobalData*);
JSString* jsEmptyString(ExecState*);
- JSString* jsString(JSGlobalData*, const UString&); // returns empty string if passed null string
- JSString* jsString(ExecState*, const UString&); // returns empty string if passed null string
+ JSString* jsString(JSGlobalData*, const String&); // returns empty string if passed null string
+ JSString* jsString(ExecState*, const String&); // returns empty string if passed null string
JSString* jsSingleCharacterString(JSGlobalData*, UChar);
JSString* jsSingleCharacterString(ExecState*, UChar);
- JSString* jsSingleCharacterSubstring(ExecState*, const UString&, unsigned offset);
- JSString* jsSubstring(JSGlobalData*, const UString&, unsigned offset, unsigned length);
- JSString* jsSubstring(ExecState*, const UString&, unsigned offset, unsigned length);
+ JSString* jsSingleCharacterSubstring(ExecState*, const String&, unsigned offset);
+ JSString* jsSubstring(JSGlobalData*, const String&, unsigned offset, unsigned length);
+ JSString* jsSubstring(ExecState*, const String&, unsigned offset, unsigned length);
// Non-trivial strings are two or more characters long.
// These functions are faster than just calling jsString.
- JSString* jsNontrivialString(JSGlobalData*, const UString&);
- JSString* jsNontrivialString(ExecState*, const UString&);
+ JSString* jsNontrivialString(JSGlobalData*, const String&);
+ JSString* jsNontrivialString(ExecState*, const String&);
JSString* jsNontrivialString(JSGlobalData*, const char*);
JSString* jsNontrivialString(ExecState*, const char*);
// Should be used for strings that are owned by an object that will
// likely outlive the JSValue this makes, such as the parse tree or a
- // DOM object that contains a UString
- JSString* jsOwnedString(JSGlobalData*, const UString&);
- JSString* jsOwnedString(ExecState*, const UString&);
+ // DOM object that contains a String
+ JSString* jsOwnedString(JSGlobalData*, const String&);
+ JSString* jsOwnedString(ExecState*, const String&);
JSRopeString* jsStringBuilder(JSGlobalData*);
return newString;
}
- const UString& value(ExecState*) const;
- const UString& tryGetValue() const;
+ const String& value(ExecState*) const;
+ const String& tryGetValue() const;
unsigned length() { return m_length; }
JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const;
Is8Bit = 1u
};
- // A string is represented either by a UString or a rope of fibers.
+ // A string is represented either by a String or a rope of fibers.
unsigned m_length;
- mutable UString m_value;
+ mutable String m_value;
private:
friend class LLIntOffsetsExtractor;
static bool getOwnPropertySlot(JSCell*, ExecState*, PropertyName, PropertySlot&);
static bool getOwnPropertySlotByIndex(JSCell*, ExecState*, unsigned propertyName, PropertySlot&);
- UString& string() { ASSERT(!isRope()); return m_value; }
+ String& string() { ASSERT(!isRope()); return m_value; }
friend JSValue jsString(ExecState*, JSString*, JSString*);
friend JSString* jsSubstring(ExecState*, JSString*, unsigned offset, unsigned length);
{
if (c <= maxSingleCharacterString)
return globalData->smallStrings.singleCharacterString(globalData, c);
- return JSString::create(*globalData, UString(&c, 1).impl());
+ return JSString::create(*globalData, String(&c, 1).impl());
}
- ALWAYS_INLINE JSString* jsSingleCharacterSubstring(ExecState* exec, const UString& s, unsigned offset)
+ ALWAYS_INLINE JSString* jsSingleCharacterSubstring(ExecState* exec, const String& s, unsigned offset)
{
JSGlobalData* globalData = &exec->globalData();
ASSERT(offset < static_cast<unsigned>(s.length()));
ASSERT(s);
ASSERT(s[0]);
ASSERT(s[1]);
- return JSString::create(*globalData, UString(s).impl());
+ return JSString::create(*globalData, String(s).impl());
}
- inline JSString* jsNontrivialString(JSGlobalData* globalData, const UString& s)
+ inline JSString* jsNontrivialString(JSGlobalData* globalData, const String& s)
{
ASSERT(s.length() > 1);
return JSString::create(*globalData, s.impl());
}
- inline const UString& JSString::value(ExecState* exec) const
+ inline const String& JSString::value(ExecState* exec) const
{
if (isRope())
static_cast<const JSRopeString*>(this)->resolveRope(exec);
return m_value;
}
- inline const UString& JSString::tryGetValue() const
+ inline const String& JSString::tryGetValue() const
{
if (isRope())
static_cast<const JSRopeString*>(this)->resolveRope(0);
return jsSingleCharacterSubstring(exec, m_value, i);
}
- inline JSString* jsString(JSGlobalData* globalData, const UString& s)
+ inline JSString* jsString(JSGlobalData* globalData, const String& s)
{
int size = s.length();
if (!size)
return jsSubstring(globalData, s->value(exec), offset, length);
}
- inline JSString* jsSubstring8(JSGlobalData* globalData, const UString& s, unsigned offset, unsigned length)
+ inline JSString* jsSubstring8(JSGlobalData* globalData, const String& s, unsigned offset, unsigned length)
{
ASSERT(offset <= static_cast<unsigned>(s.length()));
ASSERT(length <= static_cast<unsigned>(s.length()));
return JSString::createHasOtherOwner(*globalData, StringImpl::create8(s.impl(), offset, length));
}
- inline JSString* jsSubstring(JSGlobalData* globalData, const UString& s, unsigned offset, unsigned length)
+ inline JSString* jsSubstring(JSGlobalData* globalData, const String& s, unsigned offset, unsigned length)
{
ASSERT(offset <= static_cast<unsigned>(s.length()));
ASSERT(length <= static_cast<unsigned>(s.length()));
return JSString::createHasOtherOwner(*globalData, StringImpl::create(s.impl(), offset, length));
}
- inline JSString* jsOwnedString(JSGlobalData* globalData, const UString& s)
+ inline JSString* jsOwnedString(JSGlobalData* globalData, const String& s)
{
int size = s.length();
if (!size)
}
inline JSString* jsEmptyString(ExecState* exec) { return jsEmptyString(&exec->globalData()); }
- inline JSString* jsString(ExecState* exec, const UString& s) { return jsString(&exec->globalData(), s); }
+ inline JSString* jsString(ExecState* exec, const String& s) { return jsString(&exec->globalData(), s); }
inline JSString* jsSingleCharacterString(ExecState* exec, UChar c) { return jsSingleCharacterString(&exec->globalData(), c); }
- inline JSString* jsSubstring8(ExecState* exec, const UString& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->globalData(), s, offset, length); }
- inline JSString* jsSubstring(ExecState* exec, const UString& s, unsigned offset, unsigned length) { return jsSubstring(&exec->globalData(), s, offset, length); }
- inline JSString* jsNontrivialString(ExecState* exec, const UString& s) { return jsNontrivialString(&exec->globalData(), s); }
+ inline JSString* jsSubstring8(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring8(&exec->globalData(), s, offset, length); }
+ inline JSString* jsSubstring(ExecState* exec, const String& s, unsigned offset, unsigned length) { return jsSubstring(&exec->globalData(), s, offset, length); }
+ inline JSString* jsNontrivialString(ExecState* exec, const String& s) { return jsNontrivialString(&exec->globalData(), s); }
inline JSString* jsNontrivialString(ExecState* exec, const char* s) { return jsNontrivialString(&exec->globalData(), s); }
- inline JSString* jsOwnedString(ExecState* exec, const UString& s) { return jsOwnedString(&exec->globalData(), s); }
+ inline JSString* jsOwnedString(ExecState* exec, const String& s) { return jsOwnedString(&exec->globalData(), s); }
ALWAYS_INLINE bool JSString::getStringPropertySlot(ExecState* exec, PropertyName propertyName, PropertySlot& slot)
{
return toStringSlowCase(exec);
}
- inline UString JSValue::toUString(ExecState* exec) const
+ inline String JSValue::toWTFString(ExecState* exec) const
{
if (isString())
return static_cast<JSString*>(asCell())->value(exec);
- return toUStringSlowCase(exec);
+ return toWTFStringSlowCase(exec);
}
- ALWAYS_INLINE UString inlineJSValueNotStringtoUString(const JSValue& value, ExecState* exec)
+ ALWAYS_INLINE String inlineJSValueNotStringtoString(const JSValue& value, ExecState* exec)
{
JSGlobalData& globalData = exec->globalData();
if (value.isInt32())
return value.toString(exec)->value(exec);
}
- ALWAYS_INLINE UString JSValue::toUStringInline(ExecState* exec) const
+ ALWAYS_INLINE String JSValue::toWTFStringInline(ExecState* exec) const
{
if (isString())
return static_cast<JSString*>(asCell())->value(exec);
- return inlineJSValueNotStringtoUString(*this, exec);
+ return inlineJSValueNotStringtoString(*this, exec);
}
} // namespace JSC
#include "ExceptionHelpers.h"
#include "JSString.h"
-#include "UStringConcatenate.h"
#include <wtf/Vector.h>
namespace JSC {
m_okay &= buffer16.tryAppend(str, len);
}
- void append(const UString& str)
+ void append(const String& str)
{
unsigned length = str.length();
buffer8.shrinkToFit();
if (!buffer8.data())
return throwOutOfMemoryError(exec);
- return jsString(exec, UString::adopt(buffer8));
+ return jsString(exec, String::adopt(buffer8));
}
buffer16.shrinkToFit();
if (!buffer16.data())
return throwOutOfMemoryError(exec);
- return jsString(exec, UString::adopt(buffer16));
+ return jsString(exec, String::adopt(buffer16));
}
protected:
namespace JSC {
// The destination is 16bits, at least one string is 16 bits.
-static inline void appendStringToData(UChar*& data, const UString& string)
+static inline void appendStringToData(UChar*& data, const String& string)
{
if (string.isNull())
return;
}
// If the destination is 8bits, we know every string has to be 8bit.
-static inline void appendStringToData(LChar*& data, const UString& string)
+static inline void appendStringToData(LChar*& data, const String& string)
{
if (string.isNull())
return;
}
template<typename CharacterType>
-static inline PassRefPtr<StringImpl> joinStrings(const Vector<UString>& strings, const UString& separator, unsigned outputLength)
+static inline PassRefPtr<StringImpl> joinStrings(const Vector<String>& strings, const String& separator, unsigned outputLength)
{
ASSERT(outputLength);
if (!outputStringImpl)
return PassRefPtr<StringImpl>();
- const UString firstString = strings.first();
+ const String firstString = strings.first();
appendStringToData(data, firstString);
for (size_t i = 1; i < strings.size(); ++i) {
#define JSStringJoiner_h
#include "JSValue.h"
-#include "UString.h"
#include <wtf/Vector.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
class JSStringJoiner {
public:
- JSStringJoiner(const UString& separator, size_t stringCount);
+ JSStringJoiner(const String& separator, size_t stringCount);
- void append(const UString&);
+ void append(const String&);
JSValue build(ExecState*);
private:
- UString m_separator;
- Vector<UString> m_strings;
+ String m_separator;
+ Vector<String> m_strings;
unsigned m_cumulatedStringsLength;
bool m_isValid;
bool m_is8Bits;
};
-inline JSStringJoiner::JSStringJoiner(const UString& separator, size_t stringCount)
+inline JSStringJoiner::JSStringJoiner(const String& separator, size_t stringCount)
: m_separator(separator)
, m_cumulatedStringsLength(0)
, m_isValid(true)
m_isValid = m_strings.tryReserveCapacity(stringCount);
}
-inline void JSStringJoiner::append(const UString& str)
+inline void JSStringJoiner::append(const String& str)
{
if (!m_isValid)
return;
return value.toString(exec);
}
-UString JSValue::toUStringSlowCase(ExecState* exec) const
+String JSValue::toWTFStringSlowCase(ExecState* exec) const
{
- return inlineJSValueNotStringtoUString(*this, exec);
+ return inlineJSValueNotStringtoString(*this, exec);
}
} // namespace JSC
class PropertyName;
class PropertySlot;
class PutPropertySlot;
- class UString;
#if ENABLE(DFG_JIT)
namespace DFG {
class AssemblyHelpers;
bool inherits(const ClassInfo*) const;
// Extracting the value.
- bool getString(ExecState* exec, UString&) const;
- UString getString(ExecState* exec) const; // null string if not a string
+ bool getString(ExecState*, WTF::String&) const;
+ WTF::String getString(ExecState*) const; // null string if not a string
JSObject* getObject() const; // 0 if not an object
// Extracting integer values.
// been set in the ExecState already.
double toNumber(ExecState*) const;
JSString* toString(ExecState*) const;
- UString toUString(ExecState*) const;
- UString toUStringInline(ExecState*) const;
+ WTF::String toWTFString(ExecState*) const;
+ WTF::String toWTFStringInline(ExecState*) const;
JSObject* toObject(ExecState*) const;
JSObject* toObject(ExecState*, JSGlobalObject*) const;
inline const JSValue asValue() const { return *this; }
JS_EXPORT_PRIVATE double toNumberSlowCase(ExecState*) const;
JS_EXPORT_PRIVATE JSString* toStringSlowCase(ExecState*) const;
- JS_EXPORT_PRIVATE UString toUStringSlowCase(ExecState*) const;
+ JS_EXPORT_PRIVATE WTF::String toWTFStringSlowCase(ExecState*) const;
JS_EXPORT_PRIVATE JSObject* toObjectSlowCase(ExecState*, JSGlobalObject*) const;
JS_EXPORT_PRIVATE JSObject* toThisObjectSlowCase(ExecState*) const;
#include "JSString.h"
#include "Lexer.h"
#include "StrongInlines.h"
-#include "UStringBuilder.h"
#include <wtf/ASCIICType.h>
#include <wtf/dtoa.h>
+#include <wtf/text/StringBuilder.h>
namespace JSC {
{
++m_ptr;
const CharType* runStart = m_ptr;
- UStringBuilder builder;
+ StringBuilder builder;
do {
runStart = m_ptr;
while (m_ptr < m_end && isSafeStringCharacter<mode, CharType, terminator>(*m_ptr))
} // uNNNN == 5 characters
for (int i = 1; i < 5; i++) {
if (!isASCIIHexDigit(m_ptr[i])) {
- m_lexErrorMessage = String::format("\"\\%s\" is not a valid unicode escape", UString(m_ptr, 5).ascii().data()).impl();
+ m_lexErrorMessage = String::format("\"\\%s\" is not a valid unicode escape", String(m_ptr, 5).ascii().data()).impl();
return TokError;
}
}
}
if (builder.isEmpty()) {
- token.stringBuffer = UString();
+ token.stringBuffer = String();
setParserTokenString<CharType>(token, runStart);
token.stringLength = m_ptr - runStart;
} else {
- token.stringBuffer = builder.toUString();
+ token.stringBuffer = builder.toString();
if (token.stringBuffer.is8Bit()) {
token.stringIs8Bit = 1;
token.stringToken8 = token.stringBuffer.characters8();
case TokIdentifier: {
const LiteralParserToken<CharType>& token = m_lexer.currentToken();
if (token.stringIs8Bit)
- m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", UString(m_lexer.currentToken().stringToken8, m_lexer.currentToken().stringLength).ascii().data()).impl();
+ m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken8, m_lexer.currentToken().stringLength).ascii().data()).impl();
else
- m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", UString(m_lexer.currentToken().stringToken16, m_lexer.currentToken().stringLength).ascii().data()).impl();
+ m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken16, m_lexer.currentToken().stringLength).ascii().data()).impl();
return JSValue();
}
case TokColon:
#include "Identifier.h"
#include "JSGlobalObjectFunctions.h"
#include "JSValue.h"
-#include "UString.h"
+#include <wtf/text/WTFString.h>
namespace JSC {
TokenType type;
const CharType* start;
const CharType* end;
- UString stringBuffer;
+ String stringBuffer;
union {
double numberToken;
struct {
{
}
- UString getErrorMessage()
+ String getErrorMessage()
{
if (!m_lexer.getErrorMessage().isEmpty())
return String::format("JSON Parse error: %s", m_lexer.getErrorMessage().ascii().data()).impl();
return m_currentToken;
}
- UString getErrorMessage() { return m_lexErrorMessage; }
+ String getErrorMessage() { return m_lexErrorMessage; }
private:
- UString m_lexErrorMessage;
+ String m_lexErrorMessage;
template <ParserMode mode> TokenType lex(LiteralParserToken<CharType>&);
ALWAYS_INLINE TokenType lexIdentifier(LiteralParserToken<CharType>&);
template <ParserMode mode, char terminator> ALWAYS_INLINE TokenType lexString(LiteralParserToken<CharType>&);
ExecState* m_exec;
typename LiteralParser<CharType>::Lexer m_lexer;
ParserMode m_mode;
- UString m_parseErrorMessage;
+ String m_parseErrorMessage;
static unsigned const MaximumCachableCharacter = 128;
FixedArray<Identifier, MaximumCachableCharacter> m_shortIdentifiers;
FixedArray<Identifier, MaximumCachableCharacter> m_recentIdentifiers;
public:
typedef InternalFunction Base;
- static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const UString& name)
+ static NativeErrorConstructor* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, Structure* prototypeStructure, const String& name)
{
NativeErrorConstructor* constructor = new (NotNull, allocateCell<NativeErrorConstructor>(*exec->heap())) NativeErrorConstructor(globalObject, structure);
constructor->finishCreation(exec, globalObject, prototypeStructure, name);
Structure* errorStructure() { return m_errorStructure.get(); }
protected:
- void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const UString& name)
+ void finishCreation(ExecState* exec, JSGlobalObject* globalObject, Structure* prototypeStructure, const String& name)
{
Base::finishCreation(exec->globalData(), name);
ASSERT(inherits(&s_info));
#include "JSGlobalObject.h"
#include "JSString.h"
#include "NativeErrorConstructor.h"
-#include "UString.h"
namespace JSC {
{
}
-void NativeErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, const UString& nameAndMessage, NativeErrorConstructor* constructor)
+void NativeErrorPrototype::finishCreation(ExecState* exec, JSGlobalObject* globalObject, const WTF::String& nameAndMessage, NativeErrorConstructor* constructor)
{
Base::finishCreation(exec, globalObject);
putDirect(exec->globalData(), exec->propertyNames().name, jsString(exec, nameAndMessage), DontEnum);
public:
typedef ErrorPrototype Base;
- static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const UString& name, NativeErrorConstructor* constructor)
+ static NativeErrorPrototype* create(ExecState* exec, JSGlobalObject* globalObject, Structure* structure, const String& name, NativeErrorConstructor* constructor)
{
NativeErrorPrototype* prototype = new (NotNull, allocateCell<NativeErrorPrototype>(*exec->heap())) NativeErrorPrototype(exec, structure);
prototype->finishCreation(exec, globalObject, name, constructor);
}
protected:
- void finishCreation(ExecState*, JSGlobalObject*, const UString& nameAndMessage, NativeErrorConstructor*);
+ void finishCreation(ExecState*, JSGlobalObject*, const String& nameAndMessage, NativeErrorConstructor*);
};
} // namespace JSC
return startOfResultString;
}
-static UString toUStringWithRadix(int32_t number, unsigned radix)
+static String toStringWithRadix(int32_t number, unsigned radix)
{
LChar buf[1 + 32]; // Worst case is radix == 2, which gives us 32 digits + sign.
LChar* end = buf + WTF_ARRAY_LENGTH(buf);
if (negative)
*--p = '-';
- return UString(p, static_cast<unsigned>(end - p));
+ return String(p, static_cast<unsigned>(end - p));
}
// toExponential converts a number to a string, always formatting as an expoential.
// Handle NaN and Infinity.
if (!isfinite(x))
- return JSValue::encode(jsString(exec, UString::numberToStringECMAScript(x)));
+ return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
// Round if the argument is not undefined, always format as exponential.
char buffer[WTF::NumberToStringBufferLength];
isUndefined
? converter.ToExponential(x, -1, &builder)
: converter.ToExponential(x, decimalPlacesInExponent, &builder);
- return JSValue::encode(jsString(exec, UString(builder.Finalize())));
+ return JSValue::encode(jsString(exec, String(builder.Finalize())));
}
// toFixed converts a number to a string, always formatting as an a decimal fraction.
// This also covers Ininity, and structure the check so that NaN
// values are also handled by numberToString
if (!(fabs(x) < 1e+21))
- return JSValue::encode(jsString(exec, UString::numberToStringECMAScript(x)));
+ return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
// The check above will return false for NaN or Infinity, these will be
// handled by numberToString.
ASSERT(isfinite(x));
NumberToStringBuffer buffer;
- return JSValue::encode(jsString(exec, UString(numberToFixedWidthString(x, decimalPlaces, buffer))));
+ return JSValue::encode(jsString(exec, String(numberToFixedWidthString(x, decimalPlaces, buffer))));
}
// toPrecision converts a number to a string, takeing an argument specifying a
// To precision called with no argument is treated as ToString.
if (isUndefined)
- return JSValue::encode(jsString(exec, UString::numberToStringECMAScript(x)));
+ return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
// Handle NaN and Infinity.
if (!isfinite(x))
- return JSValue::encode(jsString(exec, UString::numberToStringECMAScript(x)));
+ return JSValue::encode(jsString(exec, String::numberToStringECMAScript(x)));
NumberToStringBuffer buffer;
- return JSValue::encode(jsString(exec, UString(numberToFixedPrecisionString(x, significantFigures, buffer))));
+ return JSValue::encode(jsString(exec, String(numberToFixedPrecisionString(x, significantFigures, buffer))));
}
static inline int32_t extractRadixFromArgs(ExecState* exec)
return JSValue::encode(jsString(globalData, globalData->numericStrings.add(value)));
}
- return JSValue::encode(jsString(exec, toUStringWithRadix(value, radix)));
+ return JSValue::encode(jsString(exec, toStringWithRadix(value, radix)));
}
}
if (!isfinite(doubleValue))
- return JSValue::encode(jsString(exec, UString::numberToStringECMAScript(doubleValue)));
+ return JSValue::encode(jsString(exec, String::numberToStringECMAScript(doubleValue)));
RadixBuffer s;
return JSValue::encode(jsString(exec, toStringWithRadix(s, doubleValue, radix)));
#ifndef NumericStrings_h
#define NumericStrings_h
-#include "UString.h"
#include <wtf/FixedArray.h>
#include <wtf/HashFunctions.h>
+#include <wtf/text/WTFString.h>
namespace JSC {
class NumericStrings {
public:
- ALWAYS_INLINE UString add(double d)
+ ALWAYS_INLINE String add(double d)
{
CacheEntry<double>& entry = lookup(d);
if (d == entry.key && !entry.value.isNull())
return entry.value;
entry.key = d;
- entry.value = UString::numberToStringECMAScript(d);
+ entry.value = String::numberToStringECMAScript(d);
return entry.value;
}
- ALWAYS_INLINE UString add(int i)
+ ALWAYS_INLINE String add(int i)
{
if (static_cast<unsigned>(i) < cacheSize)
return lookupSmallString(static_cast<unsigned>(i));
if (i == entry.key && !entry.value.isNull())
return entry.value;
entry.key = i;
- entry.value = UString::number(i);
+ entry.value = String::number(i);
return entry.value;
}
- ALWAYS_INLINE UString add(unsigned i)
+ ALWAYS_INLINE String add(unsigned i)
{
if (i < cacheSize)
return lookupSmallString(static_cast<unsigned>(i));
if (i == entry.key && !entry.value.isNull())
return entry.value;
entry.key = i;
- entry.value = UString::number(i);
+ entry.value = String::number(i);
return entry.value;
}
private:
template<typename T>
struct CacheEntry {
T key;
- UString value;
+ String value;
};
CacheEntry<double>& lookup(double d) { return doubleCache[WTF::FloatHash<double>::hash(d) & (cacheSize - 1)]; }
CacheEntry<int>& lookup(int i) { return intCache[WTF::IntHash<int>::hash(i) & (cacheSize - 1)]; }
CacheEntry<unsigned>& lookup(unsigned i) { return unsignedCache[WTF::IntHash<unsigned>::hash(i) & (cacheSize - 1)]; }
- ALWAYS_INLINE const UString& lookupSmallString(unsigned i)
+ ALWAYS_INLINE const String& lookupSmallString(unsigned i)
{
ASSERT(i < cacheSize);
if (smallIntCache[i].isNull())
- smallIntCache[i] = UString::number(i);
+ smallIntCache[i] = String::number(i);
return smallIntCache[i];
}
FixedArray<CacheEntry<double>, cacheSize> doubleCache;
FixedArray<CacheEntry<int>, cacheSize> intCache;
FixedArray<CacheEntry<unsigned>, cacheSize> unsignedCache;
- FixedArray<UString, cacheSize> smallIntCache;
+ FixedArray<String, cacheSize> smallIntCache;
};
} // namespace JSC
{
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, "Requested property descriptor of a value that is not an object."));
- UString propertyName = exec->argument(1).toString(exec)->value(exec);
+ String propertyName = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
JSObject* object = asObject(exec->argument(0));
if (!exec->argument(0).isObject())
return throwVMError(exec, createTypeError(exec, "Properties can only be defined on Objects."));
JSObject* O = asObject(exec->argument(0));
- UString propertyName = exec->argument(1).toString(exec)->value(exec);
+ String propertyName = exec->argument(1).toString(exec)->value(exec);
if (exec->hadException())
return JSValue::encode(jsNull());
PropertyDescriptor descriptor;
return JSRopeString::create(globalData, s1, s2);
}
- ALWAYS_INLINE JSValue jsString(ExecState* exec, const UString& u1, const UString& u2, const UString& u3)
+ ALWAYS_INLINE JSValue jsString(ExecState* exec, const String& u1, const String& u2, const String& u3)
{
JSGlobalData* globalData = &exec->globalData();
return v1.asNumber() < v2.asNumber();
if (isJSString(v1) && isJSString(v2))
- return asString(v1)->value(callFrame) < asString(v2)->value(callFrame);
+ return codePointCompareLessThan(asString(v1)->value(callFrame), asString(v2)->value(callFrame));
double n1;
double n2;
if (wasNotString1 | wasNotString2)
return n1 < n2;
- return asString(p1)->value(callFrame) < asString(p2)->value(callFrame);
+ return codePointCompareLessThan(asString(p1)->value(callFrame), asString(p2)->value(callFrame));
}
// See ES5 11.8.3/11.8.4/11.8.5 for definition of leftFirst, this value ensures correct
return v1.asNumber() <= v2.asNumber();
if (isJSString(v1) && isJSString(v2))
- return !(asString(v2)->value(callFrame) < asString(v1)->value(callFrame));
+ return !codePointCompareLessThan(asString(v2)->value(callFrame), asString(v1)->value(callFrame));
double n1;
double n2;
if (wasNotString1 | wasNotString2)
return n1 <= n2;
- return !(asString(p2)->value(callFrame) < asString(p1)->value(callFrame));
+ return !codePointCompareLessThan(asString(p2)->value(callFrame), asString(p1)->value(callFrame));
}
// Fast-path choices here are based on frequency data from SunSpider:
#define PropertyMapHashTable_h
#include "PropertyOffset.h"
-#include "UString.h"
#include "WriteBarrier.h"
#include <wtf/HashTable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/Vector.h>
+#include <wtf/text/StringImpl.h>
#ifndef NDEBUG
#endif
-#define PROPERTY_MAP_DELETED_ENTRY_KEY ((StringImpl*)1)
+#define PROPERTY_MAP_DELETED_ENTRY_KEY ((StringImpl*)1)
namespace JSC {
const ClassInfo RegExp::s_info = { "RegExp", 0, 0, 0, CREATE_METHOD_TABLE(RegExp) };
-RegExpFlags regExpFlags(const UString& string)
+RegExpFlags regExpFlags(const String& string)
{
RegExpFlags flags = NoFlags;
~RegExpFunctionalTestCollector();
- void outputOneTest(RegExp*, UString, int, int*, int);
+ void outputOneTest(RegExp*, String, int, int*, int);
void clearRegExp(RegExp* regExp)
{
if (regExp == m_lastRegExp)
private:
RegExpFunctionalTestCollector();
- void outputEscapedUString(const UString&, bool escapeSlash = false);
+ void outputEscapedString(const String&, bool escapeSlash = false);
static RegExpFunctionalTestCollector* s_instance;
FILE* m_file;
return s_instance;
}
-void RegExpFunctionalTestCollector::outputOneTest(RegExp* regExp, UString s, int startOffset, int* ovector, int result)
+void RegExpFunctionalTestCollector::outputOneTest(RegExp* regExp, String s, int startOffset, int* ovector, int result)
{
if ((!m_lastRegExp) || (m_lastRegExp != regExp)) {
m_lastRegExp = regExp;
fputc('/', m_file);
- outputEscapedUString(regExp->pattern(), true);
+ outputEscapedString(regExp->pattern(), true);
fputc('/', m_file);
if (regExp->global())
fputc('g', m_file);
}
fprintf(m_file, " \"");
- outputEscapedUString(s);
+ outputEscapedString(s);
fprintf(m_file, "\", %d, %d, (", startOffset, result);
for (unsigned i = 0; i <= regExp->numSubpatterns(); i++) {
int subpatternBegin = ovector[i * 2];
s_instance = 0;
}
-void RegExpFunctionalTestCollector::outputEscapedUString(const UString& s, bool escapeSlash)
+void RegExpFunctionalTestCollector::outputEscapedString(const String& s, bool escapeSlash)
{
int len = s.length();
}
#endif
-RegExp::RegExp(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags)
+RegExp::RegExp(JSGlobalData& globalData, const String& patternString, RegExpFlags flags)
: JSCell(globalData, globalData.regExpStructure.get())
, m_state(NotCompiled)
, m_patternString(patternString)
thisObject->RegExp::~RegExp();
}
-RegExp* RegExp::createWithoutCaching(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags)
+RegExp* RegExp::createWithoutCaching(JSGlobalData& globalData, const String& patternString, RegExpFlags flags)
{
RegExp* regExp = new (NotNull, allocateCell<RegExp>(globalData.heap)) RegExp(globalData, patternString, flags);
regExp->finishCreation(globalData);
return regExp;
}
-RegExp* RegExp::create(JSGlobalData& globalData, const UString& patternString, RegExpFlags flags)
+RegExp* RegExp::create(JSGlobalData& globalData, const String& patternString, RegExpFlags flags)
{
return globalData.regExpCache()->lookupOrCreate(patternString, flags);
}
compile(&globalData, charSize);
}
-int RegExp::match(JSGlobalData& globalData, const UString& s, unsigned startOffset, Vector<int, 32>& ovector)
+int RegExp::match(JSGlobalData& globalData, const String& s, unsigned startOffset, Vector<int, 32>& ovector)
{
#if ENABLE(REGEXP_TRACING)
m_rtMatchCallCount++;
compileMatchOnly(&globalData, charSize);
}
-MatchResult RegExp::match(JSGlobalData& globalData, const UString& s, unsigned startOffset)
+MatchResult RegExp::match(JSGlobalData& globalData, const String& s, unsigned startOffset)
{
#if ENABLE(REGEXP_TRACING)
m_rtMatchCallCount++;
}
#if ENABLE(YARR_JIT_DEBUG)
-void RegExp::matchCompareWithInterpreter(const UString& s, int startOffset, int* offsetVector, int jitResult)
+void RegExp::matchCompareWithInterpreter(const String& s, int startOffset, int* offsetVector, int jitResult)
{
int offsetVectorSize = (m_numSubpatterns + 1) * 2;
Vector<int, 32> interpreterOvector;
#include "MatchResult.h"
#include "RegExpKey.h"
#include "Structure.h"
-#include "UString.h"
#include "yarr/Yarr.h"
#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
+#include <wtf/text/WTFString.h>
#if ENABLE(YARR_JIT)
#include "yarr/YarrJIT.h"
struct RegExpRepresentation;
class JSGlobalData;
- JS_EXPORT_PRIVATE RegExpFlags regExpFlags(const UString&);
+ JS_EXPORT_PRIVATE RegExpFlags regExpFlags(const String&);
class RegExp : public JSCell {
public:
typedef JSCell Base;
- JS_EXPORT_PRIVATE static RegExp* create(JSGlobalData&, const UString& pattern, RegExpFlags);
+ JS_EXPORT_PRIVATE static RegExp* create(JSGlobalData&, const String& pattern, RegExpFlags);
static void destroy(JSCell*);
bool global() const { return m_flags & FlagGlobal; }
bool ignoreCase() const { return m_flags & FlagIgnoreCase; }
bool multiline() const { return m_flags & FlagMultiline; }
- const UString& pattern() const { return m_patternString; }
+ const String& pattern() const { return m_patternString; }
bool isValid() const { return !m_constructionError && m_flags != InvalidFlags; }
const char* errorMessage() const { return m_constructionError; }
- JS_EXPORT_PRIVATE int match(JSGlobalData&, const UString&, unsigned startOffset, Vector<int, 32>& ovector);
- MatchResult match(JSGlobalData&, const UString&, unsigned startOffset);
+ JS_EXPORT_PRIVATE int match(JSGlobalData&, const String&, unsigned startOffset, Vector<int, 32>& ovector);
+ MatchResult match(JSGlobalData&, const String&, unsigned startOffset);
unsigned numSubpatterns() const { return m_numSubpatterns; }
bool hasCode()
private:
friend class RegExpCache;
- RegExp(JSGlobalData&, const UString&, RegExpFlags);
+ RegExp(JSGlobalData&, const String&, RegExpFlags);
- static RegExp* createWithoutCaching(JSGlobalData&, const UString&, RegExpFlags);
+ static RegExp* createWithoutCaching(JSGlobalData&, const String&, RegExpFlags);
enum RegExpState {
ParseError,
void compileIfNecessaryMatchOnly(JSGlobalData&, Yarr::YarrCharSize);
#if ENABLE(YARR_JIT_DEBUG)
- void matchCompareWithInterpreter(const UString&, int startOffset, int* offsetVector, int jitResult);
+ void matchCompareWithInterpreter(const String&, int startOffset, int* offsetVector, int jitResult);
#endif
- UString m_patternString;
+ String m_patternString;
RegExpFlags m_flags;
const char* m_constructionError;
unsigned m_numSubpatterns;
namespace JSC {
-RegExp* RegExpCache::lookupOrCreate(const UString& patternString, RegExpFlags flags)
+RegExp* RegExpCache::lookupOrCreate(const String& patternString, RegExpFlags flags)
{
RegExpKey key(flags, patternString);
if (RegExp* regExp = m_weakCache.get(key))
void RegExpCache::addToStrongCache(RegExp* regExp)
{
- UString pattern = regExp->pattern();
+ String pattern = regExp->pattern();
if (pattern.length() > maxStrongCacheablePatternLength)
return;
m_strongCache[m_nextEntryInStrongCache].set(*m_globalData, regExp);