Ignore:
Timestamp:
Feb 4, 2010, 6:31:35 PM (15 years ago)
Author:
[email protected]
Message:

Add a JSStringBuilder class (similar-to, and derived-from StringBuilder) to
construct JSStrings, throwing a JS exception should we run out of memory whilst
allocating storage for the string.

Reviewed by Oliver Hunt.

Similarly, add jsMakeNontrivialString methods to use in cases where previously
we were calling makeString & passing the result to jsNontrivialString. Again,
these new methods throw if we hit an out of memory condition.

Move throwOutOfMemoryError into ExceptionHelpers, to make it more widely available.

  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/ArrayPrototype.cpp:

(JSC::arrayProtoFuncToString):
(JSC::arrayProtoFuncToLocaleString):
(JSC::arrayProtoFuncJoin):

  • runtime/DateConstructor.cpp:

(JSC::callDate):

  • runtime/DatePrototype.cpp:

(JSC::dateProtoFuncToString):
(JSC::dateProtoFuncToUTCString):
(JSC::dateProtoFuncToGMTString):

  • runtime/ErrorPrototype.cpp:

(JSC::errorProtoFuncToString):

  • runtime/ExceptionHelpers.cpp:

(JSC::throwOutOfMemoryError):

  • runtime/ExceptionHelpers.h:
  • runtime/JSStringBuilder.h: Added.

(JSC::JSStringBuilder::releaseJSString):
(JSC::jsMakeNontrivialString):

  • runtime/NumberPrototype.cpp:

(JSC::numberProtoFuncToPrecision):

  • runtime/ObjectPrototype.cpp:

(JSC::objectProtoFuncToString):

  • runtime/Operations.cpp:
  • runtime/Operations.h:
  • runtime/RegExpPrototype.cpp:

(JSC::regExpProtoFuncToString):

  • runtime/StringBuilder.h:

(JSC::StringBuilder::append):

  • runtime/StringPrototype.cpp:

(JSC::stringProtoFuncBig):
(JSC::stringProtoFuncSmall):
(JSC::stringProtoFuncBlink):
(JSC::stringProtoFuncBold):
(JSC::stringProtoFuncFixed):
(JSC::stringProtoFuncItalics):
(JSC::stringProtoFuncStrike):
(JSC::stringProtoFuncSub):
(JSC::stringProtoFuncSup):
(JSC::stringProtoFuncFontcolor):
(JSC::stringProtoFuncFontsize):
(JSC::stringProtoFuncAnchor):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r54102 r54394  
    233233                86DB64640F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */; };
    234234                86E116B10FE75AC800B512BC /* CodeLocation.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E116B00FE75AC800B512BC /* CodeLocation.h */; };
     235                86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */ = {isa = PBXBuildFile; fileRef = 86E85538111B9968001AF51E /* JSStringBuilder.h */; };
    235236                86EAC4950F93E8D1008EC948 /* RegexCompiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */; };
    236237                86EAC4960F93E8D1008EC948 /* RegexCompiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */; };
     
    767768                86DB64630F95C6FC00D7D921 /* ExecutableAllocatorFixedVMPool.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ExecutableAllocatorFixedVMPool.cpp; sourceTree = "<group>"; };
    768769                86E116B00FE75AC800B512BC /* CodeLocation.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodeLocation.h; sourceTree = "<group>"; };
     770                86E85538111B9968001AF51E /* JSStringBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSStringBuilder.h; sourceTree = "<group>"; };
    769771                86EAC48D0F93E8D1008EC948 /* RegexCompiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RegexCompiler.cpp; path = yarr/RegexCompiler.cpp; sourceTree = "<group>"; };
    770772                86EAC48E0F93E8D1008EC948 /* RegexCompiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RegexCompiler.h; path = yarr/RegexCompiler.h; sourceTree = "<group>"; };
     
    15451547                                BC02E9B60E1842FA000F9297 /* JSString.cpp */,
    15461548                                F692A8620255597D01FF60F7 /* JSString.h */,
     1549                                86E85538111B9968001AF51E /* JSStringBuilder.h */,
    15471550                                14ABB454099C2A0F00E2A24F /* JSType.h */,
    15481551                                6507D2970E871E4A00D7D896 /* JSTypeInfo.h */,
     
    20512054                                1429DABF0ED263E700B89619 /* WRECParser.h in Headers */,
    20522055                                9688CB160ED12B4E001D649F /* X86Assembler.h in Headers */,
     2056                                86E85539111B9968001AF51E /* JSStringBuilder.h in Headers */,
    20532057                        );
    20542058                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.