Add jsapi-tests for TypedArray on SharedArrayBuffer

RESOLVED FIXED in Firefox 45

Status

()

defect
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: lth, Assigned: lth)

Tracking

(Blocks 1 bug)

unspecified
mozilla45
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(firefox45 fixed)

Details

Attachments

(1 attachment)

All TypedArray jsapi-test tests currently work with ArrayBuffer.  Clearly we need to do better once TypedArray can map SharedArrayBuffer.
The "p" failure in that run is bug 1230162, technically a problem with running tests in parallel but fundamentally we should also clean up SpiderMonkey.
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Comment on attachment 8695789 [details] [diff] [review]
generalize jsapi-tests for SAB

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

::: js/src/jsapi-tests/testTypedArrays.cpp
@@ +66,5 @@
>  
>      return ok;
>  }
>  
> +// Shared memory can only be mapped by a TypedArray by creating the TypedArray with

"with" should be moved to the next line, to make this line fit into 79 chars.

@@ +115,5 @@
>  TestArrayFromBuffer(JSContext* cx)
>  {
>      size_t elts = 8;
>      size_t nbytes = elts * sizeof(Element);
> +    RootedObject buffer(cx, Shared ? JS_NewSharedArrayBuffer(cx, nbytes) : JS_NewArrayBuffer(cx, nbytes));

please wrap this line into 99 chars ;)
(or maybe there's different style rule for test files?)

@@ +120,5 @@
>      {
>          JS::AutoCheckCannotGC nogc;
>          bool isShared;
> +        void* data = Shared ? JS_GetSharedArrayBufferData(buffer, &isShared, nogc)
> +            : JS_GetArrayBufferData(buffer, &isShared, nogc);

":" should be aligned to the same column as "S" of "Shared ?" in previous line.

@@ +121,5 @@
>          JS::AutoCheckCannotGC nogc;
>          bool isShared;
> +        void* data = Shared ? JS_GetSharedArrayBufferData(buffer, &isShared, nogc)
> +            : JS_GetArrayBufferData(buffer, &isShared, nogc);
> +        MOZ_ASSERT(Shared == isShared);

as "Shared" is now variable, using CHECK might be better for testing purpose here, and following several places.
Attachment #8695789 - Flags: review?(arai.unmht) → review+
https://hg.mozilla.org/mozilla-central/rev/a42590c2a8bf
Status: ASSIGNED → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla45
You need to log in before you can comment on or make changes to this bug.