Ignore:
Timestamp:
Feb 5, 2021, 10:58:06 AM (5 years ago)
Author:
[email protected]
Message:

[JSC] globalFuncCopyDataProperties should not perform GC-sensitive operation in the middle of Structure::forEachProperty
https://bugs.webkit.org/show_bug.cgi?id=221454

Reviewed by Mark Lam.

JSTests:

  • stress/copy-data-properties-fast-path.js: Added.

(foo):

Source/JavaScriptCore:

isPropertyNameExcluded can invoke GC etc. And running Structure::forEachProperty
is fragile state against any side-effect including GC.
We should not perform GC-sensitive operation during Structure::forEachProperty.

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::JSC_DEFINE_HOST_FUNCTION):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r272364 r272428  
    886886                return true;
    887887
    888             bool excluded = isPropertyNameExcluded(globalObject, propertyName);
    889             RETURN_IF_EXCEPTION(scope, false);
    890             if (excluded)
    891                 return true;
    892888            if (entry.attributes & PropertyAttribute::DontEnum)
    893889                return true;
     
    903899            // FIXME: We could put properties in a batching manner to accelerate CopyDataProperties more.
    904900            // https://bugs.webkit.org/show_bug.cgi?id=185358
     901            bool excluded = isPropertyNameExcluded(globalObject, properties[i].get());
     902            RETURN_IF_EXCEPTION(scope, { });
     903            if (excluded)
     904                continue;
    905905            target->putDirect(vm, properties[i].get(), values.at(i));
    906906        }
Note: See TracChangeset for help on using the changeset viewer.