Skip to content

Commit 9e323cd

Browse files
authored
Improve ecma_typedarray_info_t (#3205)
- The structure members have been renamed and the members got more detailed description. - Updated the usage of the typedarray info structure in all occurrences to use absolute addressing from the underlying arraybuffer pointer. This patch also fixes #3204. JerryScript-DCO-1.0-Signed-off-by: Robert Fancsik [email protected]
1 parent ede1957 commit 9e323cd

File tree

5 files changed

+149
-143
lines changed

5 files changed

+149
-143
lines changed

jerry-core/ecma/base/ecma-globals.h

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1689,13 +1689,16 @@ typedef struct
16891689
**/
16901690
typedef struct
16911691
{
1692-
ecma_object_t *typedarray_buffer_p; /**< pointer to the typedArray's arraybuffer */
1693-
lit_utf8_byte_t *buffer_p; /**< pointer to the arraybuffer's internal data buffer */
1694-
ecma_typedarray_type_t typedarray_id; /**< type of the typedArray */
1695-
uint32_t typedarray_length; /**< length of the typedArray */
1696-
ecma_length_t offset; /**< offset of the internal array buffer */
1692+
ecma_object_t *array_buffer_p; /**< pointer to the typedArray's [[ViewedArrayBuffer]] internal slot */
1693+
lit_utf8_byte_t *buffer_p; /**< pointer to the underlying raw data buffer.
1694+
* Note:
1695+
* - This address is increased by the [ByteOffset]] internal property.
1696+
* - This address must be used during indexed read/write operation. */
1697+
ecma_typedarray_type_t id; /**< [[TypedArrayName]] internal slot */
1698+
uint32_t length; /**< [[ByteLength]] internal slot */
1699+
ecma_length_t offset; /**< [[ByteOffset]] internal slot. */
16971700
uint8_t shift; /**< the element size shift in the typedArray */
1698-
uint8_t element_size; /**< size of each element in the typedArray */
1701+
uint8_t element_size; /**< element size based on [[TypedArrayName]] in Table 49 */
16991702
} ecma_typedarray_info_t;
17001703

17011704
#endif /* ENABLED (JERRY_ES2015_BUILTIN_TYPEDARRAY) */

0 commit comments

Comments
 (0)