Skip to content

Conversation

akroshg
Copy link
Contributor

@akroshg akroshg commented Sep 2, 2016

This work is to implement a prototype version of the SharedArrayBuffer. The spec is in the stage2.
The SharedArrayBuffer is behind the ESSharedArrayBuffer (or -sab)
flag.
Highlights.
Introduce the SharedArrayBuffer type and its implementation.
Refactor the ArrayBuffer to a common class (ArrayBufferBase) so that both SharedArrayBuffer and ArrayBuffer leverage the common functionality and machinery.
Atomics object (spec'ed) is introduced to provide the atomic operation on the buffer
which is shared. Currently it is using the Win32 based APIs to provide the
functionality.
All 12 methods of Atomics are implemented.
All TypedArray views are changed to make use of SharedArrayBuffer as well.
The Serialization/Deserialization implementation is in the different
repo.
Added test cases to validate most of the functionality. sharedarraybuffer - initial work

@akroshg
Copy link
Contributor Author

akroshg commented Sep 2, 2016

@akroshg
Copy link
Contributor Author

akroshg commented Sep 2, 2016

I'll take a look at the Ubuntu failures. I haven't made any effort to have this x-plat in this V1 implementation but it should just clean build everywhere.

@@ -783,6 +784,14 @@ PHASE(All)
#define FLAGPR(Type, ParentName, Name, String, Default) FLAG(Type, Name, String, Default, ParentName, FALSE)
#define FLAGR(Type, Name, String, Default) FLAG(Type, Name, String, Default, NoParent, FALSE)

// Release flags with paraent and acronym
Copy link
Collaborator

@agarwal-sandeep agarwal-sandeep Sep 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

paraent [](start = 22, length = 7)

parent #Resolved

@agarwal-sandeep
Copy link
Collaborator

:shipit:

@akroshg
Copy link
Contributor Author

akroshg commented Sep 7, 2016

Thanks @agarwal-sandeep for having a look.
@abchatra @Microsoft/chakra-es - would you also like to review?

@suwc
Copy link

suwc commented Sep 7, 2016

How does perf compare? #Resolved

return JavascriptConversion::ToUInt32(length, scriptContext);
}

Var SharedArrayBuffer::NewInstance(RecyclableObject* function, CallInfo callInfo, ...)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NewInstance [](start = 27, length = 11)

This and several others are almost identical to their ArrayBuffer counterparts. Is it better to re-factor them into ArrayBufferBase?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are few subtle differences in these functions. I feel like it is best to keep them separate as the spec could evolve and it would be easier to make those changes. Majority of this functions are input validation. I could make them a common macro.


In reply to: 77910245 [](ancestors = 77910245)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would template usage help?

@akroshg
Copy link
Contributor Author

akroshg commented Sep 8, 2016

I don't expect anything to change perf-wise (why do you there will be perf related issue), but I'll run just in case.


In reply to: 245406564 [](ancestors = 245406564)

@akroshg
Copy link
Contributor Author

akroshg commented Sep 8, 2016

I ran it and it is flat.


In reply to: 245458779 [](ancestors = 245458779,245406564)

@@ -357,3 +357,10 @@ RT_ERROR_MSG(JSERR_InvalidHint, 5658, "%s: invalid hint", "invalid hint", kjstTy

RT_ERROR_MSG(JSERR_This_NeedNamespace, 5659, "%s: 'this' is not a Module Namespace object", "Module Namespace object expected", kjstTypeError, JSERR_This_NeedNamespace) // {Locked="\'this\'"}
RT_ERROR_MSG(JSERR_This_NeedListIterator, 5660, "%s: 'this' is not a List Iterator object", "List Iterator expected", kjstTypeError, 0)
RT_ERROR_MSG(JSERR_NeedSharedArrayBufferObject, 5661, "%s is not a SharedArrayBuffer", "SharedArrayBuffer object expected", kjstTypeError, 0)

RT_ERROR_MSG(JSERR_Function_LessArguments, 5662, "Function '%s' is called with less arguments", "Function called with less arguments", kjstRangeError, 0)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the intention here 'not enough arguments'? I would reword it. Perhaps we can use the existing RT_ERROR_MSG(JSERR_WinRTFunction_TooFewArguments, 5102, "%s: function called with too few arguments", "Function called with too few arguments", kjstError, 0)

@akroshg
Copy link
Contributor Author

akroshg commented Sep 12, 2016

@digitalinfinity can you look at the pal changes? thanks,

@digitalinfinity
Copy link
Contributor

PAL changes LGTM

This work is to implement a prototype version of the `SharedArrayBuffer`. The spec is in the stage2.
The `SharedArrayBuffer` is behind the `ESSharedArrayBuffer` (or -sab)
flag.
Highlights.
Introduce the `SharedArrayBuffer` type and its implementation.
Refactor the `ArrayBuffer` to a common class (`ArrayBufferBase`) so that both `SharedArrayBuffer` and `ArrayBuffer` leverage the common functionality and machinery.
`Atomics` object (spec'ed) is introduced to provide the atomic operation on the buffer
which is shared. Currently it is using the Win32 based APIs to provide the
functionality.
All 12 methods of `Atomics` are implemented.
All `TypedArray` views are changed to make use of `SharedArrayBuffer` as well.
The `Serialization/Deserialization` implementation is in the different
repo.
Added test cases to validate most of the functionality. sharedarraybuffer - initial work
@chakrabot chakrabot merged commit ba48081 into chakra-core:master Sep 13, 2016
chakrabot pushed a commit that referenced this pull request Sep 13, 2016
Merge pull request #1533 from akroshg:sab

This work is to implement a prototype version of the `SharedArrayBuffer`. The spec is in the stage2.
The `SharedArrayBuffer` is behind the `ESSharedArrayBuffer` (or -sab)
flag.
Highlights.
Introduce the `SharedArrayBuffer` type and its implementation.
Refactor the `ArrayBuffer` to a common class (`ArrayBufferBase`) so that both `SharedArrayBuffer` and `ArrayBuffer` leverage the common functionality and machinery.
`Atomics` object (spec'ed) is introduced to provide the atomic operation on the buffer
which is shared. Currently it is using the Win32 based APIs to provide the
functionality.
All 12 methods of `Atomics` are implemented.
All `TypedArray` views are changed to make use of `SharedArrayBuffer` as well.
The `Serialization/Deserialization` implementation is in the different
repo.
Added test cases to validate most of the functionality. sharedarraybuffer - initial work
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants