Closed Bug 1157703 Opened 5 years ago Closed 4 years ago

Cache iterators involving unboxed objects

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla40
Tracking Status
firefox40 --- fixed

People

(Reporter: bhackett, Assigned: bhackett)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
Currently, 'for in' iteration on unboxed objects is extremely slow.  This is causing sunspider-string-tagcloud to be considerably slower with unboxed objects than without it.

The attached patch moves ReceiverGuard into common VM code, cleans it up a bit, and uses an array of receiver guards in NativeIterator instead of an array of shapes.  (NativeIterator should really be renamed; even before this patch it can be used for iteration over non-native objects.)  I also added some tracing code for the array in NativeIterator, as I think without this we could get spurious cache hits if a shape/group used in an iterator is collected.
Attachment #8596573 - Flags: review?(jdemooij)
Comment on attachment 8596573 [details] [diff] [review]
patch

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

::: js/src/jsiter.cpp
@@ +62,5 @@
>      if (obj)
>          TraceEdge(trc, &obj, "obj");
>  
> +    for (size_t i = 0; i < guard_length; i++)
> +        guard_array[i].trace(trc);

Ugh good catch.

@@ +686,5 @@
>      ni->obj = obj;
>  }
>  
> +static inline bool
> +CanCompareIteratableObjectToCache(JSObject* obj)

s/Iteratable/Iterable, like the function below?
Attachment #8596573 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/mozilla-central/rev/9f48bf757033
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla40
You need to log in before you can comment on or make changes to this bug.