Skip to content

Perf(object): publish initialized data descriptors atomically #663

Description

@chrisbbreuer

Parents: #479, #532
Related: #662, #493

Problem

Fresh function and built-in initialization repeatedly publishes a data property with assignment-default attributes, releases property_lock, reacquires it, and then installs the final descriptor. The post-#662 cold Context profile retains Object.setOwnUnlocked, Object.setAttrUnlocked, installNativeProps, and setNativeWithData leaves along this exact path. Besides duplicate uncontended synchronization, a published object can transiently expose the wrong descriptor if initialization ever crosses a sharing boundary.

Scope

  • Add one Object primitive that publishes a data value and its final attributes under one property_lock critical section.
  • Prepare attribute metadata before release-publishing the Shape and restore the exact prior metadata on OOM.
  • Preserve insertion order, existing low-level accessor/data coexistence, GC barriers, Shape convergence, backing ownership, and existing-data replacement semantics.
  • Migrate function name/length, native method/static installation, constructor prototype, and other provably equivalent fresh data-descriptor initialization sites.
  • Retain ordinary assignment and Object.defineProperty semantics unchanged.
  • Measure the frozen Bench: publish cold context lifecycle phase and retention evidence #661 cold no-evaluation Context boundary against the exact first parent, with a warm representative Shape-transition control.

No-workaround rules

  • No lock disabling, freshness guesses at shared call sites, default-attribute publication followed by repair, ignored OOM state, predictable hashing, benchmark-only fast path, pooling, or hidden warmup.
  • No stacks, queues, jobs, Promise, microtask, Worker-lifecycle, or Map/Set iterator changes.

Acceptance

  • Unit tests prove final descriptor identity, existing-data replacement, accessor/data coexistence, insertion order, one-lock publication, and exact OOM rollback.
  • A no-GIL publication witness observes only absent or the complete final descriptor, never assignment-default attributes.
  • Function and built-in descriptor Test262 surfaces have exact nonzero before -> after accounting with zero flips.
  • Focused tests, full units, applicable TSan/threadfuzz, and docs/benchmark CI pass.
  • Exact-parent cold lifecycle evidence identifies the affected phase/RSS/finalizers; the warm Shape control does not regress materially.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions