Block-scoped variables indexing refactor

RESOLVED FIXED in mozilla30

Status

()

defect
RESOLVED FIXED
6 years ago
6 years ago

People

(Reporter: wingo, Assigned: wingo)

Tracking

unspecified
mozilla30
x86
macOS
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

This is a followup to bug 962599 comment 26, to refactor some namings in block scope objects.
Assignee: nobody → wingo
Attachment #8381463 - Flags: review?(luke)
Comment on attachment 8381463 [details] [diff] [review]
Block-scoped variables indexing refactor

Review of attachment 8381463 [details] [diff] [review]:
-----------------------------------------------------------------

Great!

::: js/src/vm/ScopeObject.h
@@ +410,1 @@
>          return propertyCount();

I was just looking at this and I was astounded to see that propertyCount() is O(n)!  Could you add a
  // TODO: propertyCount() is O(n), use O(1) lastProperty()->slot() instead
here?  (Even worse, numVariables() is used in loop conditions, making the loops O(n^2)!)
Attachment #8381463 - Flags: review?(luke) → review+
(In reply to Luke Wagner [:luke] from comment #2)

> I was just looking at this and I was astounded to see that propertyCount()
> is O(n)!

Yuck!  Good catch.  Added the comment.
https://hg.mozilla.org/mozilla-central/rev/f05165839760
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla30
You need to log in before you can comment on or make changes to this bug.