haikuwebkit/LayoutTests/js/object-literal-duplicate-pr...

244 lines
28 KiB
Plaintext
Raw Permalink Normal View History

ES6: Allow duplicate property names https://bugs.webkit.org/show_bug.cgi?id=142895 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Introduce new `op_put_getter_by_id` and `op_put_setter_by_id` opcodes that will define a single getter or setter property on an object. The existing `op_put_getter_setter` opcode is still preferred for putting both a getter and setter at the same time but cannot be used for putting an individual getter or setter which is needed in some cases. Add a new slow path when generating bytecodes for a property list with computed properties, as computed properties are the only time the list of properties cannot be determined statically. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): - fast path for all constant properties - slow but paired getter/setter path if there are no computed properties - slow path, individual put operation for every property, if there are computed properties * parser/Nodes.h: Distinguish a Computed property from a Constant property. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): Distingish Computed and Constant properties. (JSC::Parser<LexerType>::parseObjectLiteral): When we drop into strict mode it is because we saw a getter or setter, so be more explicit. (JSC::Parser<LexerType>::parseStrictObjectLiteral): Eliminate duplicate property syntax error exception. * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): Deleted. No longer used. * runtime/JSObject.h: (JSC::JSObject::putDirectInternal): When updating a property. If the Accessor attribute changed update the Structure. * runtime/JSObject.cpp: (JSC::JSObject::putGetter): (JSC::JSObject::putSetter): Called by the opcodes, just perform the same operation that __defineGetter__ or __defineSetter__ would do. (JSC::JSObject::putDirectNonIndexAccessor): This transition is now handled in putDirectInternal. * runtime/Structure.h: Add needed export. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): * bytecompiler/BytecodeGenerator.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: New bytecodes. Modelled after existing op_put_getter_setter. LayoutTests: * js/object-literal-duplicate-properties-expected.txt: Added. * js/object-literal-duplicate-properties.html: Added. * js/script-tests/object-literal-duplicate-properties.js: Added. Include a new test all about testing duplicate property names and their expected cascading results. * ietestcenter/Javascript/11.1.5_4-4-b-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-b-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-3-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-4-expected.txt: ES5 behavior for duplciate properties has changed. * js/mozilla/strict/11.1.5-expected.txt: * js/object-literal-syntax-expected.txt: * js/script-tests/object-literal-syntax.js: Update other tests and values now that duplicate properties are allowed, and their cascade order behaves correctly. Canonical link: https://commits.webkit.org/163028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-14 01:32:25 +00:00
basic tests for object literal duplicate properties
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
PASS x is 1
PASS o.foo is 'getter'
PASS x is 1
PASS o.foo is 0
PASS x is 1
PASS o.foo is 'getter'
PASS x is 1
PASS o.foo is 0
PASS x is 4
PASS o.foo is 3
PASS o.bar is undefined
Redefining a property should not change its insertion index (Object.keys order) https://bugs.webkit.org/show_bug.cgi?id=142933 Reviewed by Saam Barati. JSTests: * ChakraCore.yaml: * ChakraCore/test/es5/EnumeratingWithES5.baseline-jsc: Removed. * microbenchmarks/redefine-property-accessor-dictionary.js: Added. * microbenchmarks/redefine-property-accessor.js: Added. * microbenchmarks/redefine-property-data-dictionary.js: Added. * microbenchmarks/redefine-property-data.js: Added. * stress/define-own-indexed-property-fast-path.js: * stress/redefine-property-enumerable.js: Added. * stress/redefine-property-get.js: Added. * stress/redefine-property-set.js: Added. * stress/redefine-property-value.js: Added. * stress/redefine-property-writable.js: Added. * test262/expectations.yaml: Mark 12 test cases as passing. Source/JavaScriptCore: Before this change, JSC used to delete & put back a non-indexed property just to update attributes, which was less efficient and corrupted observable property order. This patch: 1. Rewrites validateAndApplyPropertyDescriptor() to closely resemble the spec [1]. 2. Drops property deletion, inlines putDescriptor(), and sets necessary Structure flags in attributeChangeTransition(). 3. Simplifies validateAndApplyPropertyDescriptor() a bit by obtaining GetterSetter instance from current descriptor rather then calling getDirect(). This change aligns property order with V8 and SpiderMonkey, advancing provided microbenchmarks by 5-85% (especially for objects in dictionary mode). SixSpeed, SunSpider, and ARES-6 are all neutral. [1]: https://tc39.es/ecma262/#sec-validateandapplypropertydescriptor * runtime/JSObject.cpp: (JSC::validateAndApplyPropertyDescriptor): (JSC::JSObject::defineOwnNonIndexProperty): (JSC::putDescriptor): Deleted. * runtime/JSObjectInlines.h: (JSC::JSObject::putDirectInternal): * runtime/PropertyDescriptor.cpp: (JSC::PropertyDescriptor::slowGetterSetter const): (JSC::PropertyDescriptor::slowGetterSetter): Deleted. * runtime/PropertyDescriptor.h: * runtime/Structure.cpp: (JSC::Structure::attributeChangeTransition): LayoutTests: * js/object-literal-duplicate-properties-expected.txt: * js/script-tests/object-literal-duplicate-properties.js: Canonical link: https://commits.webkit.org/227322@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@264574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-07-18 23:09:56 +00:00
PASS Object.keys(o).join() is 'foo,test1,bar,test2,test3,nest'
ES6: Allow duplicate property names https://bugs.webkit.org/show_bug.cgi?id=142895 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Introduce new `op_put_getter_by_id` and `op_put_setter_by_id` opcodes that will define a single getter or setter property on an object. The existing `op_put_getter_setter` opcode is still preferred for putting both a getter and setter at the same time but cannot be used for putting an individual getter or setter which is needed in some cases. Add a new slow path when generating bytecodes for a property list with computed properties, as computed properties are the only time the list of properties cannot be determined statically. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): - fast path for all constant properties - slow but paired getter/setter path if there are no computed properties - slow path, individual put operation for every property, if there are computed properties * parser/Nodes.h: Distinguish a Computed property from a Constant property. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): Distingish Computed and Constant properties. (JSC::Parser<LexerType>::parseObjectLiteral): When we drop into strict mode it is because we saw a getter or setter, so be more explicit. (JSC::Parser<LexerType>::parseStrictObjectLiteral): Eliminate duplicate property syntax error exception. * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): Deleted. No longer used. * runtime/JSObject.h: (JSC::JSObject::putDirectInternal): When updating a property. If the Accessor attribute changed update the Structure. * runtime/JSObject.cpp: (JSC::JSObject::putGetter): (JSC::JSObject::putSetter): Called by the opcodes, just perform the same operation that __defineGetter__ or __defineSetter__ would do. (JSC::JSObject::putDirectNonIndexAccessor): This transition is now handled in putDirectInternal. * runtime/Structure.h: Add needed export. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): * bytecompiler/BytecodeGenerator.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: New bytecodes. Modelled after existing op_put_getter_setter. LayoutTests: * js/object-literal-duplicate-properties-expected.txt: Added. * js/object-literal-duplicate-properties.html: Added. * js/script-tests/object-literal-duplicate-properties.js: Added. Include a new test all about testing duplicate property names and their expected cascading results. * ietestcenter/Javascript/11.1.5_4-4-b-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-b-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-3-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-4-expected.txt: ES5 behavior for duplciate properties has changed. * js/mozilla/strict/11.1.5-expected.txt: * js/object-literal-syntax-expected.txt: * js/script-tests/object-literal-syntax.js: Update other tests and values now that duplicate properties are allowed, and their cascade order behaves correctly. Canonical link: https://commits.webkit.org/163028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-14 01:32:25 +00:00
Basic
PASS o = {foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1}; o.foo = 2; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1}; o.foo = 2; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1}; o.foo = 2; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, foo:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, fooo:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:2 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, fooo:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:2 [ECW][Extensible]'
PASS (function(){o = {foo:1, fooo:2, foo:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, fooo:2, foo:3}; o.foo = 4; descriptionString(o, 'foo'); is 'value:4 keys:2 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, fooo:2, foo:3}; o.foo = 4; descriptionString(o, 'foo'); is 'value:4 keys:2 [ECW][Extensible]'
PASS (function(){o = {foo:1, fooo:2, foo:3}; o.foo = 4; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, fooo:2, foo:3, bar: 9}; descriptionString(o, 'foo'); is 'value:3 keys:3 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, fooo:2, foo:3, bar: 9}; descriptionString(o, 'foo'); is 'value:3 keys:3 [ECW][Extensible]'
PASS (function(){o = {foo:1, fooo:2, foo:3, bar: 9}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, foo:3}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, foo:3}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, foo:3}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.seal(o);; descriptionString(o, 'foo'); is 'value:3 keys:1 [EW][Sealed]'
PASS 'use strict';o = {foo:1, foo:3}; Object.seal(o);; descriptionString(o, 'foo'); is 'value:3 keys:1 [EW][Sealed]'
PASS (function(){o = {foo:1, foo:3}; Object.seal(o);; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo'); is 'value:5 keys:1 [EW][Sealed]'
PASS 'use strict';o = {foo:1, foo:3}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo'); is 'value:5 keys:1 [EW][Sealed]'
PASS (function(){o = {foo:1, foo:3}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [EW][Sealed]'
PASS 'use strict';o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [EW][Sealed]'
PASS (function(){o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS 'use strict';o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS (function(){o = {foo:1, foo:3}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo');})() threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS o = {foo:1, foo:3}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS 'use strict';o = {foo:1, foo:3}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS (function(){o = {foo:1, foo:3}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo');})() threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
ES6: Allow duplicate property names https://bugs.webkit.org/show_bug.cgi?id=142895 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Introduce new `op_put_getter_by_id` and `op_put_setter_by_id` opcodes that will define a single getter or setter property on an object. The existing `op_put_getter_setter` opcode is still preferred for putting both a getter and setter at the same time but cannot be used for putting an individual getter or setter which is needed in some cases. Add a new slow path when generating bytecodes for a property list with computed properties, as computed properties are the only time the list of properties cannot be determined statically. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): - fast path for all constant properties - slow but paired getter/setter path if there are no computed properties - slow path, individual put operation for every property, if there are computed properties * parser/Nodes.h: Distinguish a Computed property from a Constant property. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): Distingish Computed and Constant properties. (JSC::Parser<LexerType>::parseObjectLiteral): When we drop into strict mode it is because we saw a getter or setter, so be more explicit. (JSC::Parser<LexerType>::parseStrictObjectLiteral): Eliminate duplicate property syntax error exception. * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): Deleted. No longer used. * runtime/JSObject.h: (JSC::JSObject::putDirectInternal): When updating a property. If the Accessor attribute changed update the Structure. * runtime/JSObject.cpp: (JSC::JSObject::putGetter): (JSC::JSObject::putSetter): Called by the opcodes, just perform the same operation that __defineGetter__ or __defineSetter__ would do. (JSC::JSObject::putDirectNonIndexAccessor): This transition is now handled in putDirectInternal. * runtime/Structure.h: Add needed export. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): * bytecompiler/BytecodeGenerator.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: New bytecodes. Modelled after existing op_put_getter_setter. LayoutTests: * js/object-literal-duplicate-properties-expected.txt: Added. * js/object-literal-duplicate-properties.html: Added. * js/script-tests/object-literal-duplicate-properties.js: Added. Include a new test all about testing duplicate property names and their expected cascading results. * ietestcenter/Javascript/11.1.5_4-4-b-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-b-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-3-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-4-expected.txt: ES5 behavior for duplciate properties has changed. * js/mozilla/strict/11.1.5-expected.txt: * js/object-literal-syntax-expected.txt: * js/script-tests/object-literal-syntax.js: Update other tests and values now that duplicate properties are allowed, and their cascade order behaves correctly. Canonical link: https://commits.webkit.org/163028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-14 01:32:25 +00:00
Basic + Computed
PASS o = {['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, ['foo']:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, foo:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, foo:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, foo:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, ['foo']:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, ['foo']:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, ['foo']:2, foo:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, foo:2, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, foo:2, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, foo:2, ['foo']:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, ['foo']:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, ['foo']:2}; o.foo = 3; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, ['foo']:2}; o.foo = 3; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, ['foo']:2}; o.foo = 3; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, ['bar']:2}; descriptionString(o, 'foo'); is 'value:1 keys:2 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, ['bar']:2}; descriptionString(o, 'foo'); is 'value:1 keys:2 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, ['bar']:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, ['bar']:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:2 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, ['bar']:2, foo:3}; descriptionString(o, 'foo'); is 'value:3 keys:2 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, ['bar']:2, foo:3}; descriptionString(o, 'foo');})() did not throw exception.
Basic + Accessor
PASS o = {get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {get foo(){return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {set foo(x){}}; descriptionString(o, 'foo'); is 'setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {set foo(x){}}; descriptionString(o, 'foo'); is 'setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {set foo(x){}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 1}, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {get foo(){return 1}, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {get foo(){return 1}, get foo(){return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, set foo(x){}, get foo(){return 3}}; descriptionString(o, 'foo'); is 'getter:function value:(3) setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, set foo(x){}, get foo(){return 3}}; descriptionString(o, 'foo'); is 'getter:function value:(3) setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {get foo(){return 2}, set foo(x){}, get foo(){return 3}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {bar:1, get foo(){return 2}, set foo(x){}, baz:1}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:3 [EC][Extensible]'
PASS 'use strict';o = {bar:1, get foo(){return 2}, set foo(x){}, baz:1}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:3 [EC][Extensible]'
PASS (function(){o = {bar:1, get foo(){return 2}, set foo(x){}, baz:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, set foo(x){}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, set foo(x){}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, set foo(x){}, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return -1}, foo:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return -1}, foo:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, get foo(){return -1}, foo:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 2}, bar:3}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:2 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 2}, bar:3}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:2 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 2}, bar:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return -1}, foo:-1, get foo() {return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return -1}, foo:-1, get foo() {return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return -1}, foo:-1, get foo() {return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); is 'value:5 keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 3}}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); is 'getter:function value:(5) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 3}}; o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}, set foo(x){}}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo'); is 'getter:function value:(3) setter:function keys:1 [E][Sealed][Frozen]'
PASS 'use strict';o = {foo:1, get foo(){return 3}, set foo(x){}}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo'); is 'getter:function value:(3) setter:function keys:1 [E][Sealed][Frozen]'
PASS (function(){o = {foo:1, get foo(){return 3}, set foo(x){}}; Object.seal(o); o.foo = 5; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}}; Object.seal(o);; descriptionString(o, 'foo'); is 'getter:function value:(3) keys:1 [E][Sealed][Frozen]'
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.seal(o);; descriptionString(o, 'foo'); is 'getter:function value:(3) keys:1 [E][Sealed][Frozen]'
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.seal(o);; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change the getter of an unconfigurable property..
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change the getter of an unconfigurable property..
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {get(){return 5}}); descriptionString(o, 'foo');})() threw exception TypeError: Attempting to change the getter of an unconfigurable property..
PASS o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.seal(o); Object.defineProperty(o, 'foo', {value:5}); descriptionString(o, 'foo');})() threw exception TypeError: Attempting to change access mechanism for an unconfigurable property..
PASS o = {foo:1, get foo(){return 3}}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS 'use strict';o = {foo:1, get foo(){return 3}}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo'); threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
PASS (function(){o = {foo:1, get foo(){return 3}}; Object.seal(o); o.__defineGetter__('foo', function(){return 5}); descriptionString(o, 'foo');})() threw exception TypeError: Attempting to change configurable attribute of unconfigurable property..
ES6: Allow duplicate property names https://bugs.webkit.org/show_bug.cgi?id=142895 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Introduce new `op_put_getter_by_id` and `op_put_setter_by_id` opcodes that will define a single getter or setter property on an object. The existing `op_put_getter_setter` opcode is still preferred for putting both a getter and setter at the same time but cannot be used for putting an individual getter or setter which is needed in some cases. Add a new slow path when generating bytecodes for a property list with computed properties, as computed properties are the only time the list of properties cannot be determined statically. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): - fast path for all constant properties - slow but paired getter/setter path if there are no computed properties - slow path, individual put operation for every property, if there are computed properties * parser/Nodes.h: Distinguish a Computed property from a Constant property. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): Distingish Computed and Constant properties. (JSC::Parser<LexerType>::parseObjectLiteral): When we drop into strict mode it is because we saw a getter or setter, so be more explicit. (JSC::Parser<LexerType>::parseStrictObjectLiteral): Eliminate duplicate property syntax error exception. * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): Deleted. No longer used. * runtime/JSObject.h: (JSC::JSObject::putDirectInternal): When updating a property. If the Accessor attribute changed update the Structure. * runtime/JSObject.cpp: (JSC::JSObject::putGetter): (JSC::JSObject::putSetter): Called by the opcodes, just perform the same operation that __defineGetter__ or __defineSetter__ would do. (JSC::JSObject::putDirectNonIndexAccessor): This transition is now handled in putDirectInternal. * runtime/Structure.h: Add needed export. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): * bytecompiler/BytecodeGenerator.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: New bytecodes. Modelled after existing op_put_getter_setter. LayoutTests: * js/object-literal-duplicate-properties-expected.txt: Added. * js/object-literal-duplicate-properties.html: Added. * js/script-tests/object-literal-duplicate-properties.js: Added. Include a new test all about testing duplicate property names and their expected cascading results. * ietestcenter/Javascript/11.1.5_4-4-b-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-b-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-3-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-4-expected.txt: ES5 behavior for duplciate properties has changed. * js/mozilla/strict/11.1.5-expected.txt: * js/object-literal-syntax-expected.txt: * js/script-tests/object-literal-syntax.js: Update other tests and values now that duplicate properties are allowed, and their cascade order behaves correctly. Canonical link: https://commits.webkit.org/163028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-14 01:32:25 +00:00
Computed + Accessor
PASS o = {['foo']:1, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {['foo']:1, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {['foo']:1, get foo(){return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {['foo']:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {['foo']:1, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, ['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, ['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, ['foo']:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, set foo(x){}, ['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, set foo(x){}, ['foo']:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, set foo(x){}, ['foo']:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, get foo(){return -1}, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:1, get foo(){return -1}, ['foo']:2}; descriptionString(o, 'foo'); is 'value:2 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:1, get foo(){return -1}, ['foo']:2}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, get foo(){return 2}, ['bar']:3}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:2 [EC][Extensible]'
PASS 'use strict';o = {['foo']:1, get foo(){return 2}, ['bar']:3}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:2 [EC][Extensible]'
PASS (function(){o = {['foo']:1, get foo(){return 2}, ['bar']:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:1, get foo(){return -1}, ['foo']:-1, get foo() {return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {['foo']:1, get foo(){return -1}, ['foo']:-1, get foo() {return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {['foo']:1, get foo(){return -1}, ['foo']:-1, get foo() {return 2}}; descriptionString(o, 'foo');})() did not throw exception.
Basic + Computed + Accessor
PASS o = {foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, ['foo']:3, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, ['foo']:3, get foo(){return 2}}; descriptionString(o, 'foo'); is 'getter:function value:(2) keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, ['foo']:3, get foo(){return 2}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {foo:1, ['foo']:3, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS 'use strict';o = {foo:1, ['foo']:3, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo'); is 'getter:function value:(2) setter:function keys:1 [EC][Extensible]'
PASS (function(){o = {foo:1, ['foo']:3, get foo(){return 2}, set foo(x){}}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, ['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, ['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, ['foo']:3, get foo(){return 2}, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {set foo(x){}, ['foo']:3, set foo(x){}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {set foo(x){}, ['foo']:3, set foo(x){}, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {set foo(x){}, ['foo']:3, set foo(x){}, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {set foo(x){}, foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {set foo(x){}, foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo'); is 'value:3 keys:1 [ECW][Extensible]'
PASS (function(){o = {set foo(x){}, foo:1, get foo(){return 2}, ['foo']:3}; descriptionString(o, 'foo');})() did not throw exception.
PASS o = {get foo(){return 2}, get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS 'use strict';o = {get foo(){return 2}, get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo'); is 'value:1 keys:1 [ECW][Extensible]'
PASS (function(){o = {get foo(){return 2}, get foo(){return 2}, ['foo']:3, foo:1}; descriptionString(o, 'foo');})() did not throw exception.
ES6: Should not allow duplicate basic __proto__ properties in Object Literals https://bugs.webkit.org/show_bug.cgi?id=145138 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-20 Reviewed by Darin Adler. Source/JavaScriptCore: Implement ES6 Annex B.3.1, which disallows duplicate basic __proto__ properties in object literals. This doesn't affect computed properties, shorthand properties, or getters/setters all of which avoid setting the actual prototype of the object anyway. * interpreter/Interpreter.cpp: (JSC::eval): Remove out of date comment. Duplicate property names are allowed now in ES6, they were not in ES5 strict mode. * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): (JSC::ASTBuilder::getType): * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): Add back getName to get the property name depending on the tree builder. Also tighten up the parameter types. * runtime/LiteralParser.cpp: (JSC::LiteralParser<CharType>::parse): In quick JSON literal parsing for eval, we actually need to evaluate the __proto__ property assignment, instead of just building up a list of direct properties. Only do this when not doing a strict JSON parse. * parser/Nodes.h: Add "Shorthand" to the list of PropertyNode types to allow it to be distinguished without relying on other information. * parser/Parser.h: * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): Add the Shorthand type when parsing a shorthand property. (JSC::Parser<LexerType>::shouldCheckPropertyForUnderscoreProtoDuplicate): (JSC::Parser<LexerType>::parseObjectLiteral): (JSC::Parser<LexerType>::parseStrictObjectLiteral): Check for duplicate __proto__ properties, and throw a SyntaxError if that was the case. LayoutTests: * js/dom/JSON-parse-expected.txt: * js/resources/JSON-parse.js: Update expected results for JSON parsing using eval() versus JSON.parse. In eval, an object literal with a "__proto__" property modifies the prototype. In JSON.parse, all properties are direct/own properties, no matter their name, so "__proto__" does not get special treatment. * js/eval-json-proto-expected.txt: Added. * js/eval-json-proto.html: Added. * js/script-tests/eval-json-proto.js: Added. Direct test for LiteralParser behavior, in both eval and JSON.parse. * js/object-literal-duplicate-properties-expected.txt: * js/script-tests/object-literal-duplicate-properties.js: (runProtoTestShouldThrow): (runProtoTestShouldNotThrow): Test for all cases of acceptable and unacceptable __proto__ duplicate properties in literals. Canonical link: https://commits.webkit.org/163219@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-20 16:54:09 +00:00
Duplicate simple __proto__ attributes are not allowed
PASS o = {__proto__:null} did not throw exception.
PASS 'use strict';o = {__proto__:null} did not throw exception.
PASS (function(){o = {__proto__:null}})() did not throw exception.
PASS ({__proto__:null, ['__proto__']:{}}) did not throw exception.
PASS 'use strict';({__proto__:null, ['__proto__']:{}}) did not throw exception.
PASS (function(){({__proto__:null, ['__proto__']:{}})})() did not throw exception.
PASS o = {__proto__:null, ['__proto__']:{}} did not throw exception.
PASS 'use strict';o = {__proto__:null, ['__proto__']:{}} did not throw exception.
PASS (function(){o = {__proto__:null, ['__proto__']:{}}})() did not throw exception.
PASS o = {__proto__:null, get __proto__(){}} did not throw exception.
PASS 'use strict';o = {__proto__:null, get __proto__(){}} did not throw exception.
PASS (function(){o = {__proto__:null, get __proto__(){}}})() did not throw exception.
PASS var __proto__ = null; o = {__proto__:null, __proto__} did not throw exception.
PASS 'use strict';var __proto__ = null; o = {__proto__:null, __proto__} did not throw exception.
PASS (function(){var __proto__ = null; o = {__proto__:null, __proto__}})() did not throw exception.
PASS ({__proto__:[], __proto__:{}}) threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS 'use strict';({__proto__:[], __proto__:{}}) threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS (function(){({__proto__:[], __proto__:{}})})() threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS o = {__proto__:null, '__proto__':{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS 'use strict';o = {__proto__:null, '__proto__':{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS (function(){o = {__proto__:null, '__proto__':{}}})() threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS o = {__proto__:[], __proto__:{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS 'use strict';o = {__proto__:[], __proto__:{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS (function(){o = {__proto__:[], __proto__:{}}})() threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS o = {'__proto__':{}, '__proto__':{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS 'use strict';o = {'__proto__':{}, '__proto__':{}} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS (function(){o = {'__proto__':{}, '__proto__':{}}})() threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS o = {a:1, __proto__:{}, b:2, ['c']:3, __proto__:{}, d:3} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS 'use strict';o = {a:1, __proto__:{}, b:2, ['c']:3, __proto__:{}, d:3} threw exception SyntaxError: Attempted to redefine __proto__ property..
PASS (function(){o = {a:1, __proto__:{}, b:2, ['c']:3, __proto__:{}, d:3}})() threw exception SyntaxError: Attempted to redefine __proto__ property..
ES6: Allow duplicate property names https://bugs.webkit.org/show_bug.cgi?id=142895 Patch by Joseph Pecoraro <pecoraro@apple.com> on 2015-05-13 Reviewed by Geoffrey Garen. Source/JavaScriptCore: Introduce new `op_put_getter_by_id` and `op_put_setter_by_id` opcodes that will define a single getter or setter property on an object. The existing `op_put_getter_setter` opcode is still preferred for putting both a getter and setter at the same time but cannot be used for putting an individual getter or setter which is needed in some cases. Add a new slow path when generating bytecodes for a property list with computed properties, as computed properties are the only time the list of properties cannot be determined statically. * bytecompiler/NodesCodegen.cpp: (JSC::PropertyListNode::emitBytecode): - fast path for all constant properties - slow but paired getter/setter path if there are no computed properties - slow path, individual put operation for every property, if there are computed properties * parser/Nodes.h: Distinguish a Computed property from a Constant property. * parser/Parser.cpp: (JSC::Parser<LexerType>::parseProperty): (JSC::Parser<LexerType>::parsePropertyMethod): Distingish Computed and Constant properties. (JSC::Parser<LexerType>::parseObjectLiteral): When we drop into strict mode it is because we saw a getter or setter, so be more explicit. (JSC::Parser<LexerType>::parseStrictObjectLiteral): Eliminate duplicate property syntax error exception. * parser/SyntaxChecker.h: (JSC::SyntaxChecker::getName): * parser/ASTBuilder.h: (JSC::ASTBuilder::getName): Deleted. No longer used. * runtime/JSObject.h: (JSC::JSObject::putDirectInternal): When updating a property. If the Accessor attribute changed update the Structure. * runtime/JSObject.cpp: (JSC::JSObject::putGetter): (JSC::JSObject::putSetter): Called by the opcodes, just perform the same operation that __defineGetter__ or __defineSetter__ would do. (JSC::JSObject::putDirectNonIndexAccessor): This transition is now handled in putDirectInternal. * runtime/Structure.h: Add needed export. * bytecode/BytecodeList.json: * bytecode/BytecodeUseDef.h: (JSC::computeUsesForBytecodeOffset): (JSC::computeDefsForBytecodeOffset): * bytecode/CodeBlock.cpp: (JSC::CodeBlock::dumpBytecode): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::emitPutGetterById): (JSC::BytecodeGenerator::emitPutSetterById): * bytecompiler/BytecodeGenerator.h: * jit/JIT.cpp: (JSC::JIT::privateCompileMainPass): * jit/JIT.h: * jit/JITInlines.h: (JSC::JIT::callOperation): * jit/JITOperations.cpp: * jit/JITOperations.h: * jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * jit/JITPropertyAccess32_64.cpp: (JSC::JIT::emit_op_put_getter_by_id): (JSC::JIT::emit_op_put_setter_by_id): * llint/LLIntSlowPaths.cpp: (JSC::LLInt::LLINT_SLOW_PATH_DECL): * llint/LLIntSlowPaths.h: * llint/LowLevelInterpreter.asm: New bytecodes. Modelled after existing op_put_getter_setter. LayoutTests: * js/object-literal-duplicate-properties-expected.txt: Added. * js/object-literal-duplicate-properties.html: Added. * js/script-tests/object-literal-duplicate-properties.js: Added. Include a new test all about testing duplicate property names and their expected cascading results. * ietestcenter/Javascript/11.1.5_4-4-b-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-b-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-c-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-1-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-2-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-3-expected.txt: * ietestcenter/Javascript/11.1.5_4-4-d-4-expected.txt: ES5 behavior for duplciate properties has changed. * js/mozilla/strict/11.1.5-expected.txt: * js/object-literal-syntax-expected.txt: * js/script-tests/object-literal-syntax.js: Update other tests and values now that duplicate properties are allowed, and their cascade order behaves correctly. Canonical link: https://commits.webkit.org/163028@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@184324 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2015-05-14 01:32:25 +00:00
PASS successfullyParsed is true
TEST COMPLETE