Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Jerryscript
提交
29f6ffc3
T
Third Party Jerryscript
项目概览
OpenHarmony
/
Third Party Jerryscript
9 个月 前同步成功
通知
5
Star
19
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Jerryscript
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
29f6ffc3
编写于
8月 08, 2018
作者:
A
Akos Kiss
提交者:
yichoi
8月 08, 2018
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Make logging an optional feature and disable it by default (#2449)
JerryScript-DCO-1.0-Signed-off-by: Akos Kiss akiss@inf.u-szeged.hu
上级
58c568a6
变更
10
隐藏空白更改
内联
并排
Showing
10 changed file
with
59 addition
and
6 deletion
+59
-6
docs/02.API-REFERENCE.md
docs/02.API-REFERENCE.md
+1
-0
docs/05.PORT-API.md
docs/05.PORT-API.md
+5
-0
jerry-core/CMakeLists.txt
jerry-core/CMakeLists.txt
+13
-0
jerry-core/api/jerry.c
jerry-core/api/jerry.c
+3
-0
jerry-core/include/jerryscript-core.h
jerry-core/include/jerryscript-core.h
+1
-0
jerry-core/include/jerryscript-port.h
jerry-core/include/jerryscript-port.h
+5
-0
jerry-core/jrt/jrt.h
jerry-core/jrt/jrt.h
+20
-0
jerry-core/parser/js/js-parser.c
jerry-core/parser/js/js-parser.c
+6
-6
tools/build.py
tools/build.py
+3
-0
tools/run-tests.py
tools/run-tests.py
+2
-0
未找到文件。
docs/02.API-REFERENCE.md
浏览文件 @
29f6ffc3
...
...
@@ -60,6 +60,7 @@ Possible compile time enabled feature types:
-
JERRY_FEATURE_DATE - Date support
-
JERRY_FEATURE_REGEXP - RegExp support
-
JERRY_FEATURE_LINE_INFO - line info available
-
JERRY_FEATURE_LOGGING - logging
## jerry_parse_opts_t
...
...
docs/05.PORT-API.md
浏览文件 @
29f6ffc3
...
...
@@ -63,6 +63,11 @@ typedef enum
*
* Example: a libc-based port may implement this with vfprintf(stderr) or
* vfprintf(logfile), or both, depending on log level.
*
* Note:
* This port function is called by jerry-core when JERRY_ENABLE_LOGGING is
* defined. It is also common practice though to use this function in
* application code.
*/
void
jerry_port_log
(
jerry_log_level_t
level
,
const
char
*
fmt
,
...);
```
...
...
jerry-core/CMakeLists.txt
浏览文件 @
29f6ffc3
...
...
@@ -26,6 +26,7 @@ set(FEATURE_ERROR_MESSAGES OFF CACHE BOOL "Enable error messages?")
set
(
FEATURE_EXTERNAL_CONTEXT OFF CACHE BOOL
"Enable external context?"
)
set
(
FEATURE_JS_PARSER ON CACHE BOOL
"Enable js-parser?"
)
set
(
FEATURE_LINE_INFO OFF CACHE BOOL
"Enable line info?"
)
set
(
FEATURE_LOGGING OFF CACHE BOOL
"Enable logging?"
)
set
(
FEATURE_MEM_STATS OFF CACHE BOOL
"Enable memory statistics?"
)
set
(
FEATURE_MEM_STRESS_TEST OFF CACHE BOOL
"Enable mem-stress test?"
)
set
(
FEATURE_PARSER_DUMP OFF CACHE BOOL
"Enable parser byte-code dumps?"
)
...
...
@@ -66,6 +67,12 @@ if(JERRY_CMDLINE_SNAPSHOT)
set
(
FEATURE_SNAPSHOT_SAVE_MESSAGE
" (FORCED BY SNAPSHOT TOOL)"
)
endif
()
if
(
FEATURE_MEM_STATS OR FEATURE_PARSER_DUMP OR FEATURE_REGEXP_DUMP
)
set
(
FEATURE_LOGGING ON
)
set
(
FEATURE_LOGGING_MESSAGE
" (FORCED BY STATS OR DUMP)"
)
endif
()
# Status messages
message
(
STATUS
"ENABLE_ALL_IN_ONE "
${
ENABLE_ALL_IN_ONE
}
${
ENABLE_ALL_IN_ONE_MESSAGE
}
)
message
(
STATUS
"FEATURE_CPOINTER_32_BIT "
${
FEATURE_CPOINTER_32_BIT
}
${
FEATURE_CPOINTER_32_BIT_MESSAGE
}
)
...
...
@@ -74,6 +81,7 @@ message(STATUS "FEATURE_ERROR_MESSAGES " ${FEATURE_ERROR_MESSAGES})
message
(
STATUS
"FEATURE_EXTERNAL_CONTEXT "
${
FEATURE_EXTERNAL_CONTEXT
}
)
message
(
STATUS
"FEATURE_JS_PARSER "
${
FEATURE_JS_PARSER
}
)
message
(
STATUS
"FEATURE_LINE_INFO "
${
FEATURE_LINE_INFO
}
)
message
(
STATUS
"FEATURE_LOGGING "
${
FEATURE_LOGGING
}
${
FEATURE_LOGGING_MESSAGE
}
)
message
(
STATUS
"FEATURE_MEM_STATS "
${
FEATURE_MEM_STATS
}
)
message
(
STATUS
"FEATURE_MEM_STRESS_TEST "
${
FEATURE_MEM_STRESS_TEST
}
)
message
(
STATUS
"FEATURE_PARSER_DUMP "
${
FEATURE_PARSER_DUMP
}
${
FEATURE_PARSER_DUMP_MESSAGE
}
)
...
...
@@ -187,6 +195,11 @@ if(FEATURE_LINE_INFO)
set
(
DEFINES_JERRY
${
DEFINES_JERRY
}
JERRY_ENABLE_LINE_INFO
)
endif
()
# Logging
if
(
FEATURE_LOGGING
)
set
(
DEFINES_JERRY
${
DEFINES_JERRY
}
JERRY_ENABLE_LOGGING
)
endif
()
# Memory statistics
if
(
FEATURE_MEM_STATS
)
set
(
DEFINES_JERRY
${
DEFINES_JERRY
}
JMEM_STATS
)
...
...
jerry-core/api/jerry.c
浏览文件 @
29f6ffc3
...
...
@@ -883,6 +883,9 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
#ifdef JERRY_ENABLE_LINE_INFO
||
feature
==
JERRY_FEATURE_LINE_INFO
#endif
/* JERRY_ENABLE_LINE_INFO */
#ifdef JERRY_ENABLE_LOGGING
||
feature
==
JERRY_FEATURE_LOGGING
#endif
/* JERRY_ENABLE_LOGGING */
);
}
/* jerry_is_feature_enabled */
...
...
jerry-core/include/jerryscript-core.h
浏览文件 @
29f6ffc3
...
...
@@ -91,6 +91,7 @@ typedef enum
JERRY_FEATURE_DATE
,
/**< Date support */
JERRY_FEATURE_REGEXP
,
/**< Regexp support */
JERRY_FEATURE_LINE_INFO
,
/**< line info available */
JERRY_FEATURE_LOGGING
,
/**< logging */
JERRY_FEATURE__COUNT
/**< number of features. NOTE: must be at the end of the list */
}
jerry_feature_t
;
...
...
jerry-core/include/jerryscript-port.h
浏览文件 @
29f6ffc3
...
...
@@ -97,6 +97,11 @@ typedef enum
*
* Example: a libc-based port may implement this with vfprintf(stderr) or
* vfprintf(logfile), or both, depending on log level.
*
* Note:
* This port function is called by jerry-core when JERRY_ENABLE_LOGGING is
* defined. It is also common practice though to use this function in
* application code.
*/
void
JERRY_ATTR_FORMAT
(
printf
,
2
,
3
)
jerry_port_log
(
jerry_log_level_t
level
,
const
char
*
format
,
...);
...
...
jerry-core/jrt/jrt.h
浏览文件 @
29f6ffc3
...
...
@@ -49,6 +49,19 @@
*/
#define JERRY_UNUSED(x) ((void) (x))
#define JERRY_UNUSED_1(_1) JERRY_UNUSED (_1)
#define JERRY_UNUSED_2(_1, _2) JERRY_UNUSED (_1), JERRY_UNUSED_1 (_2)
#define JERRY_UNUSED_3(_1, _2, _3) JERRY_UNUSED (_1), JERRY_UNUSED_2 (_2, _3)
#define JERRY_UNUSED_4(_1, _2, _3, _4) JERRY_UNUSED (_1), JERRY_UNUSED_3 (_2, _3, _4)
#define JERRY_UNUSED_5(_1, _2, _3, _4, _5) JERRY_UNUSED (_1), JERRY_UNUSED_4 (_2, _3, _4, _5)
#define JERRY_VA_ARGS_NUM_IMPL(_1, _2, _3, _4, _5, N, ...) N
#define JERRY_VA_ARGS_NUM(...) JERRY_VA_ARGS_NUM_IMPL (__VA_ARGS__, 5, 4, 3, 2, 1, 0)
#define JERRY_UNUSED_ALL_IMPL_(nargs) JERRY_UNUSED_ ## nargs
#define JERRY_UNUSED_ALL_IMPL(nargs) JERRY_UNUSED_ALL_IMPL_ (nargs)
#define JERRY_UNUSED_ALL(...) JERRY_UNUSED_ALL_IMPL (JERRY_VA_ARGS_NUM (__VA_ARGS__)) (__VA_ARGS__)
/*
* Asserts
*
...
...
@@ -114,10 +127,17 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
/*
* Logging
*/
#ifdef JERRY_ENABLE_LOGGING
#define JERRY_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
#define JERRY_WARNING_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
#define JERRY_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
#define JERRY_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
#else
/* !JERRY_ENABLE_LOGGING */
#define JERRY_ERROR_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_WARNING_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_DEBUG_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#define JERRY_TRACE_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
#endif
/* JERRY_ENABLE_LOGGING */
/**
* Size of struct member
...
...
jerry-core/parser/js/js-parser.c
浏览文件 @
29f6ffc3
...
...
@@ -2575,9 +2575,9 @@ parser_parse_function (parser_context_t *context_p, /**< context */
if
(
context_p
->
is_show_opcodes
)
{
#ifndef CONFIG_DISABLE_ES2015_CLASS
bool
is_constructor
=
context_p
->
status_flags
&
PARSER_CLASS_CONSTRUCTOR
;
JERRY_DEBUG_MSG
(
is_constructor
?
"
\n
--- Class constructor parsing start ---
\n\n
"
:
"
\n
--- Function parsing start ---
\n\
n
"
);
JERRY_DEBUG_MSG
(
"
\n
--- %s parsing start ---
\n\n
"
,
(
context_p
->
status_flags
&
PARSER_CLASS_CONSTRUCTOR
)
?
"Class constructor
"
:
"Functio
n"
);
#else
/* CONFIG_DISABLE_ES2015_CLASS */
JERRY_DEBUG_MSG
(
"
\n
--- Function parsing start ---
\n\n
"
);
#endif
/* !CONFIG_DISABLE_ES2015_CLASS */
...
...
@@ -2679,9 +2679,9 @@ parser_parse_function (parser_context_t *context_p, /**< context */
if
(
context_p
->
is_show_opcodes
)
{
#ifndef CONFIG_DISABLE_ES2015_CLASS
bool
is_constructor
=
context_p
->
status_flags
&
PARSER_CLASS_CONSTRUCTOR
;
JERRY_DEBUG_MSG
(
is_constructor
?
"
\n
--- Class constructor parsing end ---
\n\n
"
:
"
\n
--- Function parsing end ---
\n\
n
"
);
JERRY_DEBUG_MSG
(
"
\n
--- %s parsing end ---
\n\n
"
,
(
context_p
->
status_flags
&
PARSER_CLASS_CONSTRUCTOR
)
?
"Class constructor
"
:
"Functio
n"
);
#else
/* CONFIG_DISABLE_ES2015_CLASS */
JERRY_DEBUG_MSG
(
"
\n
--- Function parsing end ---
\n\n
"
);
#endif
/* !CONFIG_DISABLE_ES2015_CLASS */
...
...
tools/build.py
浏览文件 @
29f6ffc3
...
...
@@ -116,6 +116,8 @@ def get_arguments():
help
=
'enable js-parser (%(choices)s)'
)
coregrp
.
add_argument
(
'--line-info'
,
metavar
=
'X'
,
choices
=
[
'ON'
,
'OFF'
],
type
=
str
.
upper
,
help
=
'provide line info (%(choices)s)'
)
coregrp
.
add_argument
(
'--logging'
,
metavar
=
'X'
,
choices
=
[
'ON'
,
'OFF'
],
type
=
str
.
upper
,
help
=
'enable logging (%(choices)s)'
)
coregrp
.
add_argument
(
'--mem-heap'
,
metavar
=
'SIZE'
,
type
=
int
,
help
=
'size of memory heap (in kilobytes)'
)
coregrp
.
add_argument
(
'--mem-stats'
,
metavar
=
'X'
,
choices
=
[
'ON'
,
'OFF'
],
type
=
str
.
upper
,
...
...
@@ -189,6 +191,7 @@ def generate_build_options(arguments):
build_options_append
(
'FEATURE_DEBUGGER'
,
arguments
.
jerry_debugger
)
build_options_append
(
'FEATURE_JS_PARSER'
,
arguments
.
js_parser
)
build_options_append
(
'FEATURE_LINE_INFO'
,
arguments
.
line_info
)
build_options_append
(
'FEATURE_LOGGING'
,
arguments
.
logging
)
build_options_append
(
'MEM_HEAP_SIZE_KB'
,
arguments
.
mem_heap
)
build_options_append
(
'FEATURE_MEM_STATS'
,
arguments
.
mem_stats
)
build_options_append
(
'FEATURE_MEM_STRESS_TEST'
,
arguments
.
mem_stress_test
)
...
...
tools/run-tests.py
浏览文件 @
29f6ffc3
...
...
@@ -120,6 +120,8 @@ JERRY_BUILDOPTIONS = [
[
'--lto=on'
]),
Options
(
'buildoption_test-error_messages'
,
[
'--error-messages=on'
]),
Options
(
'buildoption_test-logging'
,
[
'--logging=on'
]),
Options
(
'buildoption_test-all_in_one'
,
[
'--all-in-one=on'
]),
Options
(
'buildoption_test-valgrind'
,
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录