Closed Bug 1232966 Opened 9 years ago Closed 8 years ago

Implement %SharedArrayBuffer%.prototype.slice

Categories

(Core :: JavaScript Engine, defect, P2)

defect

Tracking

()

RESOLVED FIXED
mozilla52
Tracking Status
firefox52 --- fixed

People

(Reporter: lth, Assigned: lth)

References

(Blocks 1 open bug)

Details

(Keywords: dev-doc-complete)

Attachments

(3 files, 1 obsolete file)

The slice method is required for standards conformance.
Attached patch SharedArrayBuffer.prototype.slice (obsolete) (deleted) — Splinter Review
Attachment #8698958 - Flags: review?(arai.unmht)
Assignee: nobody → lhansen
Status: NEW → ASSIGNED
Comment on attachment 8698958 [details] [diff] [review] SharedArrayBuffer.prototype.slice I'm going to do things in the opposite order (subclassing first, then slice). Cancelling review for now. Sorry for the trouble.
Attachment #8698958 - Flags: review?(arai.unmht)
Depends on: 1226762
The dev doc update once this lands is at least the following: A new page about the slice method, see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer#SharedArrayBuffer_prototype_object
Keywords: dev-doc-needed
Priority: -- → P2
Attached patch bug1232966-sab-slice.patch (deleted) — Splinter Review
Implements %SharedArrayBuffer%.prototype.slice, and also the species accessor which is needed for proper subclassing behavior.
Attachment #8698958 - Attachment is obsolete: true
Attachment #8805902 - Flags: review?(arai.unmht)
Test cases for %SharedArrayBuffer%.prototype.slice, and also one for byteLength.
Attachment #8805903 - Flags: review?(arai.unmht)
Comment on attachment 8805902 [details] [diff] [review] bug1232966-sab-slice.patch Review of attachment 8805902 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/vm/CommonPropertyNames.h @@ +273,5 @@ > macro(SetIterator, SetIterator, "Set Iterator") \ > macro(setPrefix, setPrefix, "set ") \ > macro(setPrototypeOf, setPrototypeOf, "setPrototypeOf") \ > macro(shape, shape, "shape") \ > + macro(SharedArrayBufferSpecies, SharedArrayBufferSpecies, "SharedArrayBufferSpecies") \ This isn't used anywhere in this patch. would be better removing for now.
Attachment #8805902 - Flags: review?(arai.unmht) → review+
Comment on attachment 8805903 [details] [diff] [review] bug1232966-sab-slice-tests.patch Review of attachment 8805903 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jit-test/tests/sharedbuf/methods.js @@ +4,5 @@ > + quit(0); > + > +load(libdir + "asserts.js"); > + > +// Test the byteLength method It should be better separating files per each method. byteLength.js and slice.js, or something like that with prefix. so that you don't need the block statement, and it would become clear what goes wrong if some of them hit regression. @@ +7,5 @@ > + > +// Test the byteLength method > + > +{ > + let v = new SharedArrayBuffer(137); can this variable be named `buffer` or something? same for other 1-2 length variables (except `i`), they need more descriptive name.
Attachment #8805903 - Flags: review?(arai.unmht) → review+
You will have to update the test for slice in test_xrayToJS.xul, that I just landed in bug 1130988.
Flags: needinfo?(lhansen)
In a debug build, fails with --ion-eager --ion-offthread-compile=off: Assertion failure: fromBuffer->byteLength() >= fromIndex + count, at /Users/lhansen/moz/mozilla-inbound/js/src/vm/SharedArrayObject.cpp:337 (Will also add a patch for Tom's case.)
Flags: needinfo?(lhansen)
A failure on my part to set up inlinable intrinsics correctly. There's really no particular reason for these to be inlinable; they are not going to be hot. So it's an easy fix.
With this patch (suitably corrected) there's a fascinating new failure in an existing test: in ecma_6/TypedArray/Tconstructor-fromTypedArray-byteLength.js. The direct cause of the failure is that an object that is an ArrayBuffer (it prints as "[ArrayBuffer]" and believes itself to be that) has a prototype that is SharedArrayBuffer.prototype. Hence when we call the byteLength getter on that object there's a failure, since the byteLength getter is nongeneric and SharedArrayBuffer's byteLength fails the type check when presented with an arrayBuffer. How we end up with the wrong prototype is unknown. What is known is that the patch on the present bug fixes subclassing of SharedArrayBuffer, which was not previously working. There could be a bug in that fix, or the fix could be uncovering a previous bug, either in the VM or in the test case. The test case relies on some particularly gnarly reflection to construct a set of constructors for TypedArrays that carry SharedArrayBuffers... See ecma_{6,7}/TypedArray/shell.js.
The fascinating failure is being addressed in bug 1314564.
Depends on: 1314564
Attached patch bug1232966-sab-slice-xray.patch (deleted) — Splinter Review
Adaptation of Xrays test case.
Attachment #8807147 - Flags: review?(evilpies)
Comment on attachment 8807147 [details] [diff] [review] bug1232966-sab-slice-xray.patch Review of attachment 8807147 [details] [diff] [review]: ----------------------------------------------------------------- I am glad to see this being fixed now!
Attachment #8807147 - Flags: review?(evilpies) → review+
Comment on attachment 8807147 [details] [diff] [review] bug1232966-sab-slice-xray.patch Boris, evilpie approved this but it probably needs your stamp - one more property going onto SharedArrayBuffer.
Flags: needinfo?(bzbarsky)
Comment on attachment 8807147 [details] [diff] [review] bug1232966-sab-slice-xray.patch r=me
Flags: needinfo?(bzbarsky)
Attachment #8807147 - Flags: review+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: