Changeset 155473 in webkit
- Timestamp:
- Sep 10, 2013 2:16:42 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 11 added
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r155472 r155473 1 2013-09-10 Oliver Hunt <oliver@apple.com> 2 3 Support WeakMap 4 https://bugs.webkit.org/show_bug.cgi?id=120912 5 6 Reviewed by Geoffrey Garen. 7 8 Basic tests. 9 10 * js/basic-weakmap-expected.txt: Added. 11 * js/basic-weakmap.html: Added. 12 * js/script-tests/basic-weakmap.js: Added. 13 1 14 2013-09-10 Ryosuke Niwa <rniwa@webkit.org> 2 15 -
trunk/Source/JavaScriptCore/CMakeLists.txt
r155090 r155473 343 343 runtime/JSTypedArrays.cpp 344 344 runtime/JSVariableObject.cpp 345 runtime/JSWeakMap.cpp 345 346 runtime/JSWithScope.cpp 346 347 runtime/JSWrapperObject.cpp … … 397 398 runtime/Watchdog.cpp 398 399 runtime/WatchdogNone.cpp 400 runtime/WeakMapConstructor.cpp 401 runtime/WeakMapData.cpp 402 runtime/WeakMapPrototype.cpp 399 403 400 404 tools/CodeProfile.cpp -
trunk/Source/JavaScriptCore/ChangeLog
r155471 r155473 1 2013-09-09 Oliver Hunt <oliver@apple.com> 2 3 Support WeakMap 4 https://bugs.webkit.org/show_bug.cgi?id=120912 5 6 Reviewed by Geoffrey Garen. 7 8 Add support for ES6 WeakMap. Add the cluster of boilerplate 9 classes around the core WeakMapData class. 10 11 WeakMapData is a simple object->value hash table that uses a 12 combo of WeakReferenceHarvester to conditionally keep the weak 13 value reference live, and UnconditionalFinalizer to clean the 14 dead keys from the table post-GC. 15 16 * CMakeLists.txt: 17 * GNUmakefile.list.am: 18 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: 19 * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: 20 * JavaScriptCore.xcodeproj/project.pbxproj: 21 * Target.pri: 22 * runtime/CommonIdentifiers.h: 23 * runtime/JSGlobalObject.cpp: 24 * runtime/JSGlobalObject.h: 25 (JSC::JSGlobalObject::weakMapDataStructure): 26 * runtime/JSWeakMap.cpp: Added. 27 (JSC::JSWeakMap::finishCreation): 28 (JSC::JSWeakMap::visitChildren): 29 * runtime/JSWeakMap.h: Added. 30 (JSC::JSWeakMap::createStructure): 31 (JSC::JSWeakMap::create): 32 (JSC::JSWeakMap::weakMapData): 33 (JSC::JSWeakMap::JSWeakMap): 34 * runtime/WeakMapConstructor.cpp: Added. 35 (JSC::WeakMapConstructor::finishCreation): 36 (JSC::constructWeakMap): 37 (JSC::WeakMapConstructor::getConstructData): 38 (JSC::WeakMapConstructor::getCallData): 39 * runtime/WeakMapConstructor.h: Added. 40 (JSC::WeakMapConstructor::create): 41 (JSC::WeakMapConstructor::createStructure): 42 (JSC::WeakMapConstructor::WeakMapConstructor): 43 * runtime/WeakMapData.cpp: Added. 44 (JSC::WeakMapData::WeakMapData): 45 (JSC::WeakMapData::finishCreation): 46 (JSC::WeakMapData::destroy): 47 (JSC::WeakMapData::visitChildren): 48 (JSC::WeakMapData::set): 49 (JSC::WeakMapData::get): 50 (JSC::WeakMapData::remove): 51 (JSC::WeakMapData::contains): 52 (JSC::WeakMapData::clear): 53 (JSC::WeakMapData::DeadKeyCleaner::visitWeakReferences): 54 (JSC::WeakMapData::DeadKeyCleaner::finalizeUnconditionally): 55 * runtime/WeakMapData.h: Added. 56 (JSC::WeakMapData::create): 57 (JSC::WeakMapData::createStructure): 58 (JSC::WeakMapData::DeadKeyCleaner::DeadKeyCleaner): 59 * runtime/WeakMapPrototype.cpp: Added. 60 (JSC::WeakMapPrototype::finishCreation): 61 (JSC::getWeakMapData): 62 (JSC::protoFuncWeakMapClear): 63 (JSC::protoFuncWeakMapDelete): 64 (JSC::protoFuncWeakMapGet): 65 (JSC::protoFuncWeakMapHas): 66 (JSC::protoFuncWeakMapSet): 67 * runtime/WeakMapPrototype.h: Added. 68 (JSC::WeakMapPrototype::create): 69 (JSC::WeakMapPrototype::createStructure): 70 (JSC::WeakMapPrototype::WeakMapPrototype): 71 1 72 2013-09-10 Joseph Pecoraro <pecoraro@apple.com> 2 73 -
trunk/Source/JavaScriptCore/GNUmakefile.list.am
r155180 r155473 922 922 Source/JavaScriptCore/runtime/JSUint8Array.h \ 923 923 Source/JavaScriptCore/runtime/JSUint8ClampedArray.h \ 924 Source/JavaScriptCore/runtime/JSWeakMap.cpp \ 925 Source/JavaScriptCore/runtime/JSWeakMap.h \ 924 926 Source/JavaScriptCore/runtime/JSWithScope.cpp \ 925 927 Source/JavaScriptCore/runtime/JSNameScope.cpp \ … … 1071 1073 Source/JavaScriptCore/runtime/WatchdogNone.cpp \ 1072 1074 Source/JavaScriptCore/runtime/WeakGCMap.h \ 1075 Source/JavaScriptCore/runtime/WeakMapConstructor.cpp \ 1076 Source/JavaScriptCore/runtime/WeakMapConstructor.h \ 1077 Source/JavaScriptCore/runtime/WeakMapData.cpp \ 1078 Source/JavaScriptCore/runtime/WeakMapData.h \ 1079 Source/JavaScriptCore/runtime/WeakMapPrototype.cpp \ 1080 Source/JavaScriptCore/runtime/WeakMapPrototype.h \ 1073 1081 Source/JavaScriptCore/runtime/WeakRandom.h \ 1074 1082 Source/JavaScriptCore/runtime/WriteBarrier.h \ -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj
r155090 r155473 494 494 <ClCompile Include="..\runtime\JSTypedArrays.cpp" /> 495 495 <ClCompile Include="..\runtime\JSVariableObject.cpp" /> 496 <ClCompile Include="..\runtime\JSWeakMap.cpp" /> 496 497 <ClCompile Include="..\runtime\JSWithScope.cpp" /> 497 498 <ClCompile Include="..\runtime\JSWrapperObject.cpp" /> … … 547 548 <ClCompile Include="..\runtime\Watchdog.cpp" /> 548 549 <ClCompile Include="..\runtime\WatchdogNone.cpp" /> 550 <ClCompile Include="..\runtime\WeakMapConstructor.cpp" /> 551 <ClCompile Include="..\runtime\WeakMapData.cpp" /> 552 <ClCompile Include="..\runtime\WeakMapPrototype.cpp" /> 549 553 <ClCompile Include="..\tools\CodeProfile.cpp" /> 550 554 <ClCompile Include="..\tools\CodeProfiling.cpp" /> … … 935 939 <ClInclude Include="..\runtime\JSUint8ClampedArray.h" /> 936 940 <ClInclude Include="..\runtime\JSVariableObject.h" /> 941 <ClInclude Include="..\runtime\JSWeakMap.h" /> 937 942 <ClInclude Include="..\runtime\JSWithScope.h" /> 938 943 <ClInclude Include="..\runtime\JSWrapperObject.h" /> … … 1010 1015 <ClInclude Include="..\runtime\Watchdog.h" /> 1011 1016 <ClInclude Include="..\runtime\WeakGCMap.h" /> 1017 <ClInclude Include="..\runtime\WeakMapConstructor.h" /> 1018 <ClInclude Include="..\runtime\WeakMapData.h" /> 1019 <ClInclude Include="..\runtime\WeakMapPrototype.h" /> 1012 1020 <ClInclude Include="..\runtime\WeakRandom.h" /> 1013 1021 <ClInclude Include="..\runtime\WriteBarrier.h" /> -
trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters
r155123 r155473 613 613 <Filter>runtime</Filter> 614 614 </ClCompile> 615 <ClCompile Include="..\runtime\JSWeakMap.cpp"> 616 <Filter>runtime</Filter> 617 </ClCompile> 615 618 <ClCompile Include="..\runtime\JSWrapperObject.cpp"> 616 619 <Filter>runtime</Filter> … … 857 860 </ClCompile> 858 861 <ClCompile Include="..\runtime\JSPromise.cpp"> 862 <Filter>runtime</Filter> 863 </ClCompile> 864 <ClCompile Include="..\runtime\WeakMapConstructor.cpp"> 865 <Filter>runtime</Filter> 866 </ClCompile> 867 <ClCompile Include="..\runtime\WeakMapData.cpp"> 868 <Filter>runtime</Filter> 869 </ClCompile> 870 <ClCompile Include="..\runtime\WeakMapPrototype.cpp"> 859 871 <Filter>runtime</Filter> 860 872 </ClCompile> -
trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r155090 r155473 940 940 A7C1EAF117987AB600299DB2 /* StackVisitor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7C1EAEC17987AB600299DB2 /* StackVisitor.cpp */; }; 941 941 A7C1EAF217987AB600299DB2 /* StackVisitor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7C1EAED17987AB600299DB2 /* StackVisitor.h */; settings = {ATTRIBUTES = (Private, ); }; }; 942 A7CA3AE317DA41AE006538AF /* WeakMapConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA3ADD17DA41AE006538AF /* WeakMapConstructor.cpp */; }; 943 A7CA3AE417DA41AE006538AF /* WeakMapConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA3ADE17DA41AE006538AF /* WeakMapConstructor.h */; }; 944 A7CA3AE517DA41AE006538AF /* WeakMapPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA3ADF17DA41AE006538AF /* WeakMapPrototype.cpp */; }; 945 A7CA3AE617DA41AE006538AF /* WeakMapPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA3AE017DA41AE006538AF /* WeakMapPrototype.h */; }; 946 A7CA3AE717DA41AE006538AF /* JSWeakMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */; }; 947 A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA3AE217DA41AE006538AF /* JSWeakMap.h */; }; 948 A7CA3AEB17DA5168006538AF /* WeakMapData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7CA3AE917DA5168006538AF /* WeakMapData.cpp */; }; 949 A7CA3AEC17DA5168006538AF /* WeakMapData.h in Headers */ = {isa = PBXBuildFile; fileRef = A7CA3AEA17DA5168006538AF /* WeakMapData.h */; }; 942 950 A7D89CF217A0B8CC00773AD8 /* DFGBasicBlock.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE317A0B8CC00773AD8 /* DFGBasicBlock.cpp */; }; 943 951 A7D89CF317A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A7D89CE417A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp */; }; … … 2148 2156 A7C225CC139981F100FF1662 /* KeywordLookupGenerator.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = KeywordLookupGenerator.py; sourceTree = "<group>"; }; 2149 2157 A7C225CD1399849C00FF1662 /* KeywordLookup.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = KeywordLookup.h; sourceTree = "<group>"; }; 2158 A7CA3ADD17DA41AE006538AF /* WeakMapConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakMapConstructor.cpp; sourceTree = "<group>"; }; 2159 A7CA3ADE17DA41AE006538AF /* WeakMapConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakMapConstructor.h; sourceTree = "<group>"; }; 2160 A7CA3ADF17DA41AE006538AF /* WeakMapPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakMapPrototype.cpp; sourceTree = "<group>"; }; 2161 A7CA3AE017DA41AE006538AF /* WeakMapPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakMapPrototype.h; sourceTree = "<group>"; }; 2162 A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakMap.cpp; sourceTree = "<group>"; }; 2163 A7CA3AE217DA41AE006538AF /* JSWeakMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakMap.h; sourceTree = "<group>"; }; 2164 A7CA3AE917DA5168006538AF /* WeakMapData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakMapData.cpp; sourceTree = "<group>"; }; 2165 A7CA3AEA17DA5168006538AF /* WeakMapData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakMapData.h; sourceTree = "<group>"; }; 2150 2166 A7D89CE317A0B8CC00773AD8 /* DFGBasicBlock.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGBasicBlock.cpp; path = dfg/DFGBasicBlock.cpp; sourceTree = "<group>"; }; 2151 2167 A7D89CE417A0B8CC00773AD8 /* DFGBlockInsertionSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DFGBlockInsertionSet.cpp; path = dfg/DFGBlockInsertionSet.cpp; sourceTree = "<group>"; }; … … 3381 3397 1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */, 3382 3398 A7DCB77912E3D90500911940 /* WriteBarrier.h */, 3399 A7CA3ADD17DA41AE006538AF /* WeakMapConstructor.cpp */, 3400 A7CA3ADE17DA41AE006538AF /* WeakMapConstructor.h */, 3401 A7CA3ADF17DA41AE006538AF /* WeakMapPrototype.cpp */, 3402 A7CA3AE017DA41AE006538AF /* WeakMapPrototype.h */, 3403 A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */, 3404 A7CA3AE217DA41AE006538AF /* JSWeakMap.h */, 3405 A7CA3AE917DA5168006538AF /* WeakMapData.cpp */, 3406 A7CA3AEA17DA5168006538AF /* WeakMapData.h */, 3383 3407 ); 3384 3408 path = runtime; … … 3993 4017 0F235BEC17178E7300690C7F /* DFGOSRExitBase.h in Headers */, 3994 4018 0FFB921C16D02F110055A5DB /* DFGOSRExitCompilationInfo.h in Headers */, 4019 A7CA3AEC17DA5168006538AF /* WeakMapData.h in Headers */, 3995 4020 0FC0977114693AF500CF2442 /* DFGOSRExitCompiler.h in Headers */, 3996 4021 0F7025AA1714B0FC00382C0E /* DFGOSRExitCompilerCommon.h in Headers */, … … 4213 4238 A7C0C4AC168103020017011D /* JSScriptRefPrivate.h in Headers */, 4214 4239 0F919D11157F332C004A4E7D /* JSSegmentedVariableObject.h in Headers */, 4240 A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */, 4215 4241 A7299D9E17D12837005F5FF9 /* JSSet.h in Headers */, 4216 4242 BC18C45E0E16F5CD00B34460 /* JSStack.h in Headers */, … … 4338 4364 0FF729BB166AD360000F5BA3 /* ProfilerCompilationKind.h in Headers */, 4339 4365 0FD8A32617D51F5700CA2C40 /* DFGOSREntrypointCreationPhase.h in Headers */, 4366 A7CA3AE417DA41AE006538AF /* WeakMapConstructor.h in Headers */, 4340 4367 0FF729BC166AD360000F5BA3 /* ProfilerCompiledBytecode.h in Headers */, 4341 4368 0FF729BD166AD360000F5BA3 /* ProfilerDatabase.h in Headers */, … … 4403 4430 142E313B134FF0A600AFADB5 /* Strong.h in Headers */, 4404 4431 145722861437E140005FDE26 /* StrongInlines.h in Headers */, 4432 A7CA3AE617DA41AE006538AF /* WeakMapPrototype.h in Headers */, 4405 4433 BCDE3AB80E6C82F5001453A7 /* Structure.h in Headers */, 4406 4434 7E4EE7090EBB7963005934AA /* StructureChain.h in Headers */, … … 4987 5015 C2D58C3415912FEE0021A844 /* GCActivityCallback.cpp in Sources */, 4988 5016 0F766D2F15A8DCE0008F363E /* GCAwareJITStubRoutine.cpp in Sources */, 5017 A7CA3AEB17DA5168006538AF /* WeakMapData.cpp in Sources */, 4989 5018 C2239D1A16262BDD005AC5FD /* GCThread.cpp in Sources */, 4990 5019 C21122E115DD9AB300790E3A /* GCThreadSharedData.cpp in Sources */, … … 5128 5157 14469DE3107EC7E700650446 /* NumberObject.cpp in Sources */, 5129 5158 14469DE4107EC7E700650446 /* NumberPrototype.cpp in Sources */, 5159 A7CA3AE317DA41AE006538AF /* WeakMapConstructor.cpp in Sources */, 5130 5160 86F3EEBE168CDE930077B92A /* ObjCCallbackFunction.mm in Sources */, 5131 5161 14469DE5107EC7E700650446 /* ObjectConstructor.cpp in Sources */, … … 5161 5191 1474C33C16AA2D9B0062F01D /* PrototypeMap.cpp in Sources */, 5162 5192 0F9332A314CA7DD70085F3C6 /* PutByIdStatus.cpp in Sources */, 5193 A7CA3AE517DA41AE006538AF /* WeakMapPrototype.cpp in Sources */, 5163 5194 0FF60AC316740F8800029779 /* ReduceWhitespace.cpp in Sources */, 5164 5195 14280841107EC0930013E7B2 /* RegExp.cpp in Sources */, 5165 5196 A1712B3B11C7B212007A5315 /* RegExpCache.cpp in Sources */, 5197 A7CA3AE717DA41AE006538AF /* JSWeakMap.cpp in Sources */, 5166 5198 8642C510151C06A90046D4EF /* RegExpCachedResult.cpp in Sources */, 5167 5199 0FD8A32B17D51F5700CA2C40 /* DFGToFTLForOSREntryDeferredCompilationCallback.cpp in Sources */, -
trunk/Source/JavaScriptCore/Target.pri
r155090 r155473 351 351 runtime/JSTypedArrays.cpp \ 352 352 runtime/JSVariableObject.cpp \ 353 runtime/JSWeakMap.cpp \ 353 354 runtime/JSWithScope.cpp \ 354 355 runtime/JSWrapperObject.cpp \ … … 405 406 runtime/Watchdog.cpp \ 406 407 runtime/WatchdogNone.cpp \ 408 runtime/WeakMapConstructor.cpp \ 409 runtime/WeakMapData.cpp \ 410 runtime/WeakMapPrototype.cpp \ 407 411 tools/CodeProfile.cpp \ 408 412 tools/CodeProfiling.cpp \ -
trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h
r154916 r155473 144 144 macro(Map)\ 145 145 macro(Set)\ 146 macro(WeakMap)\ 146 147 macro(add) 147 148 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r155177 r155473 72 72 #include "JSTypedArrayPrototypes.h" 73 73 #include "JSTypedArrays.h" 74 #include "JSWeakMap.h" 74 75 #include "JSWithScope.h" 75 76 #include "LegacyProfiler.h" … … 100 101 #include "StringConstructor.h" 101 102 #include "StringPrototype.h" 103 #include "WeakMapConstructor.h" 104 #include "WeakMapData.h" 105 #include "WeakMapPrototype.h" 102 106 103 107 #if ENABLE(PROMISES) … … 310 314 311 315 m_mapDataStructure.set(exec->vm(), this, MapData::createStructure(exec->vm(), this, jsNull())); 316 m_weakMapDataStructure.set(exec->vm(), this, WeakMapData::createStructure(exec->vm(), this, jsNull())); 312 317 313 318 #define CREATE_PROTOTYPE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ … … 641 646 642 647 visitor.append(&thisObject->m_mapDataStructure); 648 visitor.append(&thisObject->m_weakMapDataStructure); 643 649 644 650 for (unsigned i = NUMBER_OF_TYPED_ARRAY_TYPES; i--;) { -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r155177 r155473 81 81 macro(Error, error, error, ErrorInstance, Error) \ 82 82 macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer) \ 83 macro(WeakMap, weakMap, weakMap, JSWeakMap, WeakMap) \ 83 84 84 85 #define DECLARE_SIMPLE_BUILTIN_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ … … 201 202 202 203 WriteBarrier<Structure> m_mapDataStructure; 204 WriteBarrier<Structure> m_weakMapDataStructure; 203 205 204 206 #define DEFINE_STORAGE_FOR_SIMPLE_TYPE(capitalName, lowerName, properName, instanceType, jsName) \ … … 399 401 Structure* mapStructure() const { return m_mapStructure.get(); } 400 402 Structure* mapDataStructure() const { return m_mapDataStructure.get(); } 403 Structure* weakMapDataStructure() const { return m_weakMapDataStructure.get(); } 401 404 Structure* regExpMatchesArrayStructure() const { return m_regExpMatchesArrayStructure.get(); } 402 405 Structure* regExpStructure() const { return m_regExpStructure.get(); }
Note: See TracChangeset
for help on using the changeset viewer.