Add isInteger to jsi::Value (#56161)#56161
Closed
tsaichien wants to merge 8 commits intofacebook:mainfrom
Closed
Conversation
|
@tsaichien has exported this pull request. If you are a Meta employee, you can view the originating Diff in D96175707. |
isInteger to jsi::ValueisInteger to jsi::Value (#56161)
tsaichien
added a commit
to tsaichien/react-native
that referenced
this pull request
Apr 14, 2026
Summary: Pull Request resolved: facebook#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707
2624eb5 to
41e9a60
Compare
tsaichien
added a commit
to tsaichien/react-native
that referenced
this pull request
Apr 14, 2026
Summary: Pull Request resolved: facebook#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707
41e9a60 to
2933484
Compare
Summary: After reviewing the feasibility of adding new Runtime functionality, we realized the current state of `Runtime` makes it hard/inconvenient to add new basic functionality. It requires creating a new interface (e.g. `IRuntime2`) to declare the new APIs. Then, everywhere it is needed, both the original `Runtime` and `IRuntime2` needs to passed in to access both APIs. After discussion, we decided to introduce `IRuntime`, which will declare most of the `Runtime` functionalities. All "protected" APIs, which made sense before interfaces were introduced, will now be public. The protected static methods of `Runtime` will remain as is for the Friends to access. After we decided to cut "stable" (after incoming JSI improvements), new functionalities will be added in `IRuntime2` interface. `IRuntime2` will inherit `IRuntime` to make existing functionality easy to access. Differential Revision: D89093651
Summary: Currently, the size of a jsi `Array` is immutable. Once the `Array` is created, users can only set the element at an existing index, but not append to it. This change adds an `Array::push` API to improve ergonomics. Differential Revision: D82254334
Summary: Adds `ArrayBuffer::getMutableBuffer` to JSI. This allows the user to retrieve a `MutableBuffer` from the `ArrayBuffer`. The data referenced by the `MutableBuffer` will be alive during the entirety of the `MutableBuffer` lifespan. Addresses: facebook/hermes#1578 Differential Revision: D91264901
Differential Revision: D92993088
Summary: Add TypedArray and Uint8Array types to JSI with supporting APIs. New types: - `TypedArray`: Base class for all typed arrays - `Uint8Array`: Uint8Array type extending TypedArray New IRuntime APIs: - `buffer(TypedArray)`: Get underlying ArrayBuffer - `byteOffset(TypedArray)`: Get byte offset property - `byteLength(TypedArray)`: Get byte length property - `length(TypedArray)`: Get length property - `createUint8Array(size_t)`: Create Uint8Array with length - `createUint8Array(ArrayBuffer, offset, length)`: Create from ArrayBuffer - `isUint8Array(Object)`: Check if object is Uint8Array Differential Revision: D95245175
Summary: Add Error creation APIs to JSI to allow native code to create JavaScript Error objects of all standard types. Users can also call the static methods in `JSError` that creates a `JSError` instance that holds the intended error type. Differential Revision: D95854323
Summary: Add a JSI API to get the length of a JavaScript string in UTF-16 code units. This is equivalent to the "length" property of a JS string. New API: - `IRuntime::length(const String&)`: Returns the number of UTF-16 code units in the string. Default implementation: The default implementation in `jsi::Runtime` calls `utf16()` then returns the size. Note that the default `utf16()` implementation first converts the JS string to UTF-8, then converts that to UTF-16. This intermediate UTF-8 step does not handle lone surrogates correctly, causing code units to be "lost" in the conversion. Runtimes should provide optimized implementations when possible. The following optimized implementations are provided: JSC implementation: Uses the `JSStringGetLength` API for efficient retrieval. V8 implementation: Uses the `v8::String::Length()` API for efficient retrieval. Differential Revision: D96030262
Summary: Pull Request resolved: facebook#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707
2933484 to
b15c514
Compare
meta-codesync bot
pushed a commit
to facebook/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
meta-codesync bot
pushed a commit
to facebook/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
meta-codesync bot
pushed a commit
to facebook/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
|
This pull request has been merged in 07c00f4. |
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 15, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 16, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to tsaichien/hermes
that referenced
this pull request
Apr 16, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
tsaichien
added a commit
to facebook/hermes
that referenced
this pull request
Apr 16, 2026
Summary: X-link: facebook/react-native#56161 Add a `isInteger` method under `jsi::Value` that returns true iff `Number.isInteger` returns true. This can be implemented without relying on the Runtime. Changelog: [Internal] Reviewed By: lavenzg Differential Revision: D96175707 fbshipit-source-id: af482ae512ffc53f18c1686dd8a2a95521d0bc59
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Add a
isIntegermethod underjsi::Valuethat returns true iffNumber.isIntegerreturns true.This can be implemented without relying on the Runtime.
Changelog: [Internal]
Reviewed By: lavenzg
Differential Revision: D96175707