haikuwebkit/LayoutTests/js/weakref-eventually-collects...

11 lines
272 B
HTML
Raw Permalink Normal View History

[JSC] Remove already-shipped JS feature flags https://bugs.webkit.org/show_bug.cgi?id=229387 Reviewed by Ross Kirsling. JSTests: * microbenchmarks/class-fields-private/get-private-name.js: * microbenchmarks/class-fields-private/monomorphic-get-private-field.js: * microbenchmarks/class-fields-private/polymorphic-get-private-field.js: * microbenchmarks/class-fields-private/polymorphic-put-private-field.js: * microbenchmarks/class-fields-private/put-private-field.js: * stress/class-fields-private-as-function.js: * stress/class-fields-private-cached-bytecode.js: * stress/class-fields-private-freeze-out-of-line.js: * stress/class-fields-private-freeze.js: * stress/class-fields-private-harmony.js: * stress/class-fields-private-on-proxy.js: * stress/class-fields-private-out-of-line.js: * stress/class-fields-private-prevent-extensions-out-of-line.js: * stress/class-fields-private-prevent-extensions.js: * stress/class-fields-private-seal-out-of-line.js: * stress/class-fields-private-seal.js: * stress/class-fields-private-use-eval.js: * stress/class-fields-static-harmony.js: * stress/class-fields-static-private-harmony.js: * stress/class-fields-stress-instance.js: * stress/class-private-method-access.js: * stress/dfg-get-private-name-by-id-generic.js: * stress/dfg-get-private-name-by-id-osr-bad-identifier.js: * stress/dfg-get-private-name-by-id.js: * stress/dfg-get-private-name-by-offset-osr-bad-identifier.js: * stress/dfg-get-private-name-by-offset-osr-bad-structure.js: * stress/dfg-get-private-name-by-offset.js: * stress/dfg-get-private-name-by-val-generic.js: * stress/dfg-put-private-name-check-barrier-insertion.js: * stress/dfg-put-private-name-compiled-as-put-by-id-direct.js: * stress/dfg-put-private-name-compiled-as-put-private-name-by-id.js: * stress/ftl-get-private-name-by-id.js: * stress/ftl-get-private-name-by-offset-multi.js: * stress/get-private-name-cache-failure.js: * stress/get-private-name-with-constant-ident.js: * stress/get-private-name-with-constant-symbol.js: * stress/get-private-name-with-different-symbol.js: * stress/get-private-name-with-primitive.js: * stress/get-private-name.js: * stress/optional-chaining-and-private-fields.js: * stress/private-accesor-duplicate-name-early-errors.js: * stress/private-accessor-static-non-static.js: * stress/private-brand-installed-after-super-call-from-arrow-function.js: * stress/private-brand-installed-after-super-call-from-eval.js: * stress/private-getter-brand-check.js: * stress/private-getter-inner-class.js: * stress/private-in-error.js: * stress/private-in.js: * stress/private-members-get-and-set.js: * stress/private-method-and-field-named-constructor.js: * stress/private-method-brand-check.js: * stress/private-method-change-attribute-from-branded-structure.js: * stress/private-method-change-prototype-from-branded-structure.js: * stress/private-method-check-private-brand-ic.js: * stress/private-method-check-structure-miss.js: * stress/private-method-comparison.js: * stress/private-method-delete-property-from-branded-structure.js: * stress/private-method-extends-brand-check.js: * stress/private-method-get-and-call.js: * stress/private-method-invalid-multiple-brand-installation.js: * stress/private-method-invalidate-compiled-with-constant-symbol.js: * stress/private-method-nested-class.js: * stress/private-method-on-sealed-objects.js: * stress/private-method-on-uncacheable-dictionary.js: * stress/private-method-polymorphic-with-constant-symbol.js: * stress/private-method-set-brand-should-have-write-barrier.js: * stress/private-method-untyped-use.js: * stress/private-method-with-uncacheable-dictionary-transition.js: * stress/private-methods-and-accessors-postfix-node.js: * stress/private-methods-and-accessors-prefix-node.js: * stress/private-methods-inline-cache.js: * stress/private-methods-megamorphic-ic.js: * stress/private-methods-on-proxy.js: * stress/private-methods-poly-ic-multiple-classes.js: * stress/private-methods-poly-ic-single-class.js: * stress/private-name-access-in-computed-property.js: * stress/private-names-available-on-direct-eval.js: * stress/private-names-available-on-eval-during-field-initialization.js: * stress/private-setter-brand-check.js: * stress/private-setter-inner-class.js: * stress/put-by-val-direct-addprivate.js: * stress/put-by-val-direct-putprivate.js: * stress/put-private-name-by-id-set-do-not-add-structure-trasition.js: * stress/put-private-name-check-structure-miss.js: * stress/put-private-name-constant-folding-to-mult-put-by-offset.js: * stress/put-private-name-constant-folding-to-put-by-offset.js: * stress/put-private-name-generic.js: * stress/put-private-name-invalid-define.js: * stress/put-private-name-invalid-store.js: * stress/put-private-name-invalidate-compiled-with-constant-symbol.js: * stress/put-private-name-polymorphic-with-constant-symbol.js: * stress/put-private-name-untyped-use.js: * stress/put-private-name-with-constant-symbol.js: * stress/put-private-name-with-different-identifier.js: * stress/put-private-name-with-primitive.js: * stress/static-private-methods-and-accessor-inner-class.js: * stress/static-private-methods-and-accessor-multiple-evaluation.js: * stress/static-private-methods-and-accessors-postfix-node.js: * stress/static-private-methods-and-accessors-prefix-node.js: * stress/v8-cleanup-from-different-realm.js: * stress/v8-cleanup-proxy-from-different-realm.js: * stress/v8-finalization-registry-basics.js: * stress/v8-finalizationregistry-and-weakref.js: * stress/v8-finalizationregistry-keeps-holdings-alive.js: * stress/v8-finalizationregistry-scheduled-for-cleanup-multiple-times.js: * stress/v8-multiple-dirty-finalization-registries.js: * stress/v8-reentrant-gc-from-cleanup.js: * stress/v8-stress-finalizationregistry-dirty-enqueue.js: * stress/v8-undefined-holdings.js: * stress/v8-unregister-after-cleanup.js: * stress/v8-unregister-before-cleanup.js: * stress/v8-unregister-called-twice.js: * stress/v8-unregister-inside-cleanup2.js: * stress/v8-unregister-inside-cleanup3.js: * stress/v8-unregister-many.js: * stress/v8-weak-unregistertoken.js: * test262/config.yaml: Source/JavaScriptCore: These features are already shipped. So removing these runtime flags to clean up source code and remove untested path. * API/JSObjectRef.cpp: (JSObjectMakeError): * bytecompiler/BytecodeGenerator.cpp: (JSC::BytecodeGenerator::BytecodeGenerator): * bytecompiler/NodesCodegen.cpp: (JSC::FunctionCallValueNode::emitBytecode): * parser/Lexer.cpp: (JSC::Lexer<T>::lexWithoutClearingLineTerminator): * parser/Parser.cpp: (JSC::Parser<LexerType>::parseInner): (JSC::Parser<LexerType>::parseForStatement): (JSC::Parser<LexerType>::parseClass): (JSC::Parser<LexerType>::parseBinaryExpression): (JSC::Parser<LexerType>::parseGetterSetter): (JSC::Parser<LexerType>::parsePrimaryExpression): (JSC::Parser<LexerType>::parseUnaryExpression): * runtime/AggregateErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/ErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * runtime/JSGlobalObject.h: * runtime/NativeErrorConstructor.cpp: (JSC::NativeErrorConstructor<errorType>::constructImpl): (JSC::NativeErrorConstructor<errorType>::callImpl): * runtime/Options.cpp: (JSC::Options::recomputeDependentOptions): * runtime/OptionsList.h: * wasm/js/WebAssemblyCompileErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyLinkErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): * wasm/js/WebAssemblyRuntimeErrorConstructor.cpp: (JSC::JSC_DEFINE_HOST_FUNCTION): Tools: * Scripts/run-jsc-benchmarks: LayoutTests: * js/script-tests/weakref-async-is-collected.js: * js/script-tests/weakref-eventually-collects-values.js: * js/script-tests/weakref-finalizationregistry.js: * js/script-tests/weakref-microtasks-dont-collect.js: * js/script-tests/weakref-weakset-consistency.js: * js/weakref-async-is-collected.html: * js/weakref-eventually-collects-values.html: * js/weakref-finalizationregistry.html: * js/weakref-microtasks-dont-collect.html: * js/weakref-weakset-consistency.html: * webaudio/finished-audio-buffer-source-nodes-should-be-collectable.html: Canonical link: https://commits.webkit.org/240816@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@281429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-08-23 01:06:11 +00:00
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
Add support for WeakRef https://bugs.webkit.org/show_bug.cgi?id=198710 Reviewed by Yusuke Suzuki. Source/JavaScriptCore: Add support for WeakRefs which are now at stage 3 (https://tc39.es/proposal-weakrefs). This patch doesn't add support for FinalizationGroups, which I'll add in another patch. Some other things of interest. Per the spec, we cannot collect a weak refs target unless it has not been dereffed (or created) in the current microtask turn. i.e. WeakRefs are only allowed to be collected at the end of a drain of the Microtask queue. My understanding for this behavior is to reduce implementation dependence on specific GC behavior in a given browser. We track if a WeakRef is retaining its target by using a version number on each WeakRef as well as on the VM. Whenever a WeakRef is derefed we update its version number to match the VM's then WriteBarrier ourselves. During marking if the VM and the WeakRef have the same version number, the target is visited. * JavaScriptCore.xcodeproj/project.pbxproj: * Sources.txt: * heap/Heap.cpp: (JSC::Heap::finalizeUnconditionalFinalizers): * jsc.cpp: (GlobalObject::finishCreation): (functionReleaseWeakRefs): * runtime/CommonIdentifiers.h: * runtime/JSGlobalObject.cpp: * runtime/JSGlobalObject.h: * runtime/JSWeakObjectRef.cpp: Added. (JSC::JSWeakObjectRef::finishCreation): (JSC::JSWeakObjectRef::visitChildren): (JSC::JSWeakObjectRef::finalizeUnconditionally): (JSC::JSWeakObjectRef::toStringName): * runtime/JSWeakObjectRef.h: Added. * runtime/VM.cpp: (JSC::VM::drainMicrotasks): * runtime/VM.h: (JSC::VM::setOnEachMicrotaskTick): (JSC::VM::finalizeSynchronousJSExecution): (JSC::VM::currentWeakRefVersion const): * runtime/WeakObjectRefConstructor.cpp: Added. (JSC::WeakObjectRefConstructor::finishCreation): (JSC::WeakObjectRefConstructor::WeakObjectRefConstructor): (JSC::callWeakRef): (JSC::constructWeakRef): * runtime/WeakObjectRefConstructor.h: Added. (JSC::WeakObjectRefConstructor::create): (JSC::WeakObjectRefConstructor::createStructure): * runtime/WeakObjectRefPrototype.cpp: Added. (JSC::WeakObjectRefPrototype::finishCreation): (JSC::getWeakRef): (JSC::protoFuncWeakRefDeref): * runtime/WeakObjectRefPrototype.h: Added. Source/WebCore: We need to make sure the Web MicrotaskQueue notifies the JSC VM that it has finished performing a microtask checkpoint. This lets the JSC VM know it is safe to collect referenced WeakRefs. Since there was no way to get the VM from the MicrotaskQueue I have added a RefPtr to the queue's VM. For the main thread the VM lives forever so is fine. For workers the queue and the VM share an owner so this shouldn't matter either. Tests: js/weakref-async-is-collected.html js/weakref-eventually-collects-values.html js/weakref-microtasks-dont-collect.html js/weakref-weakset-consistency.html * dom/Microtasks.cpp: (WebCore::MicrotaskQueue::MicrotaskQueue): (WebCore::MicrotaskQueue::mainThreadQueue): (WebCore::MicrotaskQueue::performMicrotaskCheckpoint): * dom/Microtasks.h: (WebCore::MicrotaskQueue::vm const): * workers/WorkerGlobalScope.cpp: (WebCore::WorkerGlobalScope::WorkerGlobalScope): LayoutTests: Add an asyncTestStart that mirrors the asyncTestStart behavior in the JSC cli. * http/tests/resources/js-test-pre.js: (asyncTestStart): * js/script-tests/weakref-async-is-collected.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-eventually-collects-values.js: Added. (makeWeakRef): (turnEventLoop): (let.weakRefs.async.test): * js/script-tests/weakref-microtasks-dont-collect.js: Added. (asyncTestStart.1.makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/script-tests/weakref-weakset-consistency.js: Added. (makeWeakRef): (turnEventLoop): (async.foo): (async.test): * js/weakref-async-is-collected-expected.txt: Added. * js/weakref-async-is-collected.html: Added. * js/weakref-eventually-collects-values-expected.txt: Added. * js/weakref-eventually-collects-values.html: Added. * js/weakref-microtasks-dont-collect-expected.txt: Added. * js/weakref-microtasks-dont-collect.html: Added. * js/weakref-weakset-consistency-expected.txt: Added. * js/weakref-weakset-consistency.html: Added. * resources/js-test-pre.js: (asyncTestStart): Canonical link: https://commits.webkit.org/212957@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@246565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2019-06-18 21:02:19 +00:00
<html>
<head>
<script src="../resources/js-test-pre.js"></script>
</head>
<body>
<script src="script-tests/weakref-eventually-collects-values.js"></script>
<script src="../resources/js-test-post.js"></script>
</body>
</html>