Optimizing ecma_get_pointer/ecma_set_pointer, introducing ecma_set_non_null_pointer. loop_arithmetics_1kk.js benchmark: 3.450 -> 3.025.

This commit is contained in:
Ruben Ayrapetyan
2014-08-08 15:22:05 +04:00
parent 0194e63331
commit 1ab3eaa389
3 changed files with 39 additions and 27 deletions
+16 -2
View File
@@ -32,14 +32,28 @@ extern void* ecma_decompress_pointer(uintptr_t compressed_pointer);
* Get value of pointer from specified compressed pointer field.
*/
#define ecma_get_pointer( field) \
ecma_decompress_pointer( field)
( ( unlikely( field == ECMA_NULL_POINTER ) ) ? NULL : ecma_decompress_pointer( field) )
/**
* Set value of compressed pointer field so that it will correspond
* to specified non_compressed_pointer.
*/
#define ecma_set_pointer( field, non_compressed_pointer) \
(field) = ecma_compress_pointer( non_compressed_pointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1)
do { \
void *__temp_pointer = non_compressed_pointer; \
non_compressed_pointer = __temp_pointer; \
} \
while(0); \
(field) = ( unlikely ( ( non_compressed_pointer ) == NULL ) ? ECMA_NULL_POINTER \
: ecma_compress_pointer( non_compressed_pointer) \
& ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1) )
/**
* Set value of non-null compressed pointer field so that it will correspond
* to specified non_compressed_pointer.
*/
#define ecma_set_non_null_pointer( field, non_compressed_pointer) \
(field) = ( ecma_compress_pointer( non_compressed_pointer) & ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1) )
/* ecma-helpers-value.c */
extern bool ecma_is_value_empty( ecma_value_t value);