Skip to content

Commit 6e687fa

Browse files
committed
Remove support for per-instruction memory statistics
The new CBC interpreter does not support it anymore, thus removing related code. (As a side-effect, `jerry_flag_t` has been refactored from `uint32_t` and associated defines to an enum.) JerryScript-DCO-1.0-Signed-off-by: Akos Kiss [email protected]
1 parent 6f536c7 commit 6e687fa

File tree

6 files changed

+19
-36
lines changed

6 files changed

+19
-36
lines changed

jerry-core/jerry.c

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1619,16 +1619,14 @@ jerry_init (jerry_flag_t flags) /**< combination of Jerry flags */
16191619
#endif /* !JERRY_ENABLE_LOG */
16201620
}
16211621

1622-
if (flags & (JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_PER_OPCODE | JERRY_FLAG_MEM_STATS_SEPARATE))
1622+
if (flags & (JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_SEPARATE))
16231623
{
16241624
#ifndef MEM_STATS
1625-
flags &= ~(JERRY_FLAG_MEM_STATS
1626-
| JERRY_FLAG_MEM_STATS_PER_OPCODE
1627-
| JERRY_FLAG_MEM_STATS_SEPARATE);
1625+
flags &= (jerry_flag_t) ~(JERRY_FLAG_MEM_STATS | JERRY_FLAG_MEM_STATS_SEPARATE);
16281626

16291627
JERRY_WARNING_MSG ("Ignoring memory statistics option because of '!MEM_STATS' build configuration.\n");
16301628
#else /* !MEM_STATS */
1631-
if (flags & (JERRY_FLAG_MEM_STATS_PER_OPCODE | JERRY_FLAG_MEM_STATS_SEPARATE))
1629+
if (flags & JERRY_FLAG_MEM_STATS_SEPARATE)
16321630
{
16331631
flags |= JERRY_FLAG_MEM_STATS;
16341632
}
@@ -1735,9 +1733,7 @@ jerry_parse (const jerry_api_char_t *source_p, /**< script source */
17351733
}
17361734
#endif /* MEM_STATS */
17371735

1738-
bool is_show_mem_stats_per_instruction = ((jerry_flags & JERRY_FLAG_MEM_STATS_PER_OPCODE) != 0);
1739-
1740-
vm_init (bytecode_data_p, is_show_mem_stats_per_instruction);
1736+
vm_init (bytecode_data_p);
17411737

17421738
return true;
17431739
} /* jerry_parse */
@@ -2370,7 +2366,7 @@ jerry_exec_snapshot (const void *snapshot_p, /**< snapshot */
23702366

23712367
if (header_p->is_run_global)
23722368
{
2373-
vm_init (bytecode_p, false);
2369+
vm_init (bytecode_p);
23742370

23752371
ecma_object_t *error_obj_p = NULL;
23762372

jerry-core/jerry.h

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,20 @@ extern "C"
3232
* @{
3333
*/
3434

35-
#define JERRY_FLAG_EMPTY (0u) /**< empty flag set */
36-
#define JERRY_FLAG_SHOW_OPCODES (1u << 0) /**< dump byte-code to stdout after parse */
37-
#define JERRY_FLAG_MEM_STATS (1u << 1) /**< dump memory statistics */
38-
#define JERRY_FLAG_MEM_STATS_PER_OPCODE (1u << 2) /**< dump per-instruction memory statistics during execution
39-
* (in the mode full GC is performed after execution of each
40-
* opcode handler) */
41-
#define JERRY_FLAG_MEM_STATS_SEPARATE (1u << 3) /**< dump memory statistics and reset peak values after parse */
42-
#define JERRY_FLAG_PARSE_ONLY (1u << 4) /**< parse only, prevents script execution (only for testing)
43-
* FIXME: Remove. */
44-
#define JERRY_FLAG_ENABLE_LOG (1u << 5) /**< enable logging */
45-
#define JERRY_FLAG_ABORT_ON_FAIL (1u << 6) /**< abort instead of exit in case of failure */
46-
4735
/**
4836
* Jerry flags
4937
*/
50-
typedef uint32_t jerry_flag_t;
38+
typedef enum
39+
{
40+
JERRY_FLAG_EMPTY = (0u), /**< empty flag set */
41+
JERRY_FLAG_SHOW_OPCODES = (1u << 0), /**< dump byte-code to stdout after parse */
42+
JERRY_FLAG_MEM_STATS = (1u << 1), /**< dump memory statistics */
43+
JERRY_FLAG_MEM_STATS_SEPARATE = (1u << 2), /**< dump memory statistics and reset peak values after parse */
44+
JERRY_FLAG_PARSE_ONLY = (1u << 3), /**< parse only, prevents script execution (only for testing)
45+
* FIXME: Remove. */
46+
JERRY_FLAG_ENABLE_LOG = (1u << 4), /**< enable logging */
47+
JERRY_FLAG_ABORT_ON_FAIL = (1u << 5), /**< abort instead of exit in case of failure */
48+
} jerry_flag_t;
5149

5250
/**
5351
* Error codes

jerry-core/vm/vm.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,11 +141,8 @@ vm_op_set_value (ecma_value_t object, /**< base object */
141141
* Initialize interpreter.
142142
*/
143143
void
144-
vm_init (ecma_compiled_code_t *program_p, /**< pointer to byte-code data */
145-
bool dump_mem_stats) /**< dump per-instruction memory usage change statistics */
144+
vm_init (ecma_compiled_code_t *program_p) /**< pointer to byte-code data */
146145
{
147-
JERRY_ASSERT (!dump_mem_stats);
148-
149146
JERRY_ASSERT (__program == NULL);
150147

151148
__program = program_p;

jerry-core/vm/vm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ typedef enum
192192
VM_EXEC_CONSTRUCT, /**< construct a new object */
193193
} vm_call_operation;
194194

195-
extern void vm_init (ecma_compiled_code_t *, bool);
195+
extern void vm_init (ecma_compiled_code_t *);
196196
extern void vm_finalize (void);
197197
extern jerry_completion_code_t vm_run_global (ecma_object_t **);
198198
extern ecma_value_t vm_run_eval (ecma_compiled_code_t *, bool);

main-unix.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright 2014-2015 Samsung Electronics Co., Ltd.
1+
/* Copyright 2014-2016 Samsung Electronics Co., Ltd.
22
*
33
* Licensed under the Apache License, Version 2.0 (the "License");
44
* you may not use this file except in compliance with the License.
@@ -237,10 +237,6 @@ main (int argc,
237237
{
238238
flags |= JERRY_FLAG_MEM_STATS;
239239
}
240-
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
241-
{
242-
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
243-
}
244240
else if (!strcmp ("--mem-stats-separate", argv[i]))
245241
{
246242
flags |= JERRY_FLAG_MEM_STATS_SEPARATE;

targets/nuttx-stm32f4/main-nuttx.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -185,10 +185,6 @@ int jerryscript_entry (int argc, char *argv[])
185185
{
186186
flags |= JERRY_FLAG_MEM_STATS;
187187
}
188-
else if (!strcmp ("--mem-stats-per-opcode", argv[i]))
189-
{
190-
flags |= JERRY_FLAG_MEM_STATS_PER_OPCODE;
191-
}
192188
else if (!strcmp ("--mem-stats-separate", argv[i]))
193189
{
194190
flags |= JERRY_FLAG_MEM_STATS_SEPARATE;

0 commit comments

Comments
 (0)