[ES6] Align attributes of Generator related properties to spec
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Oct 2016 23:36:21 +0000 (23:36 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 1 Oct 2016 23:36:21 +0000 (23:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=162839

Reviewed by Saam Barati.

JSTests:

* test262.yaml:

Source/JavaScriptCore:

This patch fixes attributes of Generator related properties.
These fixes are covered by test262.

* runtime/GeneratorFunctionConstructor.cpp:
(JSC::GeneratorFunctionConstructor::finishCreation):
* runtime/GeneratorFunctionConstructor.h:
* runtime/GeneratorFunctionPrototype.cpp:
(JSC::GeneratorFunctionPrototype::finishCreation):
* runtime/GeneratorFunctionPrototype.h:
* runtime/GeneratorPrototype.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::init):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@206711 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JSTests/ChangeLog
JSTests/test262.yaml
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.cpp
Source/JavaScriptCore/runtime/GeneratorFunctionConstructor.h
Source/JavaScriptCore/runtime/GeneratorFunctionPrototype.cpp
Source/JavaScriptCore/runtime/GeneratorFunctionPrototype.h
Source/JavaScriptCore/runtime/GeneratorPrototype.h
Source/JavaScriptCore/runtime/JSGlobalObject.cpp

index f07414c..99697e1 100644 (file)
@@ -1,5 +1,14 @@
 2016-10-01  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        [ES6] Align attributes of Generator related properties to spec
+        https://bugs.webkit.org/show_bug.cgi?id=162839
+
+        Reviewed by Saam Barati.
+
+        * test262.yaml:
+
+2016-10-01  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         [ES6] GeneratorFunction constructor should instantiate generator function
         https://bugs.webkit.org/show_bug.cgi?id=162838
 
index d702751..3660f50 100644 (file)
 - path: test262/test/built-ins/GeneratorFunction/invoked-as-function-single-argument.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js"], [:strict]
 - path: test262/test/built-ins/GeneratorFunction/length.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorFunction/length.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorFunction/name.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorFunction/name.js
 - path: test262/test/built-ins/GeneratorFunction/prototype/Symbol.toStringTag.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorFunction/prototype/constructor.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorFunction/prototype/constructor.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorFunction/prototype/extensibility.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/built-ins/GeneratorFunction/prototype/extensibility.js
 - path: test262/test/built-ins/GeneratorFunction/prototype/prop-desc.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorFunction/prototype/prototype.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorFunction/prototype/prototype.js
-  cmd: runTest262 :fail, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js", "../../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorPrototype/Symbol.toStringTag.js
   cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorPrototype/constructor.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], []
 - path: test262/test/built-ins/GeneratorPrototype/constructor.js
-  cmd: runTest262 :fail, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], [:strict]
+  cmd: runTest262 :normal, "NoException", ["../../../harness/assert.js", "../../../harness/sta.js", "../../../harness/propertyHelper.js"], [:strict]
 - path: test262/test/built-ins/GeneratorPrototype/next/consecutive-yields.js
   cmd: runTest262 :normal, "NoException", ["../../../../harness/assert.js", "../../../../harness/sta.js"], []
 - path: test262/test/built-ins/GeneratorPrototype/next/consecutive-yields.js
index 3cdd644..24320ba 100644 (file)
@@ -1,5 +1,25 @@
 2016-10-01  Yusuke Suzuki  <utatane.tea@gmail.com>
 
+        [ES6] Align attributes of Generator related properties to spec
+        https://bugs.webkit.org/show_bug.cgi?id=162839
+
+        Reviewed by Saam Barati.
+
+        This patch fixes attributes of Generator related properties.
+        These fixes are covered by test262.
+
+        * runtime/GeneratorFunctionConstructor.cpp:
+        (JSC::GeneratorFunctionConstructor::finishCreation):
+        * runtime/GeneratorFunctionConstructor.h:
+        * runtime/GeneratorFunctionPrototype.cpp:
+        (JSC::GeneratorFunctionPrototype::finishCreation):
+        * runtime/GeneratorFunctionPrototype.h:
+        * runtime/GeneratorPrototype.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::init):
+
+2016-10-01  Yusuke Suzuki  <utatane.tea@gmail.com>
+
         [ES6] GeneratorFunction constructor should instantiate generator function
         https://bugs.webkit.org/show_bug.cgi?id=162838
 
index 97c8fd4..cb7c006 100644 (file)
@@ -47,7 +47,7 @@ void GeneratorFunctionConstructor::finishCreation(VM& vm, GeneratorFunctionProto
     putDirectWithoutTransition(vm, vm.propertyNames->prototype, generatorFunctionPrototype, DontEnum | DontDelete | ReadOnly);
 
     // Number of arguments for constructor
-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontDelete | DontEnum);
+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum);
 }
 
 static EncodedJSValue JSC_HOST_CALL callGeneratorFunctionConstructor(ExecState* exec)
index b18939e..f28c71c 100644 (file)
@@ -35,6 +35,8 @@ namespace JSC {
 
 class GeneratorFunctionPrototype;
 
+// %GeneratorFunction% intrinsic.
+// https://tc39.github.io/ecma262/#sec-generatorfunction-constructor
 class GeneratorFunctionConstructor : public InternalFunction {
 public:
     typedef InternalFunction Base;
index 6a36dab..59c865b 100644 (file)
@@ -51,7 +51,7 @@ void GeneratorFunctionPrototype::finishCreation(VM& vm)
 {
     Base::finishCreation(vm);
     ASSERT(inherits(info()));
-    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
+    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(0), ReadOnly | DontEnum);
     putDirectWithoutTransition(vm, vm.propertyNames->toStringTagSymbol, jsString(&vm, "GeneratorFunction"), DontEnum | ReadOnly);
     vm.prototypeMap.addPrototype(this);
 }
index f94cad2..c07e38a 100644 (file)
@@ -29,6 +29,8 @@
 
 namespace JSC {
 
+// %Generator% intrinsic.
+// https://tc39.github.io/ecma262/#sec-generatorfunction.prototype
 class GeneratorFunctionPrototype : public JSNonFinalObject {
 public:
     typedef JSNonFinalObject Base;
index 5fa61d5..afb7c97 100644 (file)
@@ -29,6 +29,8 @@
 
 namespace JSC {
 
+// %GeneratorPrototype% intrinsic.
+// https://tc39.github.io/ecma262/#sec-properties-of-generator-prototype
 class GeneratorPrototype : public JSNonFinalObject {
 public:
     typedef JSNonFinalObject Base;
index 973c2e8..4889cc6 100644 (file)
@@ -625,11 +625,11 @@ m_ ## lowerName ## Prototype->putDirectWithoutTransition(vm, vm.propertyNames->c
 
     m_generatorFunctionPrototype.set(vm, this, GeneratorFunctionPrototype::create(vm, GeneratorFunctionPrototype::createStructure(vm, this, m_functionPrototype.get())));
     GeneratorFunctionConstructor* generatorFunctionConstructor = GeneratorFunctionConstructor::create(vm, GeneratorFunctionConstructor::createStructure(vm, this, functionConstructor), m_generatorFunctionPrototype.get());
-    m_generatorFunctionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, generatorFunctionConstructor, DontEnum);
+    m_generatorFunctionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, generatorFunctionConstructor, DontEnum | ReadOnly);
     m_generatorFunctionStructure.set(vm, this, JSGeneratorFunction::createStructure(vm, this, m_generatorFunctionPrototype.get()));
 
-    m_generatorPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, m_generatorFunctionPrototype.get(), DontEnum);
-    m_generatorFunctionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->prototype, m_generatorPrototype.get(), DontEnum);
+    m_generatorPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, m_generatorFunctionPrototype.get(), DontEnum | ReadOnly);
+    m_generatorFunctionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->prototype, m_generatorPrototype.get(), DontEnum | ReadOnly);
     
     m_objectPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, objectConstructor, DontEnum);
     m_functionPrototype->putDirectWithoutTransition(vm, vm.propertyNames->constructor, functionConstructor, DontEnum);