Title: [271465] branches/safari-611-branch

Diff

Modified: branches/safari-611-branch/JSTests/ChangeLog (271464 => 271465)


--- branches/safari-611-branch/JSTests/ChangeLog	2021-01-13 23:18:33 UTC (rev 271464)
+++ branches/safari-611-branch/JSTests/ChangeLog	2021-01-13 23:18:36 UTC (rev 271465)
@@ -1,3 +1,7 @@
+2021-01-13  Russell Epstein  <[email protected]>
+
+        Revert r270664. rdar://problem/73165685
+
 2021-01-08  Alexey Shvayka  <[email protected]>
 
         Implement @copyDataProperties in C++ to optimize object rest / spread

Modified: branches/safari-611-branch/JSTests/test262/expectations.yaml (271464 => 271465)


--- branches/safari-611-branch/JSTests/test262/expectations.yaml	2021-01-13 23:18:33 UTC (rev 271464)
+++ branches/safari-611-branch/JSTests/test262/expectations.yaml	2021-01-13 23:18:36 UTC (rev 271465)
@@ -886,6 +886,16 @@
 test/intl402/Locale/prototype/minimize/removing-likely-subtags-first-adds-likely-subtags.js:
   default: 'Test262Error: "und".minimize() should be "en" Expected SameValue(«en-u-va-posix», «en») to be true'
   strict mode: 'Test262Error: "und".minimize() should be "en" Expected SameValue(«en-u-va-posix», «en») to be true'
+test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-arguments.js:
+  default: 'Test262Error: Expected obj[0] to have enumerable:false.'
+test/language/arguments-object/mapped/nonconfigurable-nonenumerable-nonwritable-descriptors-set-by-param.js:
+  default: 'Test262Error: Expected obj[0] to have enumerable:false.'
+test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-define-property-consecutive.js:
+  default: 'Test262Error: Expected obj[0] to have configurable:false.'
+test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-arguments.js:
+  default: 'Test262Error: Expected obj[0] to have configurable:false.'
+test/language/arguments-object/mapped/nonconfigurable-nonwritable-descriptors-set-by-param.js:
+  default: 'Test262Error: Expected obj[0] to have configurable:false.'
 test/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-function.js:
   default: 'Test262: This statement should not be evaluated.'
 test/language/block-scope/syntax/redeclaration/async-function-name-redeclaration-attempt-with-async-generator.js:

Modified: branches/safari-611-branch/Source/_javascript_Core/ChangeLog (271464 => 271465)


--- branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-01-13 23:18:33 UTC (rev 271464)
+++ branches/safari-611-branch/Source/_javascript_Core/ChangeLog	2021-01-13 23:18:36 UTC (rev 271465)
@@ -1,5 +1,9 @@
 2021-01-13  Russell Epstein  <[email protected]>
 
+        Revert r270664. rdar://problem/73165685
+
+2021-01-13  Russell Epstein  <[email protected]>
+
         Revert r270665. rdar://problem/73165685
 
 2021-01-13  Russell Epstein  <[email protected]>

Modified: branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h (271464 => 271465)


--- branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2021-01-13 23:18:33 UTC (rev 271464)
+++ branches/safari-611-branch/Source/_javascript_Core/runtime/GenericArgumentsInlines.h	2021-01-13 23:18:36 UTC (rev 271465)
@@ -209,7 +209,6 @@
     return deletedProperty;
 }
 
-// https://tc39.es/ecma262/#sec-arguments-exotic-objects-defineownproperty-p-desc
 template<typename Type>
 bool GenericArguments<Type>::defineOwnProperty(JSObject* object, JSGlobalObject* globalObject, PropertyName ident, const PropertyDescriptor& descriptor, bool shouldThrow)
 {
@@ -222,47 +221,56 @@
         || ident == vm.propertyNames->iteratorSymbol) {
         thisObject->overrideThingsIfNecessary(globalObject);
         RETURN_IF_EXCEPTION(scope, false);
-    } else if (Optional<uint32_t> optionalIndex = parseIndex(ident)) {
-        uint32_t index = optionalIndex.value();
-        bool isMapped = thisObject->isMappedArgument(index);
-        PropertyDescriptor newDescriptor = descriptor;
-
-        if (isMapped) {
-            if (thisObject->isModifiedArgumentDescriptor(index)) {
-                if (!descriptor.value() && descriptor.writablePresent() && !descriptor.writable())
-                    newDescriptor.setValue(thisObject->getIndexQuickly(index));
-            } else
-                thisObject->putDirectIndex(globalObject, index, thisObject->getIndexQuickly(index));
-
-            scope.assertNoException();
-        }
-
-        bool status = thisObject->defineOwnIndexedProperty(globalObject, index, newDescriptor, shouldThrow);
-        if (!status) {
-            ASSERT(!isMapped || thisObject->isModifiedArgumentDescriptor(index));
-            RELEASE_AND_RETURN(scope, false);
-        }
-
-        scope.assertNoException();
-        thisObject->setModifiedArgumentDescriptor(globalObject, index);
-        RETURN_IF_EXCEPTION(scope, false);
-
-        if (isMapped) {
-            if (descriptor.isAccessorDescriptor())
-                thisObject->unmapArgument(globalObject, index);
-            else {
+    } else {
+        Optional<uint32_t> optionalIndex = parseIndex(ident);
+        if (optionalIndex) {
+            uint32_t index = optionalIndex.value();
+            if (!descriptor.isAccessorDescriptor() && thisObject->isMappedArgument(optionalIndex.value())) {
+                // If the property is not deleted and we are using a non-accessor descriptor, then
+                // make sure that the aliased argument sees the value.
                 if (descriptor.value())
                     thisObject->setIndexQuickly(vm, index, descriptor.value());
-                if (descriptor.writablePresent() && !descriptor.writable())
+            
+                // If the property is not deleted and we are using a non-accessor, writable,
+                // configurable and enumerable descriptor and isn't modified, then we are done.
+                // The argument continues to be aliased.
+                if (descriptor.writable() && descriptor.configurable() && descriptor.enumerable() && !thisObject->isModifiedArgumentDescriptor(index))
+                    return true;
+                
+                if (!thisObject->isModifiedArgumentDescriptor(index)) {
+                    // If it is a new entry, we need to put direct to initialize argument[i] descriptor properly
+                    JSValue value = thisObject->getIndexQuickly(index);
+                    ASSERT(value);
+                    object->putDirectMayBeIndex(globalObject, ident, value);
+                    scope.assertNoException();
+
+                    thisObject->setModifiedArgumentDescriptor(globalObject, index);
+                    RETURN_IF_EXCEPTION(scope, false);
+                }
+            }
+            
+            if (thisObject->isMappedArgument(index)) {
+                // Just unmap arguments if its descriptor contains {writable: false}.
+                // Check https://tc39.github.io/ecma262/#sec-createunmappedargumentsobject
+                // and https://tc39.github.io/ecma262/#sec-createmappedargumentsobject to verify that all data
+                // property from arguments object are {writable: true, configurable: true, enumerable: true} by default
+                if ((descriptor.writablePresent() && !descriptor.writable()) || descriptor.isAccessorDescriptor()) {
+                    if (!descriptor.isAccessorDescriptor()) {
+                        JSValue value = thisObject->getIndexQuickly(index);
+                        ASSERT(value);
+                        object->putDirectMayBeIndex(globalObject, ident, value);
+                        scope.assertNoException();
+                    }
                     thisObject->unmapArgument(globalObject, index);
+                    RETURN_IF_EXCEPTION(scope, false);
+                    thisObject->setModifiedArgumentDescriptor(globalObject, index);
+                    RETURN_IF_EXCEPTION(scope, false);
+                }
             }
-
-            RETURN_IF_EXCEPTION(scope, false);
         }
-
-        return true;
     }
 
+    // Now just let the normal object machinery do its thing.
     RELEASE_AND_RETURN(scope, Base::defineOwnProperty(object, globalObject, ident, descriptor, shouldThrow));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to