[JSC] ES6 Method functions should not have prototype
authorcaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2016 12:51:33 +0000 (12:51 +0000)
committercaitp@igalia.com <caitp@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 18 Oct 2016 12:51:33 +0000 (12:51 +0000)
commit14b535623ad44d1e46e7676ddfb99363c5641a29
tree7e7845ed59f31ed994a9bfc752bfd84b320a450a
parent4232bea02d7ba0199c1b93d492c4e9a63c01d605
[JSC] ES6 Method functions should not have prototype
https://bugs.webkit.org/show_bug.cgi?id=162530

Reviewed by Saam Barati.

JSTests:

Fix test262 expectations about MethodDefinitions

* ChakraCore/test/strict/05.arguments_sm.baseline-jsc:
* stress/reflect-set.js:
* test262.yaml:

Source/JavaScriptCore:

ECMA-262 only adds "prototype" properties to specific syntactic function forms.
Specific items which do not contain "prototype" include (most) built-in functions (such as Math.pow),
MethodDefinitions which are not either class "constructor" methods or GeneratorMethods, AsyncFunctions,
and ArrowFunctions.

For details, see the following spec text, and the difference between GeneratorMethod evaluation and
the evaluation of other MethodDefinition forms.

- https://tc39.github.io/ecma262/#sec-method-definitions-runtime-semantics-propertydefinitionevaluation
- https://tc39.github.io/ecma262/#sec-arrow-function-definitions-runtime-semantics-evaluation
- https://tc39.github.io/ecmascript-asyncawait/#async-function-instances
- https://tc39.github.io/ecma262/#sec-generator-function-definitions-runtime-semantics-propertydefinitionevaluation

* runtime/Executable.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::callerGetter):
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::deleteProperty):

* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::makeFunction):
* runtime/Executable.h:
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
(JSC::JSFunction::getOwnNonIndexPropertyNames):
(JSC::JSFunction::put):
(JSC::JSFunction::deleteProperty):
(JSC::JSFunction::defineOwnProperty):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncThrowTypeErrorArgumentsCalleeAndCaller):

LayoutTests:

Update expected error message to no longer indicate "strict mode"
(which is not always true), and add additional tests for the presence
of "caller" and "arguments" on accessor MethodDefinitions.

* js/basic-strict-mode-expected.txt:
* js/caller-property-expected.txt:
* js/class-syntax-method-names-expected.txt:
* js/es6-function-properties-expected.txt:
* js/non-strict-function-properties-expected.txt:
* js/script-tests/caller-property.js:
* js/script-tests/class-syntax-method-names.js:
* js/script-tests/es6-function-properties.js:
(k.get getter):
(k.set setter):
(get checkProperties):
* js/script-tests/non-strict-function-properties.js:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@207461 268f45cc-cd09-0410-ab3c-d52691b4dbfc
19 files changed:
JSTests/ChakraCore/test/strict/05.arguments_sm.baseline-jsc
JSTests/ChangeLog
JSTests/stress/reflect-set.js
JSTests/test262.yaml
LayoutTests/ChangeLog
LayoutTests/js/basic-strict-mode-expected.txt
LayoutTests/js/caller-property-expected.txt
LayoutTests/js/class-syntax-method-names-expected.txt
LayoutTests/js/es6-function-properties-expected.txt
LayoutTests/js/non-strict-function-properties-expected.txt
LayoutTests/js/script-tests/caller-property.js
LayoutTests/js/script-tests/class-syntax-method-names.js
LayoutTests/js/script-tests/es6-function-properties.js
LayoutTests/js/script-tests/non-strict-function-properties.js
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/runtime/Executable.h
Source/JavaScriptCore/runtime/JSFunction.cpp
Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp