Compacting pool header to 8 bytes. Replaced typed pool chunks with fixed-size untyped ones. loop_arithmetics_1kk.js benchmark: 2.98517 -> 2.9443.

This commit is contained in:
Ruben Ayrapetyan
2014-08-08 23:11:02 +04:00
parent 49a809d56f
commit 7b04e9eaeb
14 changed files with 322 additions and 397 deletions
+3 -4
View File
@@ -58,7 +58,7 @@ JERRY_STATIC_ASSERT( sizeof (ecma_completion_value_t) == sizeof(uint32_t) );
ecma_alloc_ ## ecma_type (void) \
{ \
ecma_ ## ecma_type ## _t *p ## ecma_type = (ecma_ ## ecma_type ## _t *) \
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t))); \
mem_pools_alloc(); \
\
if ( likely( p ## ecma_type != NULL ) ) \
{ \
@@ -72,7 +72,7 @@ ecma_alloc_ ## ecma_type (void) \
ecma_gc_run( gen_id ); \
\
p ## ecma_type = (ecma_ ## ecma_type ## _t *) \
mem_pools_alloc( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t))); \
mem_pools_alloc(); \
\
if ( likely( p ## ecma_type != NULL ) ) \
{ \
@@ -88,8 +88,7 @@ ecma_alloc_ ## ecma_type (void) \
#define DEALLOC( ecma_type) void \
ecma_dealloc_ ## ecma_type( ecma_ ## ecma_type ## _t *p ## ecma_type) \
{ \
mem_pools_free( mem_size_to_pool_chunk_type( sizeof(ecma_ ## ecma_type ## _t)), \
(uint8_t*) p ## ecma_type); \
mem_pools_free( (uint8_t*) p ## ecma_type); \
}
/**
+3 -3
View File
@@ -37,12 +37,12 @@
* The offset is shifted right by MEM_ALIGNMENT_LOG.
* Least significant MEM_ALIGNMENT_LOG bits of non-shifted offset are zeroes.
*/
#define ECMA_POINTER_FIELD_WIDTH 14
#define ECMA_POINTER_FIELD_WIDTH MEM_COMPRESSED_POINTER_WIDTH
/**
* The null value for compressed pointers
* The NULL value for compressed pointers
*/
#define ECMA_NULL_POINTER 0
#define ECMA_NULL_POINTER MEM_COMPRESSED_POINTER_NULL
/**
* @}
-36
View File
@@ -26,42 +26,6 @@
#include "ecma-helpers.h"
#include "jerry-libc.h"
/**
* Compress pointer.
*/
uintptr_t
ecma_compress_pointer(void *pointer) /**< pointer to compress */
{
JERRY_ASSERT( pointer != NULL );
uintptr_t int_ptr = (uintptr_t) pointer;
JERRY_ASSERT(int_ptr % MEM_ALIGNMENT == 0);
int_ptr -= mem_get_base_pointer();
int_ptr >>= MEM_ALIGNMENT_LOG;
JERRY_ASSERT((int_ptr & ~((1u << ECMA_POINTER_FIELD_WIDTH) - 1)) == 0);
return int_ptr;
} /* ecma_compress_pointer */
/**
* Decompress pointer.
*/
void*
ecma_decompress_pointer(uintptr_t compressed_pointer) /**< pointer to decompress */
{
JERRY_ASSERT( compressed_pointer != ECMA_NULL_POINTER );
uintptr_t int_ptr = compressed_pointer;
int_ptr <<= MEM_ALIGNMENT_LOG;
int_ptr += mem_get_base_pointer();
return (void*) int_ptr;
} /* ecma_decompress_pointer */
/**
* Create an object with specified prototype object
* (or NULL prototype if there is not prototype for the object)
+4 -6
View File
@@ -24,15 +24,13 @@
#define JERRY_ECMA_HELPERS_H
#include "ecma-globals.h"
extern uintptr_t ecma_compress_pointer(void *pointer);
extern void* ecma_decompress_pointer(uintptr_t compressed_pointer);
#include "mem-allocator.h"
/**
* Get value of pointer from specified compressed pointer field.
*/
#define ecma_get_pointer( field) \
( ( unlikely( field == ECMA_NULL_POINTER ) ) ? NULL : ecma_decompress_pointer( field) )
( ( unlikely( field == ECMA_NULL_POINTER ) ) ? NULL : mem_decompress_pointer( field) )
/**
* Set value of compressed pointer field so that it will correspond
@@ -45,7 +43,7 @@ extern void* ecma_decompress_pointer(uintptr_t compressed_pointer);
} \
while(0); \
(field) = ( unlikely ( ( non_compressed_pointer ) == NULL ) ? ECMA_NULL_POINTER \
: ecma_compress_pointer( non_compressed_pointer) \
: mem_compress_pointer( non_compressed_pointer) \
& ( ( 1u << ECMA_POINTER_FIELD_WIDTH ) - 1) )
/**
@@ -53,7 +51,7 @@ extern void* ecma_decompress_pointer(uintptr_t compressed_pointer);
* 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) )
(field) = ( mem_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);