Route Reflect.set receiver [[DefineOwnProperty]] through TryDefineProperty#247
Conversation
…perty Fixes #246. AssignPropertyWithReceiver and AssignSymbolPropertyWithReceiver previously mutated receiver descriptors in-place and called DefineProperty directly, bypassing the proxy defineProperty trap and throwing instead of returning false on conflicts. Add virtual TryDefineProperty / TryDefineSymbolProperty boolean API that returns false on non-configurable conflicts or non-extensible objects, override both in TGocciaProxyValue to dispatch through the defineProperty trap, and route all receiver-side [[DefineOwnProperty]] calls through the new API. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughThis PR implements a non-throwing property definition API ( Changes
Sequence DiagramsequenceDiagram
actor Test
participant ReflectSet as Reflect.set
participant Assignment as AssignPropertyWithReceiver
participant Receiver as Receiver (Proxy)
participant Trap as defineProperty Trap
Test->>ReflectSet: set(target, prop, value, receiver)
ReflectSet->>Assignment: AssignPropertyWithReceiver(...)
Assignment->>Receiver: TryDefineProperty(prop, descriptor)
Receiver->>Trap: InvokeTrap (descriptor as object)
Trap-->>Receiver: returns boolean or truthy/falsy
Receiver-->>Assignment: Boolean result
Assignment-->>ReflectSet: Propagate boolean result
ReflectSet-->>Test: return true/false
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related issues
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Comment |
Benchmark Results274 benchmarks Interpreted: 🟢 235 improved · 🔴 4 regressed · 35 unchanged · avg +8.1% arraybuffer.js — Interp: 🟢 13, 🔴 1 · avg +8.7% · Bytecode: 🟢 5, 🔴 4, 5 unch. · avg +0.5%
arrays.js — Interp: 🟢 19 · avg +9.4% · Bytecode: 🟢 13, 🔴 1, 5 unch. · avg +2.2%
async-await.js — Interp: 🟢 6 · avg +10.8% · Bytecode: 🔴 2, 4 unch. · avg -0.6%
classes.js — Interp: 🟢 30, 1 unch. · avg +8.4% · Bytecode: 🟢 6, 🔴 4, 21 unch. · avg +1.3%
closures.js — Interp: 🟢 11 · avg +11.5% · Bytecode: 🟢 3, 8 unch. · avg +2.0%
collections.js — Interp: 🟢 10, 2 unch. · avg +12.8% · Bytecode: 🟢 2, 🔴 6, 4 unch. · avg -1.4%
destructuring.js — Interp: 🟢 17, 5 unch. · avg +5.1% · Bytecode: 🟢 12, 10 unch. · avg +3.3%
fibonacci.js — Interp: 🟢 5, 3 unch. · avg +6.9% · Bytecode: 🟢 7, 1 unch. · avg +3.5%
for-of.js — Interp: 7 unch. · avg +0.9% · Bytecode: 🟢 5, 2 unch. · avg +2.8%
helpers/bench-module.js — Interp: 0 · Bytecode: 0
iterators.js — Interp: 🟢 18, 2 unch. · avg +6.9% · Bytecode: 🟢 16, 4 unch. · avg +3.2%
json.js — Interp: 🟢 20 · avg +8.7% · Bytecode: 🟢 17, 3 unch. · avg +3.4%
jsx.jsx — Interp: 🟢 19, 2 unch. · avg +9.3% · Bytecode: 🟢 5, 16 unch. · avg +0.7%
modules.js — Interp: 🟢 9 · avg +9.2% · Bytecode: 🟢 1, 🔴 7, 1 unch. · avg -3.0%
numbers.js — Interp: 🟢 11 · avg +8.1% · Bytecode: 🟢 6, 🔴 2, 3 unch. · avg -1.5%
objects.js — Interp: 🟢 5, 🔴 1, 1 unch. · avg +5.1% · Bytecode: 🟢 2, 🔴 1, 4 unch. · avg +0.4%
promises.js — Interp: 🟢 11, 1 unch. · avg +9.5% · Bytecode: 🟢 4, 8 unch. · avg +1.1%
regexp.js — Interp: 🟢 9, 2 unch. · avg +5.3% · Bytecode: 🟢 1, 🔴 3, 7 unch. · avg -0.9%
strings.js — Interp: 🟢 11 · avg +12.9% · Bytecode: 🟢 2, 9 unch. · avg +0.3%
typed-arrays.js — Interp: 🟢 11, 🔴 2, 9 unch. · avg +5.4% · Bytecode: 🟢 10, 🔴 4, 8 unch. · avg +0.3%
Measured on ubuntu-latest x64. Benchmark ranges compare cached main-branch min/max ops/sec with the PR run; overlapping ranges are treated as unchanged noise. Percentage deltas are secondary context. |
Suite Timing
Measured on ubuntu-latest x64. |
Summary
TryDefineProperty/TryDefineSymbolPropertyboolean API toTGocciaObjectValuethat returnsfalseinstead of throwing on non-configurable conflicts or non-extensible objects (ES2026 §10.1.6.1)TGocciaProxyValueto dispatch through the proxy'sdefinePropertytrap, returning the trap's boolean resultDefinePropertycalls inAssignPropertyWithReceiver/AssignSymbolPropertyWithReceiverwithTryDefineProperty/TryDefineSymbolProperty, fixing both string-keyed and symbol-keyed pathsFixes #246.
Test plan
tests/built-ins/Reflect/set.jscovering proxy receiverdefinePropertytrap dispatch (create, update, false return), symbol keys, and non-configurable writable value update🤖 Generated with Claude Code