Add Windows support. (#2306)
JerryScript-DCO-1.0-Signed-off-by: PKarics karicska@gmail.com JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo luoyonggang@gmail.com
This commit is contained in:
@@ -146,9 +146,7 @@ endif()
|
||||
set(INCLUDE_THIRD_PARTY_VALGRIND "${CMAKE_SOURCE_DIR}/third-party/valgrind")
|
||||
|
||||
# build mode specific compile/link flags
|
||||
if(NOT CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} JERRY_NDEBUG)
|
||||
endif()
|
||||
set(DEFINES_JERRY ${DEFINES_JERRY} $<$<NOT:$<CONFIG:Debug>>:JERRY_NDEBUG>)
|
||||
|
||||
# Jerry heap-section
|
||||
if(DEFINED JERRY_HEAP_SECTION_ATTR)
|
||||
|
||||
@@ -639,7 +639,7 @@ ecma_date_to_string_format (ecma_number_t datetime_number, /**< datetime */
|
||||
};
|
||||
|
||||
const uint32_t date_buffer_length = 34;
|
||||
lit_utf8_byte_t date_buffer[date_buffer_length];
|
||||
JERRY_VLA (lit_utf8_byte_t, date_buffer, date_buffer_length);
|
||||
|
||||
lit_utf8_byte_t *dest_p = date_buffer;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
|
||||
'Null' or one of possible object's classes.
|
||||
The string with null character is maximum 27 characters long. */
|
||||
const lit_utf8_size_t buffer_size = 27;
|
||||
lit_utf8_byte_t str_buffer[buffer_size];
|
||||
JERRY_VLA (lit_utf8_byte_t, str_buffer, buffer_size);
|
||||
|
||||
lit_utf8_byte_t *buffer_ptr = str_buffer;
|
||||
|
||||
|
||||
@@ -1365,9 +1365,10 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
|
||||
const bool obj_is_builtin = ecma_get_object_is_builtin (obj_p);
|
||||
|
||||
const size_t bitmap_row_size = sizeof (uint32_t) * JERRY_BITSINBYTE;
|
||||
uint32_t names_hashes_bitmap[ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size];
|
||||
const size_t names_hashes_bitmap_size = ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size;
|
||||
JERRY_VLA (uint32_t, names_hashes_bitmap, names_hashes_bitmap_size);
|
||||
|
||||
memset (names_hashes_bitmap, 0, sizeof (names_hashes_bitmap));
|
||||
memset (names_hashes_bitmap, 0, names_hashes_bitmap_size * sizeof (names_hashes_bitmap[0]));
|
||||
|
||||
for (ecma_object_t *prototype_chain_iter_p = obj_p;
|
||||
prototype_chain_iter_p != NULL;
|
||||
@@ -1461,8 +1462,9 @@ ecma_op_object_get_property_names (ecma_object_t *obj_p, /**< object */
|
||||
|
||||
ecma_value_t *ecma_value_p = ecma_collection_iterator_init (prop_names_p);
|
||||
|
||||
uint32_t own_names_hashes_bitmap[ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size];
|
||||
memset (own_names_hashes_bitmap, 0, sizeof (own_names_hashes_bitmap));
|
||||
const size_t own_names_hashes_bitmap_size = ECMA_OBJECT_HASH_BITMAP_SIZE / bitmap_row_size;
|
||||
JERRY_VLA (uint32_t, own_names_hashes_bitmap, own_names_hashes_bitmap_size);
|
||||
memset (own_names_hashes_bitmap, 0, own_names_hashes_bitmap_size * sizeof (own_names_hashes_bitmap[0]));
|
||||
|
||||
while (ecma_value_p != NULL)
|
||||
{
|
||||
|
||||
@@ -47,6 +47,24 @@ extern "C"
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
/*
|
||||
* Compiler-specific macros relevant for Microsoft Visual C/C++ Compiler.
|
||||
*/
|
||||
#define JERRY_ATTR_DEPRECATED __declspec(deprecated)
|
||||
#define JERRY_ATTR_NOINLINE __declspec(noinline)
|
||||
#define JERRY_ATTR_NORETURN __declspec(noreturn)
|
||||
|
||||
/*
|
||||
* Microsoft Visual C/C++ Compiler doesn't support for VLA, using _alloca
|
||||
* instead.
|
||||
*/
|
||||
void * __cdecl _alloca (size_t _Size);
|
||||
#define JERRY_VLA(type, name, size) type *name = (type *) (_alloca (sizeof (type) * size))
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
|
||||
/*
|
||||
* Default empty definitions for all compiler-specific macros. Define any of
|
||||
* these in a guarded block above (e.g., as for GCC) to fine tune compilation
|
||||
@@ -110,6 +128,10 @@ extern "C"
|
||||
#define JERRY_UNLIKELY(x) (x)
|
||||
#endif /* !JERRY_UNLIKELY */
|
||||
|
||||
#ifndef JERRY_VLA
|
||||
#define JERRY_VLA(type, name, size) type name[size]
|
||||
#endif /* !JERRY_VLA */
|
||||
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
|
||||
+1
-1
@@ -3081,7 +3081,7 @@ vm_run (const ecma_compiled_code_t *bytecode_header_p, /**< byte-code data heade
|
||||
frame_ctx.call_operation = VM_NO_EXEC_OP;
|
||||
|
||||
/* Use JERRY_MAX() to avoid array declaration with size 0. */
|
||||
ecma_value_t stack[JERRY_MAX (call_stack_size, 1)];
|
||||
JERRY_VLA (ecma_value_t, stack, JERRY_MAX (call_stack_size, 1));
|
||||
frame_ctx.registers_p = stack;
|
||||
|
||||
return vm_execute (&frame_ctx, arg_list_p, arg_list_len);
|
||||
|
||||
Reference in New Issue
Block a user