-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JSC] Implement ArrayBuffer#transfer
https://bugs.webkit.org/show_bug.cgi?id=263518 rdar://117337535 Reviewed by Mark Lam and Ross Kirsling. This patch implements ArrayBuffer#transfer proposal[1], which is stage-3 and implemented in the other engines too. It implements two functions and one getter. 1. ArrayBuffer#transfer. It transfers internal ArrayBuffer to a new ArrayBuffer and detach the original buffer. This only works with normal ArrayBuffer and it throws an error against SharedArrayBuffer. This preserves resizability of the original ArrayBuffer, it means that if we transfer resizable ArrayBuffer, we get resizable transferred ArrayBuffer. 2. ArrayBuffer#transferToFixedLength is similar to ArrayBuffer#transfer. But this always creates non-resizable ArrayBuffer. It means, internally, we create a new ArrayBuffer if resizability is different and copy the underlying content. In both cases, if ArrayBuffer is not resizable and result size is the same, then it just changes underlying buffer's ownership and does not allocate and copy contents. If it is ArrayBuffer#transfer and the input ArrayBuffer is resizable, then we also just changes the ownership and resize the resulted ArrayBuffer's size. 3. ArrayBuffer#detach getter returns boolean whether ArrayBuffer is detached or not. [1]: https://tc39.es/proposal-arraybuffer-transfer/ * JSTests/test262/config.yaml: * JSTests/test262/expectations.yaml: * Source/JavaScriptCore/runtime/CommonIdentifiers.h: * Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp: (JSC::arrayBufferCopyAndDetach): (JSC::JSC_DEFINE_HOST_FUNCTION): (JSC::JSArrayBufferPrototype::finishCreation): Canonical link: https://commits.webkit.org/269674@main
- Loading branch information
1 parent
454ec9e
commit fe0aa79
Showing
5 changed files
with
127 additions
and
191 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.