Closed Bug 919349 Opened 11 years ago Closed 11 years ago

JS debugger: remove uses of 'delete' that put objects in dictionary mode gratuitously

Categories

(DevTools :: Debugger, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
Firefox 27

People

(Reporter: jimb, Assigned: jimb)

Details

Attachments

(1 file)

The built-in JavaScript debugger code uses 'delete' in several places in a way that wastes memory; those uses could be replaced with assignments that set the given properties to 'null' or 'undefined'.

Deleting properties from objects puts them in 'dictionary mode'. Objects in dictionary mode do not share shape metadata with other similar objects. For objects being used as hash tables, this is fine; such sharing would not be helpful anyway. But for an object of which the program will use only a small, fixed vocabulary of properties, sharing that metadata can save memory, and enable optimizations like inline caches. If the intention is simply to help the GC free the property's referent, it's better to simply set the property to 'null' or 'undefined'.
Assignee: nobody → jimb
Status: NEW → ASSIGNED
Attachment #808350 - Flags: review?(dcamp)
Attachment #808350 - Flags: review?(dcamp) → review+
Priority: -- → P3
https://hg.mozilla.org/mozilla-central/rev/93f1537b3a9d
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 27
Product: Firefox → DevTools
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: