Add SharedArrayBuffer support (#4689)
JerryScript-DCO-1.0-Signed-off-by: Gergo Csizi csgergo92@gmail.com
This commit is contained in:
@@ -210,6 +210,8 @@ set(SOURCE_CORE_FILES
|
||||
ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c
|
||||
ecma/builtin-objects/ecma-builtin-set-prototype.c
|
||||
ecma/builtin-objects/ecma-builtin-set.c
|
||||
ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c
|
||||
ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c
|
||||
ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c
|
||||
ecma/builtin-objects/ecma-builtin-string-prototype.c
|
||||
ecma/builtin-objects/ecma-builtin-string.c
|
||||
@@ -281,6 +283,7 @@ set(SOURCE_CORE_FILES
|
||||
ecma/operations/ecma-proxy-object.c
|
||||
ecma/operations/ecma-reference.c
|
||||
ecma/operations/ecma-regexp-object.c
|
||||
ecma/operations/ecma-shared-arraybuffer-object.c
|
||||
ecma/operations/ecma-string-object.c
|
||||
ecma/operations/ecma-symbol-object.c
|
||||
ecma/operations/ecma-typedarray-object.c
|
||||
@@ -405,6 +408,8 @@ if(ENABLE_AMALGAM)
|
||||
ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-set-prototype.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-set.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-string-prototype.inc.h
|
||||
ecma/builtin-objects/ecma-builtin-string.inc.h
|
||||
@@ -452,6 +457,7 @@ if(ENABLE_AMALGAM)
|
||||
ecma/operations/ecma-proxy-object.h
|
||||
ecma/operations/ecma-reference.h
|
||||
ecma/operations/ecma-regexp-object.h
|
||||
ecma/operations/ecma-shared-arraybuffer-object.h
|
||||
ecma/operations/ecma-string-object.h
|
||||
ecma/operations/ecma-symbol-object.h
|
||||
ecma/operations/ecma-typedarray-object.h
|
||||
|
||||
+98
-15
@@ -41,6 +41,7 @@
|
||||
#include "ecma-regexp-object.h"
|
||||
#include "ecma-promise-object.h"
|
||||
#include "ecma-proxy-object.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-symbol-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "jcontext.h"
|
||||
@@ -1545,6 +1546,7 @@ static const uint8_t jerry_class_object_type[] =
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< type of ECMA_OBJECT_CLASS_ARRAY_BUFFER */
|
||||
JERRY_OBJECT_TYPE_SHARED_ARRAY_BUFFER, /**< type of ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
JERRY_OBJECT_TYPE_BIGINT, /**< type of ECMA_OBJECT_CLASS_BIGINT */
|
||||
@@ -5622,15 +5624,96 @@ jerry_create_arraybuffer_external (const jerry_length_t size, /**< size of the b
|
||||
} /* jerry_create_arraybuffer_external */
|
||||
|
||||
/**
|
||||
* Copy bytes into the ArrayBuffer from a buffer.
|
||||
* Check if the given value is a SharedArrayBuffer object.
|
||||
*
|
||||
* @return true - if it is a SharedArrayBuffer object
|
||||
* false - otherwise
|
||||
*/
|
||||
bool
|
||||
jerry_value_is_shared_arraybuffer (const jerry_value_t value) /**< value to check if it is a SharedArrayBuffer */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
return ecma_is_shared_arraybuffer (value);
|
||||
#else /* !JERRY_BUILTIN_TYPEDARRAY */
|
||||
JERRY_UNUSED (value);
|
||||
return false;
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
} /* jerry_value_is_shared_arraybuffer */
|
||||
|
||||
/**
|
||||
* Creates a SharedArrayBuffer object with the given length (size).
|
||||
*
|
||||
* Notes:
|
||||
* * the length is specified in bytes.
|
||||
* * returned value must be freed with jerry_release_value, when it is no longer needed.
|
||||
* * if the typed arrays are disabled this will return a TypeError.
|
||||
*
|
||||
* @return value of the constructed SharedArrayBuffer object
|
||||
*/
|
||||
jerry_value_t
|
||||
jerry_create_shared_arraybuffer (const jerry_length_t size) /**< size of the SharedArrayBuffer to create */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
return jerry_return (ecma_make_object_value (ecma_shared_arraybuffer_new_object (size)));
|
||||
#else /* !JERRY_BUILTIN_TYPEDARRAY */
|
||||
JERRY_UNUSED (size);
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
} /* jerry_create_shared_arraybuffer */
|
||||
|
||||
/**
|
||||
* Creates a SharedArrayBuffer object with user specified buffer.
|
||||
*
|
||||
* Notes:
|
||||
* * the size is specified in bytes.
|
||||
* * the buffer passed should be at least the specified bytes big.
|
||||
* * if the typed arrays are disabled this will return a TypeError.
|
||||
* * if the size is zero or buffer_p is a null pointer this will return an empty SharedArrayBuffer.
|
||||
*
|
||||
* @return value of the construced SharedArrayBuffer object
|
||||
*/
|
||||
jerry_value_t
|
||||
jerry_create_shared_arraybuffer_external (const jerry_length_t size, /**< size of the buffer to used */
|
||||
uint8_t *buffer_p, /**< buffer to use as the SharedArrayBuffer's backing */
|
||||
jerry_value_free_callback_t free_cb) /**< buffer free callback */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
ecma_object_t *shared_arraybuffer;
|
||||
|
||||
if (JERRY_UNLIKELY (size == 0 || buffer_p == NULL))
|
||||
{
|
||||
shared_arraybuffer = ecma_shared_arraybuffer_new_object (0);
|
||||
}
|
||||
else
|
||||
{
|
||||
shared_arraybuffer = ecma_shared_arraybuffer_new_object_external (size, buffer_p, free_cb);
|
||||
}
|
||||
|
||||
return jerry_return (ecma_make_object_value (shared_arraybuffer));
|
||||
#else /* !JERRY_BUILTIN_TYPEDARRAY */
|
||||
JERRY_UNUSED (size);
|
||||
JERRY_UNUSED (buffer_p);
|
||||
JERRY_UNUSED (free_cb);
|
||||
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_typed_array_not_supported_p)));
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
} /* jerry_create_shared_arraybuffer_external */
|
||||
|
||||
/**
|
||||
* Copy bytes into the ArrayBuffer or SharedArrayBuffer from a buffer.
|
||||
*
|
||||
* Note:
|
||||
* * if the object passed is not an ArrayBuffer will return 0.
|
||||
* * returns 0, if the passed object is not an ArrayBuffer or SharedArrayBuffer
|
||||
*
|
||||
* @return number of bytes copied into the ArrayBuffer.
|
||||
* @return number of bytes copied into the ArrayBuffer or SharedArrayBuffer.
|
||||
*/
|
||||
jerry_length_t
|
||||
jerry_arraybuffer_write (const jerry_value_t value, /**< target ArrayBuffer */
|
||||
jerry_arraybuffer_write (const jerry_value_t value, /**< target ArrayBuffer or SharedArrayBuffer */
|
||||
jerry_length_t offset, /**< start offset of the ArrayBuffer */
|
||||
const uint8_t *buf_p, /**< buffer to copy from */
|
||||
jerry_length_t buf_size) /**< number of bytes to copy from the buffer */
|
||||
@@ -5638,7 +5721,7 @@ jerry_arraybuffer_write (const jerry_value_t value, /**< target ArrayBuffer */
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (!ecma_is_arraybuffer (value))
|
||||
if (!(ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -5671,23 +5754,23 @@ jerry_arraybuffer_write (const jerry_value_t value, /**< target ArrayBuffer */
|
||||
} /* jerry_arraybuffer_write */
|
||||
|
||||
/**
|
||||
* Copy bytes from a buffer into an ArrayBuffer.
|
||||
* Copy bytes from a buffer into an ArrayBuffer or SharedArrayBuffer.
|
||||
*
|
||||
* Note:
|
||||
* * if the object passed is not an ArrayBuffer will return 0.
|
||||
* * if the object passed is not an ArrayBuffer or SharedArrayBuffer will return 0.
|
||||
*
|
||||
* @return number of bytes read from the ArrayBuffer.
|
||||
*/
|
||||
jerry_length_t
|
||||
jerry_arraybuffer_read (const jerry_value_t value, /**< ArrayBuffer to read from */
|
||||
jerry_length_t offset, /**< start offset of the ArrayBuffer */
|
||||
jerry_arraybuffer_read (const jerry_value_t value, /**< ArrayBuffer or SharedArrayBuffer to read from */
|
||||
jerry_length_t offset, /**< start offset of the ArrayBuffer or SharedArrayBuffer */
|
||||
uint8_t *buf_p, /**< destination buffer to copy to */
|
||||
jerry_length_t buf_size) /**< number of bytes to copy into the buffer */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (!ecma_is_arraybuffer (value))
|
||||
if (!(ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -5720,20 +5803,20 @@ jerry_arraybuffer_read (const jerry_value_t value, /**< ArrayBuffer to read from
|
||||
} /* jerry_arraybuffer_read */
|
||||
|
||||
/**
|
||||
* Get the length (size) of the ArrayBuffer in bytes.
|
||||
* Get the length (size) of the ArrayBuffer or SharedArrayBuffer in bytes.
|
||||
*
|
||||
* Note:
|
||||
* This is the 'byteLength' property of an ArrayBuffer.
|
||||
* This is the 'byteLength' property of an ArrayBuffer or SharedArrayBuffer.
|
||||
*
|
||||
* @return the length of the ArrayBuffer in bytes.
|
||||
*/
|
||||
jerry_length_t
|
||||
jerry_get_arraybuffer_byte_length (const jerry_value_t value) /**< ArrayBuffer */
|
||||
jerry_get_arraybuffer_byte_length (const jerry_value_t value) /**< ArrayBuffer or SharedArrayBuffer */
|
||||
{
|
||||
jerry_assert_api_available ();
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (ecma_is_arraybuffer (value))
|
||||
if (ecma_is_arraybuffer (value) || ecma_is_shared_arraybuffer (value))
|
||||
{
|
||||
ecma_object_t *buffer_p = ecma_get_object_from_value (value);
|
||||
return ecma_arraybuffer_get_length (buffer_p);
|
||||
@@ -5763,7 +5846,7 @@ jerry_get_arraybuffer_pointer (const jerry_value_t array_buffer) /**< Array Buff
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
if (ecma_is_value_error_reference (array_buffer)
|
||||
|| !ecma_is_arraybuffer (array_buffer))
|
||||
|| !(ecma_is_arraybuffer (array_buffer) || ecma_is_shared_arraybuffer (array_buffer)))
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -1872,6 +1872,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
case ECMA_OBJECT_CLASS_ARRAY_BUFFER:
|
||||
case ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER:
|
||||
{
|
||||
uint32_t arraybuffer_length = ext_object_p->u.cls.u3.length;
|
||||
|
||||
|
||||
@@ -729,6 +729,7 @@ typedef enum
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
ECMA_OBJECT_CLASS_ARRAY_BUFFER, /**< Array Buffer (ECMAScript v6, 24.1) */
|
||||
ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER, /**< Shared Array Buffer (ECMAScript v11 24.2) */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
ECMA_OBJECT_CLASS_BIGINT, /**< Bigint (ECMAScript v11, 4.3.27) */
|
||||
|
||||
@@ -103,128 +103,7 @@ ecma_builtin_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< thi
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an ArrayBuffer object"));
|
||||
}
|
||||
|
||||
/* TODO: step 3. if SharedArrayBuffer will be implemented */
|
||||
|
||||
/* 4. */
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
uint32_t len = ecma_arraybuffer_get_length (object_p);
|
||||
|
||||
uint32_t start = 0;
|
||||
uint32_t end = len;
|
||||
|
||||
if (arguments_number > 0)
|
||||
{
|
||||
/* 6-7. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0],
|
||||
len,
|
||||
&start)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
if (arguments_number > 1 && !ecma_is_value_undefined (argument_list_p[1]))
|
||||
{
|
||||
/* 8-9 .*/
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1],
|
||||
len,
|
||||
&end)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
uint32_t new_len = (end >= start) ? (end - start) : 0;
|
||||
|
||||
/* 11. */
|
||||
ecma_value_t ctor = ecma_op_species_constructor (object_p, ECMA_BUILTIN_ID_ARRAYBUFFER);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ctor))
|
||||
{
|
||||
return ctor;
|
||||
}
|
||||
|
||||
/* 12. */
|
||||
ecma_object_t *ctor_obj_p = ecma_get_object_from_value (ctor);
|
||||
ecma_value_t new_len_value = ecma_make_uint32_value (new_len);
|
||||
|
||||
ecma_value_t new_arraybuffer = ecma_op_function_construct (ctor_obj_p, ctor_obj_p, &new_len_value, 1);
|
||||
|
||||
ecma_deref_object (ctor_obj_p);
|
||||
ecma_free_value (new_len_value);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (new_arraybuffer))
|
||||
{
|
||||
return new_arraybuffer;
|
||||
}
|
||||
|
||||
ecma_object_t *new_arraybuffer_p = ecma_get_object_from_value (new_arraybuffer);
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
/* 13. */
|
||||
if (!ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* TODO: step 14. if SharedArrayBuffer will be implemented */
|
||||
|
||||
/* 15. */
|
||||
if (ecma_arraybuffer_is_detached (new_arraybuffer_p))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Returned ArrayBuffer has been detached"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 16. */
|
||||
if (ecma_op_same_value (new_arraybuffer, this_arg))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer subclass returned this from species constructor"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 17. */
|
||||
if (ecma_arraybuffer_get_length (new_arraybuffer_p) < new_len)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived ArrayBuffer constructor created a too small buffer"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 19. */
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Original ArrayBuffer has been detached"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 20. */
|
||||
lit_utf8_byte_t *old_buf = ecma_arraybuffer_get_buffer (object_p);
|
||||
|
||||
/* 21. */
|
||||
lit_utf8_byte_t *new_buf = ecma_arraybuffer_get_buffer (new_arraybuffer_p);
|
||||
|
||||
/* 22. */
|
||||
memcpy (new_buf, old_buf + start, new_len);
|
||||
|
||||
free_new_arraybuffer:
|
||||
if (ret_value != ECMA_VALUE_EMPTY)
|
||||
{
|
||||
ecma_deref_object (new_arraybuffer_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 23. */
|
||||
ret_value = ecma_make_object_value (new_arraybuffer_p);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);
|
||||
} /* ecma_builtin_arraybuffer_prototype_object_slice */
|
||||
|
||||
/**
|
||||
|
||||
@@ -164,6 +164,10 @@ OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
|
||||
ECMA_BUILTIN_ID_ARRAYBUFFER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
|
||||
ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL,
|
||||
ECMA_BUILTIN_ID_INT8ARRAY,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
@@ -0,0 +1,112 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-conversion.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "jrt.h"
|
||||
#include "jrt-libc-includes.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer-prototype.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID shared_arraybuffer_prototype
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup sharedarraybufferprototype ECMA SharedArrayBuffer.prototype object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* The SharedArrayBuffer.prototype.bytelength accessor
|
||||
*
|
||||
* See also:
|
||||
* ES11, 24.2.4.1
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_shared_arraybuffer_prototype_bytelength_getter (ecma_value_t this_arg) /**< this argument */
|
||||
{
|
||||
if (ecma_is_value_object (this_arg))
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
if (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))
|
||||
{
|
||||
uint32_t len = ecma_arraybuffer_get_length (object_p);
|
||||
|
||||
return ecma_make_uint32_value (len);
|
||||
}
|
||||
}
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not a SharedArrayBuffer object"));
|
||||
} /* ecma_builtin_shared_arraybuffer_prototype_bytelength_getter */
|
||||
|
||||
/**
|
||||
* The SharedArrayBuffer.prototype object's 'slice' routine
|
||||
*
|
||||
* See also:
|
||||
* ECMA-262 v11, 24.2.4.3
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value.
|
||||
*/
|
||||
static ecma_value_t
|
||||
ecma_builtin_shared_arraybuffer_prototype_object_slice (ecma_value_t this_arg, /**< this argument */
|
||||
const ecma_value_t *argument_list_p, /**< arguments list */
|
||||
uint32_t arguments_number) /**< number of arguments */
|
||||
{
|
||||
if (!ecma_is_value_object (this_arg))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
|
||||
}
|
||||
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
/* 2. */
|
||||
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an SharedArrayBuffer object"));
|
||||
}
|
||||
|
||||
return ecma_builtin_arraybuffer_slice (this_arg, argument_list_p, arguments_number);
|
||||
} /* ecma_builtin_shared_arraybuffer_prototype_object_slice */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
@@ -0,0 +1,47 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SharedArrayBuffer.prototype built-in description
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-helpers-macro-defines.inc.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
|
||||
ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,
|
||||
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
|
||||
|
||||
/* Readonly accessor properties */
|
||||
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
|
||||
ecma_builtin_shared_arraybuffer_prototype_bytelength_getter,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* ECMA-262 v11, 24.2.4.4 */
|
||||
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
|
||||
LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
ROUTINE (LIT_MAGIC_STRING_SLICE, ecma_builtin_shared_arraybuffer_prototype_object_slice, NON_FIXED, 2)
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
#include "ecma-builtin-helpers-macro-undefs.inc.h"
|
||||
@@ -0,0 +1,95 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-dataview-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "jrt.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
#define ECMA_BUILTINS_INTERNAL
|
||||
#include "ecma-builtins-internal.h"
|
||||
|
||||
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer.inc.h"
|
||||
#define BUILTIN_UNDERSCORED_ID shared_arraybuffer
|
||||
#include "ecma-builtin-internal-routines-template.inc.h"
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmabuiltins
|
||||
* @{
|
||||
*
|
||||
* \addtogroup sharedarraybuffer ECMA SharedArrayBuffer object built-in
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Handle calling [[Call]] of built-in SharedArrayBuffer object
|
||||
*
|
||||
* ES11 24.2.2 SharedArrayBuffer is not intended to be called as
|
||||
* a function and will throw an exception when called in
|
||||
* that manner.
|
||||
*
|
||||
* @return ecma value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_shared_arraybuffer_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
uint32_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Constructor SharedArrayBuffer requires 'new'"));
|
||||
} /* ecma_builtin_shared_arraybuffer_dispatch_call */
|
||||
|
||||
/**
|
||||
* Handle calling [[Construct]] of built-in SharedArrayBuffer object
|
||||
*
|
||||
* @return ecma value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_shared_arraybuffer_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
|
||||
uint32_t arguments_list_len) /**< number of arguments */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
return ecma_op_create_shared_arraybuffer_object (arguments_list_p, arguments_list_len);
|
||||
} /* ecma_builtin_shared_arraybuffer_dispatch_construct */
|
||||
|
||||
/**
|
||||
* 24.2.3.2 get SharedArrayBuffer [ @@species ] accessor
|
||||
*
|
||||
* @return ecma_value
|
||||
* returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_builtin_shared_arraybuffer_species_get (ecma_value_t this_value) /**< This Value */
|
||||
{
|
||||
return ecma_copy_value (this_value);
|
||||
} /* ecma_builtin_shared_arraybuffer_species_get */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
@@ -0,0 +1,52 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
/*
|
||||
* SharedArrayBuffer built-in description
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-helpers-macro-defines.inc.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
/* Number properties:
|
||||
* (property name, number value, writable, enumerable, configurable) */
|
||||
|
||||
NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
|
||||
1,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Object properties:
|
||||
* (property name, object pointer getter) */
|
||||
|
||||
OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
|
||||
ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE,
|
||||
ECMA_PROPERTY_FIXED)
|
||||
|
||||
STRING_VALUE (LIT_MAGIC_STRING_NAME,
|
||||
LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
/* Routine properties:
|
||||
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
|
||||
|
||||
/* ES11 24.1.3.3 */
|
||||
ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
|
||||
ecma_builtin_shared_arraybuffer_species_get,
|
||||
ECMA_PROPERTY_FLAG_CONFIGURABLE)
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
|
||||
#include "ecma-builtin-helpers-macro-undefs.inc.h"
|
||||
@@ -337,7 +337,21 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAYBUFFER,
|
||||
true,
|
||||
arraybuffer)
|
||||
|
||||
/* The %TypedArrayPrototype% object (ES2015 24.2.3) */
|
||||
/* The SharedArrayBuffer.prototype object (ES2015 24.2.4) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||
true,
|
||||
shared_arraybuffer_prototype)
|
||||
|
||||
/* The SharedArrayBuffer object (ES2015 24.2.2) */
|
||||
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,
|
||||
ECMA_OBJECT_TYPE_NATIVE_FUNCTION,
|
||||
ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
|
||||
true,
|
||||
shared_arraybuffer)
|
||||
|
||||
/* The %TypedArrayPrototype% object (ES2015 24.2.3) */
|
||||
BUILTIN (ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,
|
||||
ECMA_OBJECT_TYPE_GENERAL,
|
||||
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
|
||||
|
||||
@@ -13,7 +13,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-builtin-helpers.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-builtins.h"
|
||||
@@ -184,7 +186,8 @@ ecma_is_arraybuffer (ecma_value_t target) /**< the target value */
|
||||
uint32_t JERRY_ATTR_PURE
|
||||
ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
return ecma_arraybuffer_is_detached (object_p) ? 0 : ext_object_p->u.cls.u3.length;
|
||||
@@ -198,7 +201,8 @@ ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayB
|
||||
extern inline lit_utf8_byte_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
|
||||
@@ -225,7 +229,8 @@ ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayB
|
||||
extern inline bool JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
|
||||
ecma_arraybuffer_is_detached (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
|
||||
{
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));
|
||||
|
||||
return (((ecma_extended_object_t *) object_p)->u.cls.u1.array_buffer_flags & ECMA_ARRAYBUFFER_DETACHED) != 0;
|
||||
} /* ecma_arraybuffer_is_detached */
|
||||
@@ -268,6 +273,142 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe
|
||||
return true;
|
||||
} /* ecma_arraybuffer_detach */
|
||||
|
||||
ecma_value_t
|
||||
ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
|
||||
const ecma_value_t *argument_list_p,
|
||||
uint32_t arguments_number)
|
||||
{
|
||||
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
|
||||
|
||||
/* 4. */
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_arraybuffer_is_detached));
|
||||
}
|
||||
|
||||
/* 5. */
|
||||
uint32_t len = ecma_arraybuffer_get_length (object_p);
|
||||
|
||||
uint32_t start = 0;
|
||||
uint32_t end = len;
|
||||
|
||||
if (arguments_number > 0)
|
||||
{
|
||||
/* 6-7. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0],
|
||||
len,
|
||||
&start)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
if (arguments_number > 1 && !ecma_is_value_undefined (argument_list_p[1]))
|
||||
{
|
||||
/* 8-9. */
|
||||
if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1],
|
||||
len,
|
||||
&end)))
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* 10. */
|
||||
uint32_t new_len = (end >= start) ? (end - start) : 0;
|
||||
|
||||
/* 11. */
|
||||
ecma_value_t ctor;
|
||||
if (ecma_is_shared_arraybuffer (this_arg))
|
||||
{
|
||||
ctor = ecma_op_species_constructor (object_p, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER);
|
||||
}
|
||||
else
|
||||
{
|
||||
ctor = ecma_op_species_constructor (object_p, ECMA_BUILTIN_ID_ARRAYBUFFER);
|
||||
}
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (ctor))
|
||||
{
|
||||
return ctor;
|
||||
}
|
||||
|
||||
/* 12. */
|
||||
ecma_object_t *ctor_obj_p = ecma_get_object_from_value (ctor);
|
||||
ecma_value_t new_len_value = ecma_make_uint32_value (new_len);
|
||||
|
||||
ecma_value_t new_arraybuffer = ecma_op_function_construct (ctor_obj_p, ctor_obj_p, &new_len_value, 1);
|
||||
|
||||
ecma_deref_object (ctor_obj_p);
|
||||
ecma_free_value (new_len_value);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (new_arraybuffer))
|
||||
{
|
||||
return new_arraybuffer;
|
||||
}
|
||||
|
||||
ecma_object_t *new_arraybuffer_p = ecma_get_object_from_value (new_arraybuffer);
|
||||
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
|
||||
|
||||
/* 13. */
|
||||
if (!(ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (new_arraybuffer_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER)))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Return value is not an ArrayBuffer object"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 14-15. */
|
||||
if (ecma_arraybuffer_is_detached (new_arraybuffer_p))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Returned ArrayBuffer has been detached"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 16. */
|
||||
if (new_arraybuffer == this_arg)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("ArrayBuffer subclass returned this from species constructor"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 17. */
|
||||
if (ecma_arraybuffer_get_length (new_arraybuffer_p) < new_len)
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Derived ArrayBuffer constructor created a too small buffer"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 19. */
|
||||
if (ecma_arraybuffer_is_detached (object_p))
|
||||
{
|
||||
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Original ArrayBuffer has been detached"));
|
||||
goto free_new_arraybuffer;
|
||||
}
|
||||
|
||||
/* 20. */
|
||||
lit_utf8_byte_t *old_buf = ecma_arraybuffer_get_buffer (object_p);
|
||||
|
||||
/* 21. */
|
||||
lit_utf8_byte_t *new_buf = ecma_arraybuffer_get_buffer (new_arraybuffer_p);
|
||||
|
||||
/* 22. */
|
||||
memcpy (new_buf, old_buf + start, new_len);
|
||||
|
||||
free_new_arraybuffer:
|
||||
if (ret_value != ECMA_VALUE_EMPTY)
|
||||
{
|
||||
ecma_deref_object (new_arraybuffer_p);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* 23. */
|
||||
ret_value = ecma_make_object_value (new_arraybuffer_p);
|
||||
}
|
||||
|
||||
return ret_value;
|
||||
} /* ecma_builtin_arraybuffer_slice */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
|
||||
@@ -49,6 +49,10 @@ bool
|
||||
ecma_arraybuffer_detach (ecma_object_t *obj_p);
|
||||
bool
|
||||
ecma_is_arraybuffer (ecma_value_t val);
|
||||
ecma_value_t
|
||||
ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
|
||||
const ecma_value_t *argument_list_p,
|
||||
uint32_t arguments_number);
|
||||
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "jcontext.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-bigint.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
@@ -60,9 +61,10 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
|
||||
|
||||
ecma_object_t *buffer_p = ecma_get_object_from_value (buffer);
|
||||
|
||||
if (!ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
if (!(ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER)))
|
||||
{
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an ArrayBuffer"));
|
||||
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'buffer' is not an ArrayBuffer or SharedArrayBuffer"));
|
||||
}
|
||||
|
||||
/* 3. */
|
||||
@@ -253,7 +255,8 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
}
|
||||
|
||||
ecma_object_t *buffer_p = view_p->buffer_p;
|
||||
JERRY_ASSERT (ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER));
|
||||
JERRY_ASSERT (ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (buffer_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));
|
||||
|
||||
/* 3. */
|
||||
ecma_number_t get_index;
|
||||
@@ -295,7 +298,6 @@ ecma_op_dataview_get_set_view_value (ecma_value_t view, /**< the operation's 'vi
|
||||
/* GetViewValue 4., SetViewValue 6. */
|
||||
bool is_little_endian = ecma_op_to_boolean (is_little_endian_value);
|
||||
|
||||
/* GetViewValue 5 - 6., SetViewValue 7 - 8. */
|
||||
if (ecma_arraybuffer_is_detached (buffer_p))
|
||||
{
|
||||
ecma_free_value (value_to_set);
|
||||
|
||||
@@ -2759,6 +2759,7 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
|
||||
#endif /* JERRY_BUILTIN_PROMISE */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE)
|
||||
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE)
|
||||
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE)
|
||||
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE)
|
||||
|| ecma_builtin_is (obj_p, ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE)
|
||||
@@ -2879,6 +2880,7 @@ static const uint16_t ecma_class_object_magic_string_id[] =
|
||||
#endif /* JERRY_ESNEXT */
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
LIT_MAGIC_STRING_ARRAY_BUFFER_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARRAY_BUFFER */
|
||||
LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, /**< magic string id of ECMA_OBJECT_CLASS_SHAREDARRAY_BUFFER */
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#if JERRY_BUILTIN_BIGINT
|
||||
LIT_MAGIC_STRING_BIGINT_UL, /**< magic string id of ECMA_OBJECT_CLASS_BIGINT */
|
||||
|
||||
@@ -0,0 +1,180 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-objects.h"
|
||||
#include "ecma-builtins.h"
|
||||
#include "ecma-exceptions.h"
|
||||
#include "ecma-gc.h"
|
||||
#include "ecma-globals.h"
|
||||
#include "ecma-helpers.h"
|
||||
#include "jmem.h"
|
||||
#include "jcontext.h"
|
||||
#include "ecma-function-object.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmasharedarraybufferobject ECMA SharedArrayBuffer object related routines
|
||||
* @{
|
||||
*/
|
||||
|
||||
/**
|
||||
* Helper function: create SharedArrayBuffer object based on the array length
|
||||
*
|
||||
* The struct of arraybuffer object:
|
||||
* ecma_object_t
|
||||
* extend_part
|
||||
* data buffer
|
||||
*
|
||||
* @return ecma_object_t *
|
||||
*/
|
||||
ecma_object_t *
|
||||
ecma_shared_arraybuffer_new_object (uint32_t length) /**< length of the SharedArrayBuffer */
|
||||
{
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_extended_object_t) + length,
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
|
||||
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER;
|
||||
ext_object_p->u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_INTERNAL_MEMORY;
|
||||
ext_object_p->u.cls.u3.length = length;
|
||||
|
||||
lit_utf8_byte_t *buf = (lit_utf8_byte_t *) (ext_object_p + 1);
|
||||
memset (buf, 0, length);
|
||||
|
||||
return object_p;
|
||||
} /* ecma_shared_arraybuffer_new_object */
|
||||
|
||||
/**
|
||||
* Helper function: create SharedArrayBuffer object with external buffer backing.
|
||||
*
|
||||
* The struct of external arraybuffer object:
|
||||
* ecma_object_t
|
||||
* extend_part
|
||||
* SharedArrayBuffer external info part
|
||||
*
|
||||
* @return ecma_object_t *, pointer to the created SharedArrayBuffer object
|
||||
*/
|
||||
ecma_object_t *
|
||||
ecma_shared_arraybuffer_new_object_external (uint32_t length, /**< length of the buffer_p to use */
|
||||
void *buffer_p, /**< pointer for SharedArrayBuffer's buffer backing */
|
||||
jerry_value_free_callback_t free_cb) /**< buffer free callback */
|
||||
{
|
||||
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);
|
||||
ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
|
||||
sizeof (ecma_arraybuffer_external_info),
|
||||
ECMA_OBJECT_TYPE_CLASS);
|
||||
|
||||
ecma_arraybuffer_external_info *array_object_p = (ecma_arraybuffer_external_info *) object_p;
|
||||
array_object_p->extended_object.u.cls.type = ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER;
|
||||
array_object_p->extended_object.u.cls.u1.array_buffer_flags = ECMA_ARRAYBUFFER_EXTERNAL_MEMORY;
|
||||
array_object_p->extended_object.u.cls.u3.length = length;
|
||||
|
||||
array_object_p->buffer_p = buffer_p;
|
||||
array_object_p->free_cb = free_cb;
|
||||
|
||||
return object_p;
|
||||
} /* ecma_shared_arraybuffer_new_object_external */
|
||||
|
||||
/**
|
||||
* SharedArrayBuffer object creation operation.
|
||||
*
|
||||
* See also: ES11 24.1.1.1
|
||||
*
|
||||
* @return ecma value
|
||||
* Returned value must be freed with ecma_free_value
|
||||
*/
|
||||
ecma_value_t
|
||||
ecma_op_create_shared_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< list of arguments that
|
||||
* are passed to String constructor */
|
||||
uint32_t arguments_list_len) /**< length of the arguments' list */
|
||||
{
|
||||
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
|
||||
|
||||
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
|
||||
ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);
|
||||
|
||||
if (proto_p == NULL)
|
||||
{
|
||||
return ECMA_VALUE_ERROR;
|
||||
}
|
||||
|
||||
ecma_number_t length_num = 0;
|
||||
|
||||
if (arguments_list_len > 0)
|
||||
{
|
||||
if (ecma_is_value_number (arguments_list_p[0]))
|
||||
{
|
||||
length_num = ecma_get_number_from_value (arguments_list_p[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
ecma_value_t to_number_value = ecma_op_to_number (arguments_list_p[0], &length_num);
|
||||
|
||||
if (ECMA_IS_VALUE_ERROR (to_number_value))
|
||||
{
|
||||
ecma_deref_object (proto_p);
|
||||
return to_number_value;
|
||||
}
|
||||
}
|
||||
|
||||
if (ecma_number_is_nan (length_num))
|
||||
{
|
||||
length_num = 0;
|
||||
}
|
||||
|
||||
const uint32_t maximum_size_in_byte = UINT32_MAX - sizeof (ecma_extended_object_t) - JMEM_ALIGNMENT + 1;
|
||||
|
||||
if (length_num <= -1.0 || length_num > (ecma_number_t) maximum_size_in_byte + 0.5)
|
||||
{
|
||||
ecma_deref_object (proto_p);
|
||||
return ecma_raise_range_error (ECMA_ERR_MSG ("Invalid Shared ArrayBuffer length"));
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t length_uint32 = ecma_number_to_uint32 (length_num);
|
||||
ecma_object_t *shared_array_buffer = ecma_shared_arraybuffer_new_object (length_uint32);
|
||||
ECMA_SET_NON_NULL_POINTER (shared_array_buffer->u2.prototype_cp, proto_p);
|
||||
ecma_deref_object (proto_p);
|
||||
|
||||
return ecma_make_object_value (shared_array_buffer);
|
||||
} /* ecma_op_create_shared_arraybuffer_object */
|
||||
|
||||
/**
|
||||
* Helper function: check if the target is SharedArrayBuffer
|
||||
*
|
||||
* See also: ES11 24.1.1.4
|
||||
*
|
||||
* @return true - if value is a SharedArrayBuffer object
|
||||
* false - otherwise
|
||||
*/
|
||||
bool
|
||||
ecma_is_shared_arraybuffer (ecma_value_t target) /**< the target value */
|
||||
{
|
||||
return (ecma_is_value_object (target)
|
||||
&& ecma_object_class_is (ecma_get_object_from_value (target), ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER));
|
||||
} /* ecma_is_shared_arraybuffer */
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
@@ -0,0 +1,51 @@
|
||||
/* Copyright JS Foundation and other contributors, http://js.foundation
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ECMA_SHARED_ARRAYBUFFER_OBJECT_H
|
||||
#define ECMA_SHARED_ARRAYBUFFER_OBJECT_H
|
||||
|
||||
#include "ecma-globals.h"
|
||||
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
|
||||
/** \addtogroup ecma ECMA
|
||||
* @{
|
||||
*
|
||||
* \addtogroup ecmasharedarraybufferobject ECMA SharedArrayBuffer object related routines
|
||||
* @{
|
||||
*/
|
||||
|
||||
ecma_value_t
|
||||
ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t);
|
||||
|
||||
/**
|
||||
* Helper functions for SharedArrayBuffer.
|
||||
*/
|
||||
ecma_object_t *
|
||||
ecma_shared_arraybuffer_new_object (uint32_t lengh);
|
||||
ecma_object_t *
|
||||
ecma_shared_arraybuffer_new_object_external (uint32_t length,
|
||||
void *buffer_p,
|
||||
jerry_value_free_callback_t free_cb);
|
||||
bool
|
||||
ecma_is_shared_arraybuffer (ecma_value_t val);
|
||||
|
||||
/**
|
||||
* @}
|
||||
* @}
|
||||
*/
|
||||
|
||||
#endif /* JERRY_BUILTIN_TYPEDARRAY */
|
||||
#endif /* !ECMA_SHARED_ARRAYBUFFER_OBJECT_H */
|
||||
@@ -18,6 +18,7 @@
|
||||
#include "ecma-iterator-object.h"
|
||||
#include "ecma-typedarray-object.h"
|
||||
#include "ecma-arraybuffer-object.h"
|
||||
#include "ecma-shared-arraybuffer-object.h"
|
||||
#include "ecma-function-object.h"
|
||||
#include "ecma-bigint.h"
|
||||
#include "ecma-big-uint.h"
|
||||
@@ -1646,7 +1647,8 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
|
||||
element_size_shift,
|
||||
typedarray_id);
|
||||
}
|
||||
else if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER))
|
||||
else if (ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
|
||||
|| ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER))
|
||||
{
|
||||
/* 22.2.1.5 */
|
||||
ecma_object_t *arraybuffer_p = obj_p;
|
||||
|
||||
@@ -383,6 +383,16 @@ uint8_t *jerry_get_arraybuffer_pointer (const jerry_value_t value);
|
||||
jerry_value_t jerry_is_arraybuffer_detachable (const jerry_value_t value);
|
||||
jerry_value_t jerry_detach_arraybuffer (const jerry_value_t value);
|
||||
|
||||
/**
|
||||
* SharedArrayBuffer components.
|
||||
*/
|
||||
|
||||
bool jerry_value_is_shared_arraybuffer (const jerry_value_t value);
|
||||
jerry_value_t jerry_create_shared_arraybuffer (const jerry_length_t size);
|
||||
jerry_value_t jerry_create_shared_arraybuffer_external (const jerry_length_t size,
|
||||
uint8_t *buffer_p,
|
||||
jerry_value_free_callback_t free_cb);
|
||||
|
||||
/**
|
||||
* DataView functions.
|
||||
*/
|
||||
|
||||
@@ -476,32 +476,33 @@ typedef enum
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
JERRY_OBJECT_TYPE_NONE = 0u, /**< Non object type */
|
||||
JERRY_OBJECT_TYPE_GENERIC, /**< Generic JavaScript object without any internal property */
|
||||
JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< Namespace object */
|
||||
JERRY_OBJECT_TYPE_ARRAY, /**< Array object */
|
||||
JERRY_OBJECT_TYPE_PROXY, /**< Proxy object */
|
||||
JERRY_OBJECT_TYPE_SCRIPT, /**< Script object (see jerry_parse) */
|
||||
JERRY_OBJECT_TYPE_MODULE, /**< Module object (see jerry_parse) */
|
||||
JERRY_OBJECT_TYPE_PROMISE, /**< Promise object */
|
||||
JERRY_OBJECT_TYPE_DATAVIEW, /**< Dataview object */
|
||||
JERRY_OBJECT_TYPE_FUNCTION, /**< Function object (see jerry_function_get_type) */
|
||||
JERRY_OBJECT_TYPE_TYPEDARRAY, /**< %TypedArray% object (see jerry_get_typedarray_type) */
|
||||
JERRY_OBJECT_TYPE_ITERATOR, /**< Iterator object (see jerry_iterator_get_type) */
|
||||
JERRY_OBJECT_TYPE_CONTAINER, /**< Container object (see jerry_container_get_type) */
|
||||
JERRY_OBJECT_TYPE_ERROR, /**< Error object */
|
||||
JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< Array buffer object */
|
||||
JERRY_OBJECT_TYPE_NONE = 0u, /**< Non object type */
|
||||
JERRY_OBJECT_TYPE_GENERIC, /**< Generic JavaScript object without any internal property */
|
||||
JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< Namespace object */
|
||||
JERRY_OBJECT_TYPE_ARRAY, /**< Array object */
|
||||
JERRY_OBJECT_TYPE_PROXY, /**< Proxy object */
|
||||
JERRY_OBJECT_TYPE_SCRIPT, /**< Script object (see jerry_parse) */
|
||||
JERRY_OBJECT_TYPE_MODULE, /**< Module object (see jerry_parse) */
|
||||
JERRY_OBJECT_TYPE_PROMISE, /**< Promise object */
|
||||
JERRY_OBJECT_TYPE_DATAVIEW, /**< Dataview object */
|
||||
JERRY_OBJECT_TYPE_FUNCTION, /**< Function object (see jerry_function_get_type) */
|
||||
JERRY_OBJECT_TYPE_TYPEDARRAY, /**< %TypedArray% object (see jerry_get_typedarray_type) */
|
||||
JERRY_OBJECT_TYPE_ITERATOR, /**< Iterator object (see jerry_iterator_get_type) */
|
||||
JERRY_OBJECT_TYPE_CONTAINER, /**< Container object (see jerry_container_get_type) */
|
||||
JERRY_OBJECT_TYPE_ERROR, /**< Error object */
|
||||
JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< Array buffer object */
|
||||
JERRY_OBJECT_TYPE_SHARED_ARRAY_BUFFER, /**< Shared Array Buffer object */
|
||||
|
||||
JERRY_OBJECT_TYPE_ARGUMENTS, /**< Arguments object */
|
||||
JERRY_OBJECT_TYPE_BOOLEAN, /**< Boolean object */
|
||||
JERRY_OBJECT_TYPE_DATE, /**< Date object */
|
||||
JERRY_OBJECT_TYPE_NUMBER, /**< Number object */
|
||||
JERRY_OBJECT_TYPE_REGEXP, /**< RegExp object */
|
||||
JERRY_OBJECT_TYPE_STRING, /**< String object */
|
||||
JERRY_OBJECT_TYPE_SYMBOL, /**< Symbol object */
|
||||
JERRY_OBJECT_TYPE_GENERATOR, /**< Generator object */
|
||||
JERRY_OBJECT_TYPE_BIGINT, /**< BigInt object */
|
||||
JERRY_OBJECT_TYPE_WEAKREF, /**< WeakRef object */
|
||||
JERRY_OBJECT_TYPE_ARGUMENTS, /**< Arguments object */
|
||||
JERRY_OBJECT_TYPE_BOOLEAN, /**< Boolean object */
|
||||
JERRY_OBJECT_TYPE_DATE, /**< Date object */
|
||||
JERRY_OBJECT_TYPE_NUMBER, /**< Number object */
|
||||
JERRY_OBJECT_TYPE_REGEXP, /**< RegExp object */
|
||||
JERRY_OBJECT_TYPE_STRING, /**< String object */
|
||||
JERRY_OBJECT_TYPE_SYMBOL, /**< Symbol object */
|
||||
JERRY_OBJECT_TYPE_GENERATOR, /**< Generator object */
|
||||
JERRY_OBJECT_TYPE_BIGINT, /**< BigInt object */
|
||||
JERRY_OBJECT_TYPE_WEAKREF, /**< WeakRef object */
|
||||
} jerry_object_type_t;
|
||||
|
||||
/**
|
||||
|
||||
@@ -967,6 +967,7 @@ LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, "NEGATIVE_INFINITY")
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, "POSITIVE_INFINITY")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_TYPEDARRAY
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, "SharedArrayBuffer")
|
||||
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, "Uint8ClampedArray")
|
||||
#endif
|
||||
#if JERRY_BUILTIN_DATE
|
||||
@@ -1166,7 +1167,7 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GENERATOR_FUNCTION
|
||||
#elif JERRY_BUILTIN_NUMBER
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_NEGATIVE_INFINITY_U)
|
||||
#elif JERRY_BUILTIN_TYPEDARRAY
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL)
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL)
|
||||
#elif JERRY_BUILTIN_DATE
|
||||
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL)
|
||||
#else
|
||||
|
||||
@@ -391,6 +391,7 @@ LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U = "BYTES_PER_ELEMENT"
|
||||
LIT_MAGIC_STRING_NEGATIVE_INFINITY_U = "NEGATIVE_INFINITY"
|
||||
LIT_MAGIC_STRING_POSITIVE_INFINITY_U = "POSITIVE_INFINITY"
|
||||
LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL = "GeneratorFunction"
|
||||
LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL = "SharedArrayBuffer"
|
||||
LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL = "Uint8ClampedArray"
|
||||
LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL = "getTimezoneOffset"
|
||||
LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL = "preventExtensions"
|
||||
|
||||
Reference in New Issue
Block a user