haikuwebkit/LayoutTests/js/basic-map-expected.txt

242 lines
5.6 KiB
Plaintext
Raw Permalink Normal View History

Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
Tests basic correctness of ES Map object
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS Map instanceof Map is false
PASS Map.prototype instanceof Map is false
PASS new Map() instanceof Map is true
PASS new Map(null) instanceof Map is true
PASS new Map(undefined) instanceof Map is true
PASS new Map(undefined, undefined) instanceof Map is true
PASS new Map(null, undefined) instanceof Map is true
Debug assertion failure while loading http://kangax.github.io/compat-table/es6/. https://bugs.webkit.org/show_bug.cgi?id=154542 Reviewed by Saam Barati. Source/JavaScriptCore: According to the spec, the constructors of the following types "are not intended to be called as a function and will throw an exception". These types are: TypedArrays - https://tc39.github.io/ecma262/#sec-typedarray-constructors Map - https://tc39.github.io/ecma262/#sec-map-constructor Set - https://tc39.github.io/ecma262/#sec-set-constructor WeakMap - https://tc39.github.io/ecma262/#sec-weakmap-constructor WeakSet - https://tc39.github.io/ecma262/#sec-weakset-constructor ArrayBuffer - https://tc39.github.io/ecma262/#sec-arraybuffer-constructor DataView - https://tc39.github.io/ecma262/#sec-dataview-constructor Promise - https://tc39.github.io/ecma262/#sec-promise-constructor Proxy - https://tc39.github.io/ecma262/#sec-proxy-constructor This patch does the foillowing: 1. Ensures that these constructors can be called but will throw a TypeError when called. 2. Makes all these objects use throwConstructorCannotBeCalledAsFunctionTypeError() in their implementation to be consistent. 3. Change the error message to "calling XXX constructor without new is invalid". This is clearer because the error is likely due to the user forgetting to use the new operator on these constructors. * runtime/Error.h: * runtime/Error.cpp: (JSC::throwConstructorCannotBeCalledAsFunctionTypeError): - Added a convenience function to throw the TypeError. * runtime/JSArrayBufferConstructor.cpp: (JSC::constructArrayBuffer): (JSC::callArrayBuffer): (JSC::JSArrayBufferConstructor::getCallData): * runtime/JSGenericTypedArrayViewConstructorInlines.h: (JSC::callGenericTypedArrayView): (JSC::JSGenericTypedArrayViewConstructor<ViewClass>::getCallData): * runtime/JSPromiseConstructor.cpp: (JSC::callPromise): * runtime/MapConstructor.cpp: (JSC::callMap): * runtime/ProxyConstructor.cpp: (JSC::callProxy): (JSC::ProxyConstructor::getCallData): * runtime/SetConstructor.cpp: (JSC::callSet): * runtime/WeakMapConstructor.cpp: (JSC::callWeakMap): * runtime/WeakSetConstructor.cpp: (JSC::callWeakSet): * tests/es6.yaml: - The typed_arrays_%TypedArray%[Symbol.species].js test now passes. * tests/stress/call-non-calleable-constructors-as-function.js: Added. (test): * tests/stress/map-constructor.js: (testCallTypeError): * tests/stress/promise-cannot-be-called.js: (shouldThrow): * tests/stress/proxy-basic.js: * tests/stress/set-constructor.js: * tests/stress/throw-from-ftl-call-ic-slow-path-cells.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path-undefined.js: (i.catch): * tests/stress/throw-from-ftl-call-ic-slow-path.js: (i.catch): * tests/stress/weak-map-constructor.js: (testCallTypeError): * tests/stress/weak-set-constructor.js: - Updated error message string. LayoutTests: * js/Promise-types-expected.txt: * js/basic-map-expected.txt: * js/basic-set-expected.txt: * js/dom/basic-weakmap-expected.txt: * js/dom/basic-weakset-expected.txt: * js/script-tests/Promise-types.js: * js/typedarray-constructors-expected.txt: - Updated error message string. Canonical link: https://commits.webkit.org/172692@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@196986 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2016-02-23 19:41:56 +00:00
PASS Map() threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(1) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(true) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map('String') threw exception TypeError: calling Map constructor without new is invalid.
PASS Map([]) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map({}) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(undefined) threw exception TypeError: calling Map constructor without new is invalid.
PASS Map(null) threw exception TypeError: calling Map constructor without new is invalid.
PASS new Map(1) threw exception TypeError: Type error.
PASS new Map(true) threw exception TypeError: Type error.
PASS new Map([]) did not throw exception.
PASS new Map({}) threw exception TypeError: Type error.
PASS new Map(undefined, null) did not throw exception.
PASS new Map(undefined, {}) did not throw exception.
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS Object.hasOwnProperty(map, 'size') is false
PASS Map.prototype.hasOwnProperty('size') is true
PASS Map.prototype.size threw exception TypeError: Map operation called on non-Map object.
PASS Map.prototype.set.length is 2
PASS Map.prototype.has.length is 1
PASS Map.prototype.get.length is 1
PASS Map.prototype.clear.length is 0
PASS Map.prototype.keys.length is 0
PASS Map.prototype.values.length is 0
PASS Map.prototype.entries.length is 0
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS map.size is 0
PASS map.set(-0, 1) is map
PASS map.set(0, 2) is map
PASS map.size is 1
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS map.set(Infinity, 3) is map
PASS map.set(-Infinity, 4) is map
PASS map.set(NaN, 5) is map
PASS map.set('0', 6) is map
PASS map.set(0.1, 7) is map
PASS map.size is 6
PASS map.get(-0) is 2
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS map.get(0) is 2
PASS map.get(Infinity) is 3
PASS map.get(-Infinity) is 4
PASS map.get(NaN) is 5
PASS map.get('0') is 6
PASS map.get(0.1) is 7
PASS map.has(-0) is true
PASS map.has(0) is true
PASS map.has(Infinity) is true
PASS map.has(-Infinity) is true
PASS map.has(NaN) is true
PASS map.has('0') is true
PASS map.has(0.1) is true
PASS map.delete(-0) is true
PASS map.delete(0) is false
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS map.delete(Infinity) is true
PASS map.delete(-Infinity) is true
PASS map.delete(NaN) is true
PASS map.delete('0') is true
PASS map.delete(0.1) is true
PASS map.delete(-0) is false
PASS map.delete(0) is false
PASS map.delete(Infinity) is false
PASS map.delete(-Infinity) is false
PASS map.delete(NaN) is false
PASS map.delete('0') is false
PASS map.delete(0.1) is false
PASS map.get(simpleString) is map.get(otherString)
PASS map.clear() is undefined.
PASS map.size is 0
PASS map.set(0, 0) is map
PASS map.set('0', 1) is map
PASS map.set(1, 2) is map
PASS map.set('1', 3) is map
PASS map.set(2, 4) is map
PASS map.set('2', 5) is map
PASS map.set(3, 6) is map
PASS map.set('3', 7) is map
PASS map.set(4, 8) is map
PASS map.set('4', 9) is map
PASS map.set(5, 10) is map
PASS map.set('5', 11) is map
PASS map.set(6, 12) is map
PASS map.set('6', 13) is map
PASS map.size is 14
forEach #0
PASS testThis is undefined.
0
forEach #1
PASS testThis is thisValue
1
0
1
2
3
4
5
6
7
8
9
10
11
12
13
PASS map.forEach(debug) is undefined.
0 : number => 0
0 : string => 1
1 : number => 2
1 : string => 3
2 : number => 4
2 : string => 5
3 : string => 7
4 : string => 9
5 : number => 10
5 : string => 11
6 : number => 12
6 : string => 13
4 : number => 11
PASS map.get(0) is 0
PASS map.get("0") is 1
PASS map.get(1) is 2
PASS map.get("1") is 3
PASS map.get(2) is 4
PASS map.get("2") is 5
PASS map.get("3") is "replaced"
PASS map.get("4") is 9
PASS map.get(5) is 10
PASS map.get("5") is 11
PASS map.get(6) is 12
PASS map.get("6") is 13
PASS map.get(4) is 11
Add Map Iterators https://bugs.webkit.org/show_bug.cgi?id=124109 Reviewed by Andreas Kling. Source/JavaScriptCore: Added new Map iterator implementation. This is a mostly boilerplate patch however there's a a little bit of additional logic added to the MapData iterator to deal with the possibility of map mutation between creation of the iterator and use of it. We'll be able to improve the performance of this substantially by using intrinsics, however I'm pondering coming up with a better way to define these thunks without requiring so much duplicated logic. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj: * JavaScriptCore.vcxproj/JavaScriptCore.vcxproj.filters: * JavaScriptCore.xcodeproj/project.pbxproj: * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSMapIterator.cpp: Added. (JSC::JSMapIterator::finishCreation): (JSC::JSMapIterator::visitChildren): (JSC::JSMapIterator::createPair): * runtime/JSMapIterator.h: Added. (JSC::JSMapIterator::createStructure): (JSC::JSMapIterator::create): (JSC::JSMapIterator::next): (JSC::JSMapIterator::JSMapIterator): * runtime/MapData.h: (JSC::MapData::const_iterator::ensureSlot): * runtime/MapIteratorConstructor.cpp: Added. (JSC::MapIteratorConstructor::finishCreation): * runtime/MapIteratorConstructor.h: Added. (JSC::MapIteratorConstructor::create): (JSC::MapIteratorConstructor::createStructure): (JSC::MapIteratorConstructor::MapIteratorConstructor): * runtime/MapIteratorPrototype.cpp: Added. (JSC::MapIteratorPrototype::finishCreation): (JSC::MapIteratorPrototypeFuncIterator): (JSC::MapIteratorPrototypeFuncNext): * runtime/MapIteratorPrototype.h: Added. (JSC::MapIteratorPrototype::create): (JSC::MapIteratorPrototype::createStructure): (JSC::MapIteratorPrototype::MapIteratorPrototype): * runtime/MapPrototype.cpp: (JSC::MapPrototype::finishCreation): (JSC::mapProtoFuncValues): (JSC::mapProtoFuncEntries): (JSC::mapProtoFuncKeys): LayoutTests: Moved map tests to a more sensible location, and added new iteration tests. * js/basic-map-expected.txt: Renamed from LayoutTests/js/dom/basic-map-expected.txt. * js/basic-map.html: Renamed from LayoutTests/js/dom/basic-map.html. * js/script-tests/basic-map.js: Renamed from LayoutTests/js/dom/script-tests/basic-map.js. (set shouldBe): (set var): Canonical link: https://commits.webkit.org/142305@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@159008 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-11-10 04:20:21 +00:00
map.@@iterator()
PASS key is 0
PASS value is 0
PASS key is '0'
PASS value is 1
PASS key is 1
PASS value is 2
PASS key is '1'
PASS value is 3
PASS key is 2
PASS value is 4
PASS key is '2'
PASS value is 5
PASS key is 3
PASS value is 6
PASS key is '3'
PASS value is 7
PASS key is 4
PASS value is 8
PASS key is '4'
PASS value is 9
map.entries()
PASS i is 10
PASS key is 0
PASS value is 0
PASS key is '0'
PASS value is 1
PASS key is 1
PASS value is 2
PASS key is '1'
PASS value is 3
PASS key is 2
PASS value is 4
PASS key is '2'
PASS value is 5
PASS key is 3
PASS value is 6
PASS key is '3'
PASS value is 7
PASS key is 4
PASS value is 8
PASS key is '4'
PASS value is 9
PASS i is 10
map.keys()
PASS key is 0
PASS key is '0'
PASS key is 1
PASS key is '1'
PASS key is 2
PASS key is '2'
PASS key is 3
PASS key is '3'
PASS key is 4
PASS key is '4'
PASS i is 10
map.values()
PASS value is 0
PASS value is 1
PASS value is 2
PASS value is 3
PASS value is 4
PASS value is 5
PASS value is 6
PASS value is 7
PASS value is 8
PASS value is 9
PASS i is 10
Map mutation with live iterator and GC
PASS key is 1
PASS value is 2
PASS key is 3
PASS value is 6
PASS key is 4
PASS value is 8
PASS key is 5
PASS value is 10
PASS key is 7
PASS value is 14
PASS i is 5
PASS map.size is 4
test forEach
PASS key is 1
PASS value is 2
PASS key is 3
PASS value is 6
PASS key is 4
PASS value is 8
PASS key is 5
PASS value is 10
PASS key is 7
PASS value is 14
PASS i is 5
PASS map.size is 4
A dead iterator should remain dead
PASS count is 0
PASS count is 3
PASS count is 3
Implement ES6 Map object https://bugs.webkit.org/show_bug.cgi?id=120333 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Implement support for the ES6 Map type and related classes. * JavaScriptCore.xcodeproj/project.pbxproj: * heap/CopyToken.h: Add a new token to track copying the backing store * runtime/CommonIdentifiers.h: Add new identifiers * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: Add new structures and prototypes * runtime/JSMap.cpp: Added. * runtime/JSMap.h: Added. New JSMap class to represent a Map instance * runtime/MapConstructor.cpp: Added. * runtime/MapConstructor.h: Added. The Map constructor * runtime/MapData.cpp: Added. * runtime/MapData.h: Added. The most interesting data structure. The roughly corresponds to the ES6 notion of MapData. It provides the core JSValue->JSValue map implementation. We implement it using 2 hashtables and a flat table. Due to the different semantics of string comparisons vs. all others we need have one map keyed by String and the other by generic JSValue. The actual table is represented more or less exactly as described in the ES6 draft - a single contiguous list of key/value pairs. The entire map could be achieved with just this table, however we need the HashMaps in order to maintain O(1) lookup. Deleted values are simply cleared as the draft says, however the implementation compacts the storage on copy as long as the are no active iterators. * runtime/MapPrototype.cpp: Added. * runtime/MapPrototype.h: Added. Implement Map prototype functions * runtime/VM.cpp: Add new structures. LayoutTests: Tests * fast/js/basic-map-expected.txt: Added. * fast/js/basic-map.html: Added. * fast/js/script-tests/basic-map.js: Added. Canonical link: https://commits.webkit.org/138489@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@154861 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2013-08-30 00:55:34 +00:00
PASS successfullyParsed is true
TEST COMPLETE