Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add literal storage, literal_t type and functions for its processing.
JerryScript-DCO-1.0-Signed-off-by: Evgeny Gavrin [email protected]
JerryScript-DCO-1.0-Signed-off-by: Andrey Shitov [email protected]
  • Loading branch information
sand1k committed Jun 10, 2015
commit 340a9ef002e41419c252d359fd7bf56847301a36
3 changes: 3 additions & 0 deletions jerry-core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ project (JerryCore CXX C ASM)
# Include directories
set(INCLUDE_CORE
${CMAKE_SOURCE_DIR}/jerry-core
${CMAKE_SOURCE_DIR}/jerry-core/lit
${CMAKE_SOURCE_DIR}/jerry-core/rcs
${CMAKE_SOURCE_DIR}/jerry-core/mem
${CMAKE_SOURCE_DIR}/jerry-core/vm
Expand All @@ -110,6 +111,7 @@ project (JerryCore CXX C ASM)
# Sources
# Jerry core
file(GLOB SOURCE_CORE_API *.cpp)
file(GLOB SOURCE_CORE_LIT lit/*.cpp)
file(GLOB SOURCE_CORE_RCS rcs/*.cpp)
file(GLOB SOURCE_CORE_MEM mem/*.cpp)
file(GLOB SOURCE_CORE_VM vm/*.cpp)
Expand All @@ -123,6 +125,7 @@ project (JerryCore CXX C ASM)
set(SOURCE_CORE
jerry.cpp
${SOURCE_CORE_API}
${SOURCE_CORE_LIT}
${SOURCE_CORE_RCS}
${SOURCE_CORE_MEM}
${SOURCE_CORE_VM}
Expand Down
10 changes: 10 additions & 0 deletions jerry-core/ecma/base/ecma-globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "config.h"
#include "jrt.h"
#include "mem-allocator.h"
#include "rcs-recordset.h"

/** \addtogroup compressedpointer Compressed pointer
* @{
Expand Down Expand Up @@ -757,11 +758,20 @@ typedef enum
} ecma_string_container_t;

FIXME (Move to library that should define the type (literal.h /* ? */))
/**
* Literal and compressed pointer to literal
*/
typedef rcs_record_t *literal_t;
typedef rcs_cpointer_t lit_cpointer_t;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we move this to lit-literal.h?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan I suppose we should, but ecma-globals.h has dependencies on lit_cpointer_t, while lit_* depends on ecma_globals.h

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@egavrin, I see. In the case, probably we should update the 'FIXME' comment above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ruben-ayrapetyan we may leave it as is, since we're going to fix anyway. But with a separate pr.


/**
* Index in literal table
*
* FIXME: Remove after switching to literal storage
*/
typedef uint32_t literal_index_t;


/**
* Identifiers of ECMA and implementation-defined magic string constants
*/
Expand Down
12 changes: 12 additions & 0 deletions jerry-core/jrt/jrt.h
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,16 @@ extern void __noreturn jerry_fatal (jerry_fatal_code_t code);
#define JERRY_MIN(v1, v2) ((v1 < v2) ? v1 : v2)
#define JERRY_MAX(v1, v2) ((v1 < v2) ? v2 : v1)

/**
* Placement new operator (constructs an object on a pre-allocated buffer)
*
* Our version of the libc library doesn't support calling the constructors and destructors of the static variables.
* It is proposed to use placement new operator. Generally it is available via #include <new>,
* To fix the unavailability of the header in some configurations placement new operator is implemented here.
*/
inline void* operator new (size_t, void* where)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, add comment to the code with proper explanation.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

{
return where;
} /* operator new */

#endif /* !JERRY_GLOBALS_H */
Loading