Skip to content

Commit 88cfaef

Browse files
committed
perf: say why the slot fields are written out
1 parent c8de816 commit 88cfaef

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎src/runtime/objects.ts‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,8 @@ export const set = (target: Obj, key: PropertyKey, value: Value): boolean | Call
11491149
rejectAddition(target, name)
11501150
changed(target)
11511151
guard(target, name)
1152+
// Written out, never spread: a spread is JSC's slow copyDataProperties (about a third of a run's setup) and would copy any other
1153+
// field the object holds. A new attribute is added here explicitly.
11521154
target.props.set(name, { value, writable: true, enumerable: true, configurable: true })
11531155
return true
11541156
}
@@ -1165,6 +1167,7 @@ export const define = (target: Obj, key: PropertyKey, value: Value, attrs: Attri
11651167
if (isIndexed(target) && writeElement(target, name, value) !== undefined) return
11661168
changed(target)
11671169
guard(target, name)
1170+
// Written out, never spread, as in `set`.
11681171
target.props.set(name, { value, writable: attrs.writable, enumerable: attrs.enumerable, configurable: attrs.configurable })
11691172
}
11701173

0 commit comments

Comments
 (0)