Ignore:
Timestamp:
Mar 28, 2008, 1:21:39 PM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Sam Weinig.

Fix a dtoa thread safety issue.

WebCore can call kjs_strtod without holding JS lock, but we didn't have thread safety
compiled in for dtoa.

This is a 0.5% regression on SunSpider, which Sam Weinig has volunteered to cover with
his recent improvement.

  • kjs/dtoa.cpp: (Bigint::Balloc): (Bigint::Bfree): Changed to use fastMalloc/fastDelete - they are much faster than the dtoa custom version was in the presence of locking (but somewhat slower in single-threaded case). (Bigint::pow5mult): Got rid of the dreaded double-checked locking anti-pattern (had to restructure the code to avoid significant performance implications). (Bigint::lshift): Rewrote to avoid an allocation, if possible.

(Bigint::rv_alloc):
(Bigint::kjs_freedtoa):
(Bigint::kjs_dtoa):
Check for USE(MULTIPLE_THREADS), not dtoa legacy MULTIPLE_THREADS.

  • kjs/InitializeThreading.cpp: Added. (KJS::initializeThreading):
  • kjs/InitializeThreading.h: Added. Initialize threading at KJS level, if enabled.
  • kjs/dtoa.h: Expose dtoa mutex for KJS::initializeThreading.
  • kjs/testkjs.cpp: (kjsmain): Call initializeThreading.
  • wtf/Threading.h: Removed a using directive for WTF::initializeThreading - it is only to be called from KJS::initializeThreading, and having it in the global namespace is useless.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r31398 r31404  
    1 _JSCheckScriptSyntax
    2 _JSClassCreate
    3 _JSClassRelease
    4 _JSClassRetain
    5 _JSContextGetGlobalObject
    6 _JSEvaluateScript
    7 _JSGarbageCollect
    8 _JSGlobalContextCreate
    9 _JSGlobalContextRelease
    10 _JSGlobalContextRetain
    11 _JSObjectCallAsConstructor
    12 _JSObjectCallAsFunction
    13 _JSObjectCopyPropertyNames
    14 _JSObjectDeleteProperty
    15 _JSObjectGetPrivate
    16 _JSObjectGetProperty
    17 _JSObjectGetPropertyAtIndex
    18 _JSObjectGetPrototype
    19 _JSObjectHasProperty
    20 _JSObjectIsConstructor
    21 _JSObjectIsFunction
    22 _JSObjectMake
    23 _JSObjectMakeConstructor
    24 _JSObjectMakeFunction
    25 _JSObjectMakeFunctionWithCallback
    26 _JSObjectSetPrivate
    27 _JSObjectSetProperty
    28 _JSObjectSetPropertyAtIndex
    29 _JSObjectSetPrototype
    30 _JSPropertyNameAccumulatorAddName
    31 _JSPropertyNameArrayGetCount
    32 _JSPropertyNameArrayGetNameAtIndex
    33 _JSPropertyNameArrayRelease
    34 _JSPropertyNameArrayRetain
    35 _JSStringCopyCFString
    36 _JSStringCreateWithCFString
    37 _JSStringCreateWithCharacters
    38 _JSStringCreateWithUTF8CString
    39 _JSStringGetCharactersPtr
    40 _JSStringGetLength
    41 _JSStringGetMaximumUTF8CStringSize
    42 _JSStringGetUTF8CString
    43 _JSStringIsEqual
    44 _JSStringIsEqualToUTF8CString
    45 _JSStringRelease
    46 _JSStringRetain
    47 _JSValueGetType
    48 _JSValueIsBoolean
    49 _JSValueIsEqual
    50 _JSValueIsInstanceOfConstructor
    51 _JSValueIsNull
    52 _JSValueIsNumber
    53 _JSValueIsObject
    54 _JSValueIsObjectOfClass
    55 _JSValueIsStrictEqual
    56 _JSValueIsString
    57 _JSValueIsUndefined
    58 _JSValueMakeBoolean
    59 _JSValueMakeNull
    60 _JSValueMakeNumber
    61 _JSValueMakeString
    62 _JSValueMakeUndefined
    63 _JSValueProtect
    64 _JSValueToBoolean
    65 _JSValueToNumber
    66 _JSValueToObject
    67 _JSValueToStringCopy
    68 _JSValueUnprotect
    69 _WTFLog
    70 _WTFLogVerbose
    71 _WTFReportArgumentAssertionFailure
    72 _WTFReportAssertionFailure
    73 _WTFReportAssertionFailureWithMessage
    74 _WTFReportError
    75 _WTFReportFatalError
    761__Z12jsRegExpFreeP8JSRegExp
    772__Z15jsRegExpCompilePKti24JSRegExpIgnoreCaseOption23JSRegExpMultilineOptionPjPPKc
     
    9823__ZN3KJS11PropertyMapD1Ev
    9924__ZN3KJS12DateInstance4infoE
     25__ZN3KJS12jsNumberCellEd
    10026__ZN3KJS12PropertySlot15undefinedGetterEPNS_9ExecStateEPNS_8JSObjectERKNS_10IdentifierERKS0_
    101 __ZN3KJS12jsNumberCellEd
    10227__ZN3KJS13ArrayInstance4infoE
     28__ZN3KJS13jsOwnedStringERKNS_7UStringE
    10329__ZN3KJS13StatementNode6setLocEii
    104 __ZN3KJS13jsOwnedStringERKNS_7UStringE
    10530__ZN3KJS14JSGlobalObject10globalExecEv
    10631__ZN3KJS14JSGlobalObject15restoreBuiltinsERKNS_13SavedBuiltinsE
     
    11641__ZN3KJS14StringInstance14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    11742__ZN3KJS14StringInstance16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
     43__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    11844__ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateERKNS_10IdentifierERNS_12PropertySlotE
    119 __ZN3KJS14StringInstance18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
    12045__ZN3KJS14StringInstance3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    12146__ZN3KJS14StringInstance4infoE
     
    13257__ZN3KJS16ParserRefCounted5derefEv
    13358__ZN3KJS17PropertyNameArray3addERKNS_10IdentifierE
     59__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    13460__ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEPNS_17FunctionPrototypeEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
    135 __ZN3KJS17PrototypeFunctionC1EPNS_9ExecStateEiRKNS_10IdentifierEPFPNS_7JSValueES2_PNS_8JSObjectERKNS_4ListEE
     61__ZN3KJS19initializeThreadingEv
    13662__ZN3KJS19InternalFunctionImp4infoE
    13763__ZN3KJS19InternalFunctionImpC2EPNS_17FunctionPrototypeERKNS_10IdentifierE
     
    14975__ZN3KJS6Parser5parseEiPKtjPiS3_PNS_7UStringE
    15076__ZN3KJS6parserEv
     77__ZN3KJS7CStringaSERKS0_
    15178__ZN3KJS7CStringD1Ev
    152 __ZN3KJS7CStringaSERKS0_
    15379__ZN3KJS7UString3Rep11computeHashEPKti
    15480__ZN3KJS7UString3Rep4nullE
     
    15783__ZN3KJS7UString6appendEPKc
    15884__ZN3KJS7UString6appendERKS0_
     85__ZN3KJS7UStringaSEPKc
    15986__ZN3KJS7UStringC1EPKc
    16087__ZN3KJS7UStringC1EPKti
    16188__ZN3KJS7UStringC1ERKS0_S2_
    162 __ZN3KJS7UStringaSEPKc
    16389__ZN3KJS8Debugger12sourceUnusedEPNS_9ExecStateEi
    16490__ZN3KJS8Debugger6attachEPNS_14JSGlobalObjectE
     
    17096__ZN3KJS8JSObject12removeDirectERKNS_10IdentifierE
    17197__ZN3KJS8JSObject14callAsFunctionEPNS_9ExecStateEPS0_RKNS_4ListE
     98__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    17299__ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateERKNS_10IdentifierE
    173 __ZN3KJS8JSObject14deletePropertyEPNS_9ExecStateEj
    174100__ZN3KJS8JSObject16getPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayE
    175101__ZN3KJS8JSObject17putDirectFunctionEPNS_19InternalFunctionImpEi
     
    177103__ZN3KJS8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRPNS_7JSValueE
    178104__ZN3KJS8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPPNS_7JSValueE
     105__ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
    179106__ZN3KJS8JSObject3putEPNS_9ExecStateERKNS_10IdentifierEPNS_7JSValueE
    180 __ZN3KJS8JSObject3putEPNS_9ExecStateEjPNS_7JSValueE
    181107__ZN3KJS8JSObject4callEPNS_9ExecStateEPS0_RKNS_4ListE
    182108__ZN3KJS8JSObject4markEv
    183109__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListE
    184110__ZN3KJS8JSObject9constructEPNS_9ExecStateERKNS_4ListERKNS_10IdentifierERKNS_7UStringEi
     111__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEii
    185112__ZN3KJS8JSObject9putDirectERKNS_10IdentifierEPNS_7JSValueEi
    186 __ZN3KJS8JSObject9putDirectERKNS_10IdentifierEii
    187113__ZN3KJS8jsStringEPKc
    188114__ZN3KJS8jsStringERKNS_7UStringE
     
    253179__ZNK3KJS7UString8toUInt32EPb
    254180__ZNK3KJS7UString8toUInt32EPbb
     181__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
    255182__ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateERKNS_10IdentifierE
    256 __ZNK3KJS8JSObject11hasPropertyEPNS_9ExecStateEj
    257183__ZNK3KJS8JSObject12defaultValueEPNS_9ExecStateENS_6JSTypeE
    258184__ZNK3KJS8JSObject14implementsCallEv
     
    260186__ZNK3KJS8JSObject21getPropertyAttributesERKNS_10IdentifierERj
    261187__ZNK3KJS8JSObject21implementsHasInstanceEv
     188__ZNK3KJS8JSObject3getEPNS_9ExecStateEj
    262189__ZNK3KJS8JSObject3getEPNS_9ExecStateERKNS_10IdentifierE
    263 __ZNK3KJS8JSObject3getEPNS_9ExecStateEj
    264190__ZNK3KJS8JSObject4typeEv
    265191__ZNK3KJS8JSObject8toNumberEPNS_9ExecStateE
     
    278204__ZTVN3KJS19InternalFunctionImpE
    279205__ZTVN3KJS8JSObjectE
     206_JSCheckScriptSyntax
     207_JSClassCreate
     208_JSClassRelease
     209_JSClassRetain
     210_JSContextGetGlobalObject
    280211_jscore_collector_introspection
    281212_jscore_fastmalloc_introspection
     213_JSEvaluateScript
     214_JSGarbageCollect
     215_JSGlobalContextCreate
     216_JSGlobalContextRelease
     217_JSGlobalContextRetain
     218_JSObjectCallAsConstructor
     219_JSObjectCallAsFunction
     220_JSObjectCopyPropertyNames
     221_JSObjectDeleteProperty
     222_JSObjectGetPrivate
     223_JSObjectGetProperty
     224_JSObjectGetPropertyAtIndex
     225_JSObjectGetPrototype
     226_JSObjectHasProperty
     227_JSObjectIsConstructor
     228_JSObjectIsFunction
     229_JSObjectMake
     230_JSObjectMakeConstructor
     231_JSObjectMakeFunction
     232_JSObjectMakeFunctionWithCallback
     233_JSObjectSetPrivate
     234_JSObjectSetProperty
     235_JSObjectSetPropertyAtIndex
     236_JSObjectSetPrototype
     237_JSPropertyNameAccumulatorAddName
     238_JSPropertyNameArrayGetCount
     239_JSPropertyNameArrayGetNameAtIndex
     240_JSPropertyNameArrayRelease
     241_JSPropertyNameArrayRetain
     242_JSStringCopyCFString
     243_JSStringCreateWithCFString
     244_JSStringCreateWithCharacters
     245_JSStringCreateWithUTF8CString
     246_JSStringGetCharactersPtr
     247_JSStringGetLength
     248_JSStringGetMaximumUTF8CStringSize
     249_JSStringGetUTF8CString
     250_JSStringIsEqual
     251_JSStringIsEqualToUTF8CString
     252_JSStringRelease
     253_JSStringRetain
     254_JSValueGetType
     255_JSValueIsBoolean
     256_JSValueIsEqual
     257_JSValueIsInstanceOfConstructor
     258_JSValueIsNull
     259_JSValueIsNumber
     260_JSValueIsObject
     261_JSValueIsObjectOfClass
     262_JSValueIsStrictEqual
     263_JSValueIsString
     264_JSValueIsUndefined
     265_JSValueMakeBoolean
     266_JSValueMakeNull
     267_JSValueMakeNumber
     268_JSValueMakeString
     269_JSValueMakeUndefined
     270_JSValueProtect
     271_JSValueToBoolean
     272_JSValueToNumber
     273_JSValueToObject
     274_JSValueToStringCopy
     275_JSValueUnprotect
     276_kjs_strtod
    282277_kJSClassDefinitionEmpty
    283 _kjs_strtod
     278_WTFLog
     279_WTFLogVerbose
     280_WTFReportArgumentAssertionFailure
     281_WTFReportAssertionFailure
     282_WTFReportAssertionFailureWithMessage
     283_WTFReportError
     284_WTFReportFatalError
Note: See TracChangeset for help on using the changeset viewer.