Enable pretty-printer only on host and debug

This commit is contained in:
Ilmir Usmanov
2014-10-14 15:05:48 +04:00
parent 053cbc769f
commit 64e286f766
5 changed files with 28 additions and 0 deletions
+3
View File
@@ -13,6 +13,8 @@
* limitations under the License.
*/
#include "globals.h"
#ifdef JERRY_ENABLE_PP
#include "pretty-printer.h"
#include "jerry-libc.h"
#include "lexer.h"
@@ -646,3 +648,4 @@ pp_opcode (opcode_counter_t oc, opcode_t opcode, bool is_rewrite)
__printf ("\n");
}
#endif /* JERRY_ENABLE_PP */
+3
View File
@@ -16,11 +16,14 @@
#ifndef PRETTY_PRINTER
#define PRETTY_PRINTER
#include "globals.h"
#ifdef JERRY_ENABLE_PP
#include "interpreter.h"
#include "lp-string.h"
void pp_opcode (opcode_counter_t, opcode_t, bool);
void pp_strings (const lp_string *, uint8_t);
void pp_nums (const ecma_number_t *, uint8_t, uint8_t);
#endif // JERRY_ENABLE_PP
#endif // PRETTY_PRINTER
+10
View File
@@ -13,6 +13,7 @@
* limitations under the License.
*/
#include "globals.h"
#include "serializer.h"
#include "parser.h"
#include "jerry-libc.h"
@@ -39,10 +40,13 @@ void
serializer_dump_strings_and_nums (const lp_string strings[], uint8_t strs_count,
const ecma_number_t nums[], uint8_t nums_count)
{
#ifdef JERRY_ENABLE_PP
if (print_opcodes)
{
pp_strings (strings, strs_count);
pp_nums (nums, nums_count, strs_count);
}
#endif
bytecode_data.strs_count = strs_count;
bytecode_data.nums_count = nums_count;
@@ -55,10 +59,12 @@ serializer_dump_opcode (opcode_t opcode)
{
JERRY_ASSERT (scopes_tree_opcodes_num (current_scope) < MAX_OPCODES);
#ifdef JERRY_ENABLE_PP
if (print_opcodes)
{
pp_opcode (scopes_tree_opcodes_num (current_scope), opcode, false);
}
#endif
scopes_tree_add_opcode (current_scope, opcode);
}
@@ -74,15 +80,18 @@ serializer_rewrite_opcode (const opcode_counter_t loc, opcode_t opcode)
{
scopes_tree_set_opcode (current_scope, loc, opcode);
#ifdef JERRY_ENABLE_PP
if (print_opcodes)
{
pp_opcode (loc, opcode, true);
}
#endif
}
void
serializer_print_opcodes (void)
{
#ifdef JERRY_ENABLE_PP
opcode_counter_t loc;
if (!print_opcodes)
@@ -96,6 +105,7 @@ serializer_print_opcodes (void)
{
pp_opcode (loc, bytecode_data.opcodes[loc], false);
}
#endif
}
/* Make lp_strings also zero-terminated. */