Changeset 182994 in webkit


Ignore:
Timestamp:
Apr 19, 2015 11:08:14 AM (9 years ago)
Author:
Yusuke Suzuki
Message:

[ES6] Implement WeakSet
https://bugs.webkit.org/show_bug.cgi?id=142408

Reviewed by Darin Adler.

Source/JavaScriptCore:

This patch implements ES6 WeakSet.
Current implementation simply leverages WeakMapData with undefined value.
This WeakMapData should be optimized in the same manner as MapData/SetData in the subsequent patch[1].

And in this patch, we also fix WeakMap/WeakSet behavior to conform the ES6 spec.
Except for adders (WeakMap.prototype.set/WeakSet.prototype.add),
methods return false (or undefined for WeakMap.prototype.get)
when a key is not Object instead of throwing a type error.

[1]: https://bugs.webkit.org/show_bug.cgi?id=143919

  • CMakeLists.txt:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
  • JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • runtime/CommonIdentifiers.h:
  • runtime/JSGlobalObject.cpp:
  • runtime/JSGlobalObject.h:
  • runtime/JSWeakSet.cpp: Added.

(JSC::JSWeakSet::finishCreation):
(JSC::JSWeakSet::visitChildren):

  • runtime/JSWeakSet.h: Added.

(JSC::JSWeakSet::createStructure):
(JSC::JSWeakSet::create):
(JSC::JSWeakSet::weakMapData):
(JSC::JSWeakSet::JSWeakSet):

  • runtime/WeakMapPrototype.cpp:

(JSC::getWeakMapData):
(JSC::protoFuncWeakMapDelete):
(JSC::protoFuncWeakMapGet):
(JSC::protoFuncWeakMapHas):

  • runtime/WeakSetConstructor.cpp: Added.

(JSC::WeakSetConstructor::finishCreation):
(JSC::callWeakSet):
(JSC::constructWeakSet):
(JSC::WeakSetConstructor::getConstructData):
(JSC::WeakSetConstructor::getCallData):

  • runtime/WeakSetConstructor.h: Added.

(JSC::WeakSetConstructor::create):
(JSC::WeakSetConstructor::createStructure):
(JSC::WeakSetConstructor::WeakSetConstructor):

  • runtime/WeakSetPrototype.cpp: Added.

(JSC::WeakSetPrototype::finishCreation):
(JSC::getWeakMapData):
(JSC::protoFuncWeakSetDelete):
(JSC::protoFuncWeakSetHas):
(JSC::protoFuncWeakSetAdd):

  • runtime/WeakSetPrototype.h: Added.

(JSC::WeakSetPrototype::create):
(JSC::WeakSetPrototype::createStructure):
(JSC::WeakSetPrototype::WeakSetPrototype):

  • tests/stress/weak-set-constructor-adder.js: Added.

(WeakSet.prototype.add):

  • tests/stress/weak-set-constructor.js: Added.

LayoutTests:

Add basic-weakset test and fix WeakMap behavior to conform the latest spec.

  • js/dom/basic-weakmap-expected.txt:
  • js/dom/basic-weakset-expected.txt: Added.
  • js/dom/basic-weakset.html: Added.
  • js/dom/script-tests/basic-weakmap.js:
  • js/dom/script-tests/basic-weakset.js: Added.
Location:
trunk
Files:
11 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r182986 r182994  
     12015-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Implement WeakSet
     4        https://bugs.webkit.org/show_bug.cgi?id=142408
     5
     6        Reviewed by Darin Adler.
     7
     8        Add basic-weakset test and fix WeakMap behavior to conform the latest spec.
     9
     10        * js/dom/basic-weakmap-expected.txt:
     11        * js/dom/basic-weakset-expected.txt: Added.
     12        * js/dom/basic-weakset.html: Added.
     13        * js/dom/script-tests/basic-weakmap.js:
     14        * js/dom/script-tests/basic-weakset.js: Added.
     15
    1162015-04-18  Michał Pakuła vel Rutka  <m.pakula@samsung.com>
    217
  • trunk/LayoutTests/js/dom/basic-weakmap-expected.txt

    r181333 r182994  
    1515PASS map.set(null, 1) threw exception TypeError: Attempted to set a non-object key in a WeakMap.
    1616PASS map.set(undefined, 1) threw exception TypeError: Attempted to set a non-object key in a WeakMap.
    17 PASS map.get(0) threw exception TypeError: A WeakMap cannot have a non-object key.
    18 PASS map.get(0.5) threw exception TypeError: A WeakMap cannot have a non-object key.
    19 PASS map.get('foo') threw exception TypeError: A WeakMap cannot have a non-object key.
    20 PASS map.get(true) threw exception TypeError: A WeakMap cannot have a non-object key.
    21 PASS map.get(false) threw exception TypeError: A WeakMap cannot have a non-object key.
    22 PASS map.get(null) threw exception TypeError: A WeakMap cannot have a non-object key.
    23 PASS map.get(undefined) threw exception TypeError: A WeakMap cannot have a non-object key.
    24 PASS map.has(0) threw exception TypeError: A WeakMap cannot have a non-object key.
    25 PASS map.has(0.5) threw exception TypeError: A WeakMap cannot have a non-object key.
    26 PASS map.has('foo') threw exception TypeError: A WeakMap cannot have a non-object key.
    27 PASS map.has(true) threw exception TypeError: A WeakMap cannot have a non-object key.
    28 PASS map.has(false) threw exception TypeError: A WeakMap cannot have a non-object key.
    29 PASS map.has(null) threw exception TypeError: A WeakMap cannot have a non-object key.
    30 PASS map.has(undefined) threw exception TypeError: A WeakMap cannot have a non-object key.
    31 PASS map.delete(0) threw exception TypeError: A WeakMap cannot have a non-object key.
    32 PASS map.delete(0.5) threw exception TypeError: A WeakMap cannot have a non-object key.
    33 PASS map.delete('foo') threw exception TypeError: A WeakMap cannot have a non-object key.
    34 PASS map.delete(true) threw exception TypeError: A WeakMap cannot have a non-object key.
    35 PASS map.delete(false) threw exception TypeError: A WeakMap cannot have a non-object key.
    36 PASS map.delete(null) threw exception TypeError: A WeakMap cannot have a non-object key.
    37 PASS map.delete(undefined) threw exception TypeError: A WeakMap cannot have a non-object key.
     17PASS map.get(0) is undefined.
     18PASS map.get(0.5) is undefined.
     19PASS map.get('foo') is undefined.
     20PASS map.get(true) is undefined.
     21PASS map.get(false) is undefined.
     22PASS map.get(null) is undefined.
     23PASS map.get(undefined) is undefined.
     24PASS map.has(0) is false
     25PASS map.has(0.5) is false
     26PASS map.has('foo') is false
     27PASS map.has(true) is false
     28PASS map.has(false) is false
     29PASS map.has(null) is false
     30PASS map.has(undefined) is false
     31PASS map.delete(0) is false
     32PASS map.delete(0.5) is false
     33PASS map.delete('foo') is false
     34PASS map.delete(true) is false
     35PASS map.delete(false) is false
     36PASS map.delete(null) is false
     37PASS map.delete(undefined) is false
    3838PASS map.set(new String('foo'), 'foo') is map
    39 PASS map.get(new String('foo')) is undefined
     39PASS map.get(new String('foo')) is undefined.
    4040PASS map.has(new String('foo')) is false
     41PASS map.set(object, 'foo') is map
     42PASS map.has(object) is true
     43PASS map.get(object) is 'foo'
     44PASS map.delete(object) is true
     45PASS map.has(object) is false
     46PASS map.delete(object) is false
     47PASS map.get(object) is undefined.
    4148PASS successfullyParsed is true
    4249
  • trunk/LayoutTests/js/dom/script-tests/basic-weakmap.js

    r167954 r182994  
    1717shouldThrow("map.set(null, 1)")
    1818shouldThrow("map.set(undefined, 1)")
    19 shouldThrow("map.get(0)")
    20 shouldThrow("map.get(0.5)")
    21 shouldThrow("map.get('foo')")
    22 shouldThrow("map.get(true)")
    23 shouldThrow("map.get(false)")
    24 shouldThrow("map.get(null)")
    25 shouldThrow("map.get(undefined)")
    26 shouldThrow("map.has(0)")
    27 shouldThrow("map.has(0.5)")
    28 shouldThrow("map.has('foo')")
    29 shouldThrow("map.has(true)")
    30 shouldThrow("map.has(false)")
    31 shouldThrow("map.has(null)")
    32 shouldThrow("map.has(undefined)")
    33 shouldThrow("map.delete(0)")
    34 shouldThrow("map.delete(0.5)")
    35 shouldThrow("map.delete('foo')")
    36 shouldThrow("map.delete(true)")
    37 shouldThrow("map.delete(false)")
    38 shouldThrow("map.delete(null)")
    39 shouldThrow("map.delete(undefined)")
     19shouldBeUndefined("map.get(0)")
     20shouldBeUndefined("map.get(0.5)")
     21shouldBeUndefined("map.get('foo')")
     22shouldBeUndefined("map.get(true)")
     23shouldBeUndefined("map.get(false)")
     24shouldBeUndefined("map.get(null)")
     25shouldBeUndefined("map.get(undefined)")
     26shouldBeFalse("map.has(0)")
     27shouldBeFalse("map.has(0.5)")
     28shouldBeFalse("map.has('foo')")
     29shouldBeFalse("map.has(true)")
     30shouldBeFalse("map.has(false)")
     31shouldBeFalse("map.has(null)")
     32shouldBeFalse("map.has(undefined)")
     33shouldBeFalse("map.delete(0)")
     34shouldBeFalse("map.delete(0.5)")
     35shouldBeFalse("map.delete('foo')")
     36shouldBeFalse("map.delete(true)")
     37shouldBeFalse("map.delete(false)")
     38shouldBeFalse("map.delete(null)")
     39shouldBeFalse("map.delete(undefined)")
    4040
     41var object = new String('hello');
    4142shouldBe("map.set(new String('foo'), 'foo')", "map");
    42 shouldBe("map.get(new String('foo'))", "undefined");
     43shouldBeUndefined("map.get(new String('foo'))");
    4344shouldBeFalse("map.has(new String('foo'))");
     45shouldBe("map.set(object, 'foo')", "map");
     46shouldBeTrue("map.has(object)");
     47shouldBe("map.get(object)", "'foo'");
     48shouldBeTrue("map.delete(object)");
     49shouldBeFalse("map.has(object)");
     50shouldBeFalse("map.delete(object)");
     51shouldBeUndefined("map.get(object)");
  • trunk/Source/JavaScriptCore/CMakeLists.txt

    r182927 r182994  
    509509    runtime/JSTypedArrays.cpp
    510510    runtime/JSWeakMap.cpp
     511    runtime/JSWeakSet.cpp
    511512    runtime/JSWithScope.cpp
    512513    runtime/JSWrapperObject.cpp
     
    586587    runtime/WeakMapData.cpp
    587588    runtime/WeakMapPrototype.cpp
     589    runtime/WeakSetConstructor.cpp
     590    runtime/WeakSetPrototype.cpp
    588591)
    589592
  • trunk/Source/JavaScriptCore/ChangeLog

    r182971 r182994  
     12015-04-19  Yusuke Suzuki  <utatane.tea@gmail.com>
     2
     3        [ES6] Implement WeakSet
     4        https://bugs.webkit.org/show_bug.cgi?id=142408
     5
     6        Reviewed by Darin Adler.
     7
     8        This patch implements ES6 WeakSet.
     9        Current implementation simply leverages WeakMapData with undefined value.
     10        This WeakMapData should be optimized in the same manner as MapData/SetData in the subsequent patch[1].
     11
     12        And in this patch, we also fix WeakMap/WeakSet behavior to conform the ES6 spec.
     13        Except for adders (WeakMap.prototype.set/WeakSet.prototype.add),
     14        methods return false (or undefined for WeakMap.prototype.get)
     15        when a key is not Object instead of throwing a type error.
     16
     17        [1]: https://bugs.webkit.org/show_bug.cgi?id=143919
     18
     19        * CMakeLists.txt:
     20        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj:
     21        * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters:
     22        * JavaScriptCore.xcodeproj/project.pbxproj:
     23        * runtime/CommonIdentifiers.h:
     24        * runtime/JSGlobalObject.cpp:
     25        * runtime/JSGlobalObject.h:
     26        * runtime/JSWeakSet.cpp: Added.
     27        (JSC::JSWeakSet::finishCreation):
     28        (JSC::JSWeakSet::visitChildren):
     29        * runtime/JSWeakSet.h: Added.
     30        (JSC::JSWeakSet::createStructure):
     31        (JSC::JSWeakSet::create):
     32        (JSC::JSWeakSet::weakMapData):
     33        (JSC::JSWeakSet::JSWeakSet):
     34        * runtime/WeakMapPrototype.cpp:
     35        (JSC::getWeakMapData):
     36        (JSC::protoFuncWeakMapDelete):
     37        (JSC::protoFuncWeakMapGet):
     38        (JSC::protoFuncWeakMapHas):
     39        * runtime/WeakSetConstructor.cpp: Added.
     40        (JSC::WeakSetConstructor::finishCreation):
     41        (JSC::callWeakSet):
     42        (JSC::constructWeakSet):
     43        (JSC::WeakSetConstructor::getConstructData):
     44        (JSC::WeakSetConstructor::getCallData):
     45        * runtime/WeakSetConstructor.h: Added.
     46        (JSC::WeakSetConstructor::create):
     47        (JSC::WeakSetConstructor::createStructure):
     48        (JSC::WeakSetConstructor::WeakSetConstructor):
     49        * runtime/WeakSetPrototype.cpp: Added.
     50        (JSC::WeakSetPrototype::finishCreation):
     51        (JSC::getWeakMapData):
     52        (JSC::protoFuncWeakSetDelete):
     53        (JSC::protoFuncWeakSetHas):
     54        (JSC::protoFuncWeakSetAdd):
     55        * runtime/WeakSetPrototype.h: Added.
     56        (JSC::WeakSetPrototype::create):
     57        (JSC::WeakSetPrototype::createStructure):
     58        (JSC::WeakSetPrototype::WeakSetPrototype):
     59        * tests/stress/weak-set-constructor-adder.js: Added.
     60        (WeakSet.prototype.add):
     61        * tests/stress/weak-set-constructor.js: Added.
     62
    1632015-04-17  Alexey Proskuryakov  <ap@apple.com>
    264
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj

    r182927 r182994  
    773773    <ClCompile Include="..\runtime\JSEnvironmentRecord.cpp" />
    774774    <ClCompile Include="..\runtime\JSWeakMap.cpp" />
     775    <ClCompile Include="..\runtime\JSWeakSet.cpp" />
    775776    <ClCompile Include="..\runtime\JSWithScope.cpp" />
    776777    <ClCompile Include="..\runtime\JSWrapperObject.cpp" />
     
    850851    <ClCompile Include="..\runtime\WeakMapData.cpp" />
    851852    <ClCompile Include="..\runtime\WeakMapPrototype.cpp" />
     853    <ClCompile Include="..\runtime\WeakSetConstructor.cpp" />
     854    <ClCompile Include="..\runtime\WeakSetPrototype.cpp" />
    852855    <ClCompile Include="..\tools\CodeProfile.cpp" />
    853856    <ClCompile Include="..\tools\CodeProfiling.cpp" />
     
    15901593    <ClInclude Include="..\runtime\JSEnvironmentRecord.h" />
    15911594    <ClInclude Include="..\runtime\JSWeakMap.h" />
     1595    <ClInclude Include="..\runtime\JSWeakSet.h" />
    15921596    <ClInclude Include="..\runtime\JSWithScope.h" />
    15931597    <ClInclude Include="..\runtime\JSWrapperObject.h" />
     
    16951699    <ClInclude Include="..\runtime\WeakMapData.h" />
    16961700    <ClInclude Include="..\runtime\WeakMapPrototype.h" />
     1701    <ClInclude Include="..\runtime\WeakSetConstructor.h" />
     1702    <ClInclude Include="..\runtime\WeakSetPrototype.h" />
    16971703    <ClInclude Include="..\runtime\WeakRandom.h" />
    16981704    <ClInclude Include="..\runtime\WriteBarrier.h" />
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters

    r182927 r182994  
    718718      <Filter>runtime</Filter>
    719719    </ClCompile>
     720    <ClCompile Include="..\runtime\JSWeakSet.cpp">
     721      <Filter>runtime</Filter>
     722    </ClCompile>
    720723    <ClCompile Include="..\runtime\JSWrapperObject.cpp">
    721724      <Filter>runtime</Filter>
     
    10251028    </ClCompile>
    10261029    <ClCompile Include="..\runtime\WeakMapPrototype.cpp">
     1030      <Filter>runtime</Filter>
     1031    </ClCompile>
     1032    <ClCompile Include="..\runtime\WeakSetConstructor.cpp">
     1033      <Filter>runtime</Filter>
     1034    </ClCompile>
     1035    <ClCompile Include="..\runtime\WeakSetPrototype.cpp">
    10271036      <Filter>runtime</Filter>
    10281037    </ClCompile>
     
    37543763      <Filter>runtime</Filter>
    37553764    </ClInclude>
     3765    <ClInclude Include="..\runtime\WeakSetConstructor.h">
     3766      <Filter>runtime</Filter>
     3767    </ClInclude>
     3768    <ClInclude Include="..\runtime\WeakSetPrototype.h">
     3769      <Filter>runtime</Filter>
     3770    </ClInclude>
    37563771    <ClInclude Include="..\runtime\JSWeakMap.h">
     3772      <Filter>runtime</Filter>
     3773    </ClInclude>
     3774    <ClInclude Include="..\runtime\JSWeakSet.h">
    37573775      <Filter>runtime</Filter>
    37583776    </ClInclude>
  • trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj

    r182927 r182994  
    986986                705B41B11A6E501E00716757 /* SymbolPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 705B41A91A6E501E00716757 /* SymbolPrototype.cpp */; };
    987987                705B41B21A6E501E00716757 /* SymbolPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 705B41AA1A6E501E00716757 /* SymbolPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
     988                709FB8671AE335C60039D069 /* JSWeakSet.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 709FB8611AE335C60039D069 /* JSWeakSet.cpp */; };
     989                709FB8681AE335C60039D069 /* JSWeakSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 709FB8621AE335C60039D069 /* JSWeakSet.h */; settings = {ATTRIBUTES = (Private, ); }; };
     990                709FB8691AE335C60039D069 /* WeakSetConstructor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 709FB8631AE335C60039D069 /* WeakSetConstructor.cpp */; };
     991                709FB86A1AE335C60039D069 /* WeakSetConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 709FB8641AE335C60039D069 /* WeakSetConstructor.h */; settings = {ATTRIBUTES = (Private, ); }; };
     992                709FB86B1AE335C60039D069 /* WeakSetPrototype.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 709FB8651AE335C60039D069 /* WeakSetPrototype.cpp */; };
     993                709FB86C1AE335C60039D069 /* WeakSetPrototype.h in Headers */ = {isa = PBXBuildFile; fileRef = 709FB8661AE335C60039D069 /* WeakSetPrototype.h */; settings = {ATTRIBUTES = (Private, ); }; };
    988994                70B0A9D11A9B66460001306A /* RuntimeFlags.h in Headers */ = {isa = PBXBuildFile; fileRef = 70B0A9D01A9B66200001306A /* RuntimeFlags.h */; settings = {ATTRIBUTES = (Private, ); }; };
    989995                70EC0EC21AA0D7DA00B6AAFA /* JSStringIterator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 70EC0EBC1AA0D7DA00B6AAFA /* JSStringIterator.cpp */; };
     
    27062712                705B41A91A6E501E00716757 /* SymbolPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SymbolPrototype.cpp; sourceTree = "<group>"; };
    27072713                705B41AA1A6E501E00716757 /* SymbolPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SymbolPrototype.h; sourceTree = "<group>"; };
     2714                709FB8611AE335C60039D069 /* JSWeakSet.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWeakSet.cpp; sourceTree = "<group>"; };
     2715                709FB8621AE335C60039D069 /* JSWeakSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWeakSet.h; sourceTree = "<group>"; };
     2716                709FB8631AE335C60039D069 /* WeakSetConstructor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakSetConstructor.cpp; sourceTree = "<group>"; };
     2717                709FB8641AE335C60039D069 /* WeakSetConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakSetConstructor.h; sourceTree = "<group>"; };
     2718                709FB8651AE335C60039D069 /* WeakSetPrototype.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WeakSetPrototype.cpp; sourceTree = "<group>"; };
     2719                709FB8661AE335C60039D069 /* WeakSetPrototype.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WeakSetPrototype.h; sourceTree = "<group>"; };
    27082720                70B0A9D01A9B66200001306A /* RuntimeFlags.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RuntimeFlags.h; sourceTree = "<group>"; };
    27092721                70EC0EBC1AA0D7DA00B6AAFA /* JSStringIterator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSStringIterator.cpp; sourceTree = "<group>"; };
     
    45514563                                A7CA3AE117DA41AE006538AF /* JSWeakMap.cpp */,
    45524564                                A7CA3AE217DA41AE006538AF /* JSWeakMap.h */,
     4565                                709FB8611AE335C60039D069 /* JSWeakSet.cpp */,
     4566                                709FB8621AE335C60039D069 /* JSWeakSet.h */,
    45534567                                1442565F15EDE98D0066A49B /* JSWithScope.cpp */,
    45544568                                1442566015EDE98D0066A49B /* JSWithScope.h */,
     
    47404754                                A7CA3AE017DA41AE006538AF /* WeakMapPrototype.h */,
    47414755                                1420BE7A10AA6DDB00F455D2 /* WeakRandom.h */,
     4756                                709FB8631AE335C60039D069 /* WeakSetConstructor.cpp */,
     4757                                709FB8641AE335C60039D069 /* WeakSetConstructor.h */,
     4758                                709FB8651AE335C60039D069 /* WeakSetPrototype.cpp */,
     4759                                709FB8661AE335C60039D069 /* WeakSetPrototype.h */,
    47424760                                A7DCB77912E3D90500911940 /* WriteBarrier.h */,
    47434761                                C2B6D75218A33793004A9301 /* WriteBarrierInlines.h */,
     
    56615679                                0F0B83A714BCF50700885B4F /* CodeType.h in Headers */,
    56625680                                BC18C3F30E16F5CD00B34460 /* CommonIdentifiers.h in Headers */,
     5681                                709FB86C1AE335C60039D069 /* WeakSetPrototype.h in Headers */,
    56635682                                0F15F15F14B7A73E005DE37D /* CommonSlowPaths.h in Headers */,
    56645683                                6553A33217A1F1EE008CF6F3 /* CommonSlowPathsExceptions.h in Headers */,
     
    57815800                                A7D89CFC17A0B8CC00773AD8 /* DFGLivenessAnalysisPhase.h in Headers */,
    57825801                                0FF0F19B16B729FA005DF95B /* DFGLongLivedState.h in Headers */,
     5802                                709FB8681AE335C60039D069 /* JSWeakSet.h in Headers */,
    57835803                                A767B5B617A0B9650063D940 /* DFGLoopPreHeaderCreationPhase.h in Headers */,
    57845804                                0F2B9CED19D0BA7D00B1D1B5 /* DFGPromotedHeapLocation.h in Headers */,
     
    61136133                                14874AE415EBDE4A002E3587 /* JSNameScope.h in Headers */,
    61146134                                BC18C4240E16F5CD00B34460 /* JSObject.h in Headers */,
     6135                                709FB86A1AE335C60039D069 /* WeakSetConstructor.h in Headers */,
    61156136                                BC18C4250E16F5CD00B34460 /* JSObjectRef.h in Headers */,
    61166137                                A7280A2811557E3000D56957 /* JSObjectRefPrivate.h in Headers */,
     
    71097130                                0FC097A1146B28CA00CF2442 /* DFGThunks.cpp in Sources */,
    71107131                                0F93B4A918B92C4D00178A3F /* PutByIdVariant.cpp in Sources */,
     7132                                709FB8671AE335C60039D069 /* JSWeakSet.cpp in Sources */,
    71117133                                0FD8A32717D51F5700CA2C40 /* DFGTierUpCheckInjectionPhase.cpp in Sources */,
    71127134                                0FD8A32917D51F5700CA2C40 /* DFGToFTLDeferredCompilationCallback.cpp in Sources */,
     
    72297251                                A57D23E51890CEBF0031C7FA /* InspectorDebuggerAgent.cpp in Sources */,
    72307252                                A532438718568335002ED692 /* InspectorBackendDispatchers.cpp in Sources */,
     7253                                709FB8691AE335C60039D069 /* WeakSetConstructor.cpp in Sources */,
    72317254                                A532438918568335002ED692 /* InspectorFrontendDispatchers.cpp in Sources */,
    72327255                                A532438B18568335002ED692 /* InspectorProtocolObjects.cpp in Sources */,
     
    73217344                                7C008CD2186F8A9300955C24 /* JSPromiseFunctions.cpp in Sources */,
    73227345                                7C184E1E17BEE22E007CB63A /* JSPromisePrototype.cpp in Sources */,
     7346                                709FB86B1AE335C60039D069 /* WeakSetPrototype.cpp in Sources */,
    73237347                                7C008CDE1871258D00955C24 /* JSPromiseReaction.cpp in Sources */,
    73247348                                862553D116136DA9009F17D0 /* JSProxy.cpp in Sources */,
  • trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h

    r182938 r182994  
    5858    macro(UTC) \
    5959    macro(WeakMap)\
     60    macro(WeakSet)\
    6061    macro(__defineGetter__) \
    6162    macro(__defineSetter__) \
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r182938 r182994  
    8888#include "JSTypedArrays.h"
    8989#include "JSWeakMap.h"
     90#include "JSWeakSet.h"
    9091#include "JSWithScope.h"
    9192#include "LegacyProfiler.h"
     
    128129#include "WeakMapConstructor.h"
    129130#include "WeakMapPrototype.h"
     131#include "WeakSetConstructor.h"
     132#include "WeakSetPrototype.h"
    130133
    131134#if ENABLE(PROMISES)
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r182938 r182994  
    103103    macro(JSArrayBuffer, arrayBuffer, arrayBuffer, JSArrayBuffer, ArrayBuffer) \
    104104    DEFINE_STANDARD_BUILTIN(macro, WeakMap, weakMap) \
     105    DEFINE_STANDARD_BUILTIN(macro, WeakSet, weakSet) \
    105106
    106107#define FOR_EACH_SIMPLE_BUILTIN_TYPE(macro) \
  • trunk/Source/JavaScriptCore/runtime/WeakMapPrototype.cpp

    r173410 r182994  
    5959    if (!value.isObject()) {
    6060        throwTypeError(callFrame, WTF::ASCIILiteral("Called WeakMap function on non-object"));
    61         return 0;
     61        return nullptr;
    6262    }
    6363
     
    6666
    6767    throwTypeError(callFrame, WTF::ASCIILiteral("Called WeakMap function on a non-WeakMap object"));
    68     return 0;
     68    return nullptr;
    6969}
    7070
     
    8484        return JSValue::encode(jsUndefined());
    8585    JSValue key = callFrame->argument(0);
    86     if (!key.isObject())
    87         return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("A WeakMap cannot have a non-object key")));
    88     return JSValue::encode(jsBoolean(map->remove(asObject(key))));
     86    return JSValue::encode(jsBoolean(key.isObject() && map->remove(asObject(key))));
    8987}
    9088
     
    9694    JSValue key = callFrame->argument(0);
    9795    if (!key.isObject())
    98         return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("A WeakMap cannot have a non-object key")));
     96        return JSValue::encode(jsUndefined());
    9997    return JSValue::encode(map->get(asObject(key)));
    10098}
     
    106104        return JSValue::encode(jsUndefined());
    107105    JSValue key = callFrame->argument(0);
    108     if (!key.isObject())
    109         return JSValue::encode(throwTypeError(callFrame, WTF::ASCIILiteral("A WeakMap cannot have a non-object key")));
    110     return JSValue::encode(jsBoolean(map->contains(asObject(key))));
     106    return JSValue::encode(jsBoolean(key.isObject() && map->contains(asObject(key))));
    111107}
    112108
Note: See TracChangeset for help on using the changeset viewer.