Closed Bug 881536 Opened 11 years ago Closed 11 years ago

PJS: Support GetElementIC in parallel

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: shu, Assigned: shu)

References

Details

Attachments

(4 files, 3 obsolete files)

Should be fairly straightforward.
Assignee: general → shu
Attachment #760631 - Flags: review?(nicolas.b.pierron)
Attachment #760644 - Flags: review?(nicolas.b.pierron)
Attachment #760652 - Flags: review?(bhackett1024)
Attachment #760631 - Attachment is obsolete: true
Attachment #760631 - Flags: review?(nicolas.b.pierron)
Attachment #760671 - Flags: review?(nicolas.b.pierron)
Attachment #760652 - Attachment is obsolete: true
Attachment #760652 - Flags: review?(bhackett1024)
Attachment #760672 - Flags: review?(bhackett1024)
Attachment #760688 - Flags: review?(nicolas.b.pierron)
Comment on attachment 760672 [details] [diff] [review]
Part 3: Pure VM path for GetElement

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

::: js/src/jsobj.cpp
@@ +4131,5 @@
> +    /* Fast-path typed array index accesses. */
> +    if (obj->isTypedArray() && index < TypedArray::length(obj)) {
> +        TypedArray::copyTypedArrayElement(obj, index, MutableHandleValue::fromMarkedLocation(vp));
> +        return true;
> +    }

This looks like more than just a fast path, it seems GetPropertyPure will fail if passed a typed array due to typed arrays being non-native classes.  Could this special casing be done in GetPropertyPure / LookupPropertyPure themselves?  It seems like looking for typed arrays there would be more robust and allow accesses like typedArray.length to work in PJS.

@@ +4148,5 @@
> +    uint32_t index;
> +    if (IsDefinitelyIndex(prop, &index))
> +        return GetElementPure(obj, index, vp);
> +
> +    /* Atomizing the property value is effectful and not threadsafe. */

(well, not yet anyways)
Attachment #760672 - Flags: review?(bhackett1024)
Comment on attachment 760671 [details] [diff] [review]
Part 1: Factor out stubbedShape to ParallelIonCache

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

This is a good patch which extract the ShapeSet and the logic for attaching stubs to a ParallelIonCache.  For parallel caches which will not rely on shapes this will just create an extra NULL pointer, but this sounds fine for now.

::: js/src/ion/IonCaches.h
@@ +881,5 @@
> +    bool initStubbedShapes(JSContext *cx);
> +
> +  public:
> +    virtual void reset();
> +    virtual void destroy();

nit: Usually we do not repeat the virtual keyword.
Attachment #760671 - Flags: review?(nicolas.b.pierron) → review+
Attachment #760644 - Flags: review?(nicolas.b.pierron) → review+
Comment on attachment 760688 [details] [diff] [review]
Part 4: Implement ParallelGetElementIC

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

Good job, thanks for refactoring the can* functions and use them in assertions of the code-gen part of ICs.

::: js/src/ion/IonCaches.cpp
@@ +2854,5 @@
> +
> +    // Avoid unnecessary locking if cannot attach stubs and idempotent.
> +    if (cache.idempotent() && !cache.canAttachStub())
> +        return TP_SUCCESS;
> +    {

nit: This is weird. Either add a space before the curly brace or remove them.
Attachment #760688 - Flags: review?(nicolas.b.pierron) → review+
Comment on attachment 760688 [details] [diff] [review]
Part 4: Implement ParallelGetElementIC

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

I think you might need to add ParallelElementIC::initializeAddCacheState in CodeGenerator-x86.cpp
(In reply to Nicolas B. Pierron [:nbp] from comment #10)
> Comment on attachment 760688 [details] [diff] [review]
> Part 4: Implement ParallelGetElementIC
> 
> Review of attachment 760688 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> I think you might need to add ParallelElementIC::initializeAddCacheState in
> CodeGenerator-x86.cpp

Ah, good catch!
(In reply to Nicolas B. Pierron [:nbp] from comment #8)
> nit: Usually we do not repeat the virtual keyword.

MOZ_OVERRIDE is a better idea, and it makes sure signature changes happen properly if the base class signature changes.
Hopefully addressed comments.
Attachment #760672 - Attachment is obsolete: true
Attachment #765093 - Flags: review?(bhackett1024)
Part 3 here depends on part 1 of bug 881574.
Depends on: 881574
Attachment #765093 - Flags: review?(bhackett1024) → review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: