Ignore:
Timestamp:
Dec 16, 2008, 1:15:22 PM (17 years ago)
Author:
Nikolas Zimmermann
Message:

Reviewed by Darin Adler.

Fixes: https://bugs.webkit.org/show_bug.cgi?id=22876

Unify random number generation in JavaScriptCore & WebCore, by introducing
wtf/RandomNumber.h and moving wtf_random/wtf_random_init out of MathExtras.h.

wtf_random_init() has been renamed to initializeRandomNumberGenerator() and
lives in it's own private header: wtf/RandomNumberSeed.h, only intended to
be used from within JavaScriptCore.

wtf_random() has been renamed to randomNumber() and lives in a public header
wtf/RandomNumber.h, usable from within JavaScriptCore & WebCore. It encapsulates
the code taking care of initializing the random number generator (only when
building without ENABLE(JSC_MULTIPLE_THREADS), otherwhise initializeThreading()
already took care of that).

Functional change on darwin: Use random() instead of rand(), as it got a larger
period (more randomness). HTMLFormElement already contains this implementation
and I just moved it in randomNumber(), as special case for PLATFORM(DARWIN).

File:
1 edited

Legend:

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

    r39229 r39337  
    3737                06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A20DAAD9C4003B174E /* MainThread.cpp */; };
    3838                06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 06D358A10DAAD9C4003B174E /* MainThreadMac.mm */; };
     39                088FA5BB0EF76D4300578E6F /* RandomNumber.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 088FA5B90EF76D4300578E6F /* RandomNumber.cpp */; };
     40                088FA5BC0EF76D4300578E6F /* RandomNumber.h in Headers */ = {isa = PBXBuildFile; fileRef = 088FA5BA0EF76D4300578E6F /* RandomNumber.h */; settings = {ATTRIBUTES = (Private, ); }; };
     41                08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */ = {isa = PBXBuildFile; fileRef = 08E279E80EF83B10007DB523 /* RandomNumberSeed.h */; };
    3942                140B7D1D0DC69AF7009C42B8 /* JSActivation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14DA818F0D99FD2000B0A4FB /* JSActivation.cpp */; };
    4043                140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = 140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    409412                06D358A20DAAD9C4003B174E /* MainThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MainThread.cpp; sourceTree = "<group>"; };
    410413                06D358A30DAAD9C4003B174E /* MainThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainThread.h; sourceTree = "<group>"; };
     414                088FA5B90EF76D4300578E6F /* RandomNumber.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RandomNumber.cpp; sourceTree = "<group>"; };
     415                088FA5BA0EF76D4300578E6F /* RandomNumber.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumber.h; sourceTree = "<group>"; };
     416                08E279E80EF83B10007DB523 /* RandomNumberSeed.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RandomNumberSeed.h; sourceTree = "<group>"; };
    411417                140D17D60E8AD4A9000CD17D /* JSBasePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSBasePrivate.h; sourceTree = "<group>"; };
    412418                141211020A48780900480255 /* minidom.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = minidom.c; path = tests/minidom.c; sourceTree = "<group>"; };
     
    10901096                                6580F795094070560082C219 /* PassRefPtr.h */,
    10911097                                65D6D87E09B5A32E0002E4D7 /* Platform.h */,
     1098                                088FA5B90EF76D4300578E6F /* RandomNumber.cpp */,
     1099                                088FA5BA0EF76D4300578E6F /* RandomNumber.h */,
     1100                                08E279E80EF83B10007DB523 /* RandomNumberSeed.h */,
    10921101                                1419D32C0CEA7CDE00FF507A /* RefCounted.h */,
    10931102                                905B02AD0E28640F006DF882 /* RefCountedLeakCounter.cpp */,
     
    15991608                                147B84630E6DE6B1004775A4 /* PutPropertySlot.h in Headers */,
    16001609                                1429DA4A0ED245EC00B89619 /* Quantifier.h in Headers */,
     1610                                088FA5BC0EF76D4300578E6F /* RandomNumber.h in Headers */,
     1611                                08E279E90EF83B10007DB523 /* RandomNumberSeed.h in Headers */,
    16011612                                BC18C4570E16F5CD00B34460 /* RefCounted.h in Headers */,
    16021613                                90D3469C0E285280009492EE /* RefCountedLeakCounter.h in Headers */,
     
    16291640                                BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */,
    16301641                                7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */,
     1642                                BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */,
    16311643                                BC9041480EB9250900FE26FA /* StructureTransitionTable.h in Headers */,
    16321644                                BC18C46B0E16F5CD00B34460 /* SymbolTable.h in Headers */,
     
    16611673                                BC18C44E0E16F5CD00B34460 /* pcre_internal.h in Headers */,
    16621674                                BC18C4720E16F5CD00B34460 /* ucpinternal.h in Headers */,
    1663                                 BCCF0D080EF0AAB900413C8F /* StructureStubInfo.h in Headers */,
    16641675                        );
    16651676                        runOnlyForDeploymentPostprocessing = 0;
     
    19902001                                95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */,
    19912002                                1C61516C0EBAC7A00031376F /* ProfilerServer.mm in Sources */,
     2003                                088FA5BB0EF76D4300578E6F /* RandomNumber.cpp in Sources */,
    19922004                                905B02AE0E28640F006DF882 /* RefCountedLeakCounter.cpp in Sources */,
    19932005                                1429D8850ED21C3D00B89619 /* SamplingTool.cpp in Sources */,
     
    19952007                                BCDE3B430E6C832D001453A7 /* Structure.cpp in Sources */,
    19962008                                7E4EE70F0EBB7A5B005934AA /* StructureChain.cpp in Sources */,
     2009                                BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */,
    19972010                                E1EE793D0D6C9B9200FEA3BA /* ThreadingPthreads.cpp in Sources */,
    19982011                                95CD41B30E1BF6560085358E /* TreeProfile.cpp in Sources */,
     
    20072020                                937013480CA97E0E00FA14D3 /* pcre_ucp_searchfuncs.cpp in Sources */,
    20082021                                93E26BD408B1514100F85226 /* pcre_xclass.cpp in Sources */,
    2009                                 BCCF0D0C0EF0B8A500413C8F /* StructureStubInfo.cpp in Sources */,
    20102022                        );
    20112023                        runOnlyForDeploymentPostprocessing = 0;
Note: See TracChangeset for help on using the changeset viewer.