[webkit-changes] [WebKit/WebKit] e06c5e: Map getOrInsert should account for value functors ...

Commit Queue noreply at github.com
Wed Feb 19 16:44:10 PST 2025


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e06c5efe89af319dc7fd7c369ff13f3af000c359
      https://github.com/WebKit/WebKit/commit/e06c5efe89af319dc7fd7c369ff13f3af000c359
  Author: Daniel Liu <daniel_liu4 at apple.com>
  Date:   2025-02-19 (Wed, 19 Feb 2025)

  Changed paths:
    A JSTests/stress/test-getOrInsert-selfmodify.js
    M Source/JavaScriptCore/runtime/OrderedHashTable.h
    M Source/JavaScriptCore/runtime/WeakMapPrototype.cpp

  Log Message:
  -----------
  Map getOrInsert should account for value functors modifying the map
https://bugs.webkit.org/show_bug.cgi?id=287970
rdar://144969831

Reviewed by Yijia Huang.

getOrInsert on a map currently does not recompute the target bucket. However,
if the value functor called modifies the map, this could change the correct
target bucket. This patch updates these methods to recompute the hash in all
cases. We may be able to optimize this further in the future.

* JSTests/stress/test-getOrInsert-selfmodify.js: Added.
* Source/JavaScriptCore/runtime/OrderedHashTable.h:
(JSC::OrderedHashMap::getOrInsert):
* Source/JavaScriptCore/runtime/WeakMapPrototype.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):

Canonical link: https://commits.webkit.org/290666@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list