-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjerryscript.patch
More file actions
249 lines (227 loc) · 9.27 KB
/
Copy pathjerryscript.patch
File metadata and controls
249 lines (227 loc) · 9.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c
index 8f241b6a..2734b2c5 100644
--- a/jerry-core/parser/js/js-parser.c
+++ b/jerry-core/parser/js/js-parser.c
@@ -3360,12 +3360,8 @@ parser_parse_script (void *source_p, /**< source code */
return bytecode_p;
#else /* !JERRY_PARSER */
- JERRY_UNUSED (arg_list_p);
- JERRY_UNUSED (arg_list_size);
JERRY_UNUSED (source_p);
- JERRY_UNUSED (source_size);
JERRY_UNUSED (parse_opts);
- JERRY_UNUSED (source_name);
ecma_raise_syntax_error (ECMA_ERR_PARSER_NOT_SUPPORTED);
return NULL;
diff --git a/jerry-core/ecma/base/ecma-helpers.c b/jerry-core/ecma/base/ecma-helpers.c
index c51be10d..151ec37a 100644
--- a/jerry-core/ecma/base/ecma-helpers.c
+++ b/jerry-core/ecma/base/ecma-helpers.c
@@ -1616,11 +1616,13 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
+#if JERRY_PARSER
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)
{
bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
break;
}
+#endif
#if JERRY_MODULE_SYSTEM
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_MODULE)
diff --git a/jerry-core/api/jerryscript.c b/jerry-core/api/jerryscript.c
index d8174b92..1ceb0373 100644
--- a/jerry-core/api/jerryscript.c
+++ b/jerry-core/api/jerryscript.c
@@ -534,10 +534,12 @@ jerry_run (const jerry_value_t script) /**< script or module to run */
ecma_object_t *object_p = ecma_get_object_from_value (script);
+#if JERRY_PARSER
if (!ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_SCRIPT))
{
return jerry_throw_sz (JERRY_ERROR_TYPE, ecma_get_error_msg (ECMA_ERR_WRONG_ARGS_MSG));
}
+#endif
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
diff --git a/jerry-core/jmem/jmem-heap.c b/jerry-core/jmem/jmem-heap.c
index b7e60849..c3177506 100644
--- a/jerry-core/jmem/jmem-heap.c
+++ b/jerry-core/jmem/jmem-heap.c
@@ -744,6 +744,7 @@ jmem_heap_get_stats (jmem_heap_stats_t *out_heap_stats_p) /**< [out] heap stats
void
jmem_heap_stats_print (void)
{
+#if 0
jmem_heap_stats_t *heap_stats = &JERRY_CONTEXT (jmem_heap_stats);
JERRY_DEBUG_MSG ("Heap stats:\n");
@@ -762,6 +763,7 @@ jmem_heap_stats_print (void)
JERRY_DEBUG_MSG (" Peak allocated object data = %u bytes\n", (unsigned) heap_stats->peak_object_bytes);
JERRY_DEBUG_MSG (" Allocated property data = %u bytes\n", (unsigned) heap_stats->property_bytes);
JERRY_DEBUG_MSG (" Peak allocated property data = %u bytes\n", (unsigned) heap_stats->peak_property_bytes);
+#endif
} /* jmem_heap_stats_print */
/**
diff --git a/jerry-core/jrt/jrt.h b/jerry-core/jrt/jrt.h
index 2c1f308d..8a760809 100644
--- a/jerry-core/jrt/jrt.h
+++ b/jerry-core/jrt/jrt.h
@@ -25,6 +25,12 @@
#include "config.h"
#include "jrt-types.h"
+#ifdef SMING_ARCH
+#include <FakePgmSpace.h>
+#else
+#define _F(x) x
+#endif
+
/*
* Constants
*/
@@ -79,14 +85,14 @@ void JERRY_ATTR_NORETURN jerry_unreachable (const char *file, const char *functi
{ \
if (JERRY_UNLIKELY (!(x))) \
{ \
- jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \
+ jerry_assert_fail (_F(#x), _F(__FILE__), __func__, __LINE__); \
} \
} while (0)
#define JERRY_UNREACHABLE() \
do \
{ \
- jerry_unreachable (__FILE__, __func__, __LINE__); \
+ jerry_unreachable (_F(__FILE__), __func__, __LINE__); \
} while (0)
#else /* JERRY_NDEBUG */
#define JERRY_ASSERT(x) \
@@ -124,10 +130,10 @@ void jerry_jrt_set_log_level (jerry_log_level_t level);
* Logging
*/
#if JERRY_LOGGING
-#define JERRY_ERROR_MSG(...) jerry_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
-#define JERRY_WARNING_MSG(...) jerry_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define JERRY_DEBUG_MSG(...) jerry_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#define JERRY_TRACE_MSG(...) jerry_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
+#define JERRY_ERROR_MSG(fmt, ...) jerry_log (JERRY_LOG_LEVEL_ERROR, _F(fmt), ##__VA_ARGS__)
+#define JERRY_WARNING_MSG(fmt, ...) jerry_log (JERRY_LOG_LEVEL_WARNING, _F(fmt), ##__VA_ARGS__)
+#define JERRY_DEBUG_MSG(fmt, ...) jerry_log (JERRY_LOG_LEVEL_DEBUG, _F(fmt), ##__VA_ARGS__)
+#define JERRY_TRACE_MSG(fmt, ...) jerry_log (JERRY_LOG_LEVEL_TRACE, _F(fmt), ##__VA_ARGS__)
#else /* !JERRY_LOGGING */
#define JERRY_ERROR_MSG(...) \
do \
diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c
index b6e1e88f..2ab657fe 100644
--- a/jerry-core/vm/vm.c
+++ b/jerry-core/vm/vm.c
@@ -41,6 +41,12 @@
#include "opcodes.h"
#include "vm-stack.h"
+#ifdef SMING_ARCH
+#include <jerry_port_vm.h>
+#else
+#define jerry_port_watchdog_poll() true
+#endif
+
/** \addtogroup vm Virtual machine
* @{
*
@@ -1018,7 +1024,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
while (true)
{
/* Internal loop for byte code execution. */
- while (true)
+ while (jerry_port_watchdog_poll())
{
const uint8_t *byte_code_start_p = byte_code_p;
uint8_t opcode = *byte_code_p++;
diff --git a/jerry-core/include/jerryscript-port.h b/jerry-core/include/jerryscript-port.h
index e3187371..c522ec04 100644
--- a/jerry-core/include/jerryscript-port.h
+++ b/jerry-core/include/jerryscript-port.h
@@ -46,7 +46,8 @@ typedef enum
JERRY_FATAL_REF_COUNT_LIMIT = 12, /**< Reference count limit reached */
JERRY_FATAL_DISABLED_BYTE_CODE = 13, /**< Executed disabled instruction */
JERRY_FATAL_UNTERMINATED_GC_LOOPS = 14, /**< Garbage collection loop limit reached */
- JERRY_FATAL_FAILED_ASSERTION = 120 /**< Assertion failed */
+ JERRY_FATAL_FAILED_ASSERTION = 120, /**< Assertion failed */
+ JERRY_FATAL_WATCHDOG_TIMEOUT = 150, /**< Custom Sming code */
} jerry_fatal_code_t;
/**
diff --git a/jerry-core/jrt/jrt-fatals.c b/jerry-core/jrt/jrt-fatals.c
index c2e09488..53e5e3fc 100644
--- a/jerry-core/jrt/jrt-fatals.c
+++ b/jerry-core/jrt/jrt-fatals.c
@@ -29,7 +29,7 @@
void JERRY_ATTR_NORETURN
jerry_fatal (jerry_fatal_code_t code) /**< status code */
{
-#ifndef JERRY_NDEBUG
+#if 0
switch (code)
{
case JERRY_FATAL_OUT_OF_MEMORY:
diff --git a/.gitignore b/.gitignore
index 3bb753c2..473e03e4 100644
--- a/.gitignore
+++ b/.gitignore
@@ -39,3 +39,4 @@ docs/doxygen
# Tests
tests/test262/
.vs
+out/
diff --git a/jerry-port/win/jerry-port-win-process.c b/jerry-port/win/jerry-port-win-process.c
index c567da8a..40f88d24 100644
--- a/jerry-port/win/jerry-port-win-process.c
+++ b/jerry-port/win/jerry-port-win-process.c
@@ -18,7 +18,7 @@
#include <windows.h>
-#include <crtdbg.h>
+// #include <crtdbg.h>
#include <stdio.h>
void
@@ -71,12 +71,12 @@ jerry_port_init (void)
* This is C runtime specific and thus the above incantations aren't
* sufficient to suppress these popups.
*/
- _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
- _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
- _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
- _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
+ // _CrtSetReportMode (_CRT_ERROR, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ // _CrtSetReportFile (_CRT_ERROR, _CRTDBG_FILE_STDERR);
+ // _CrtSetReportMode (_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ // _CrtSetReportFile (_CRT_ASSERT, _CRTDBG_FILE_STDERR);
+ // _CrtSetReportMode (_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
+ // _CrtSetReportFile (_CRT_WARN, _CRTDBG_FILE_STDERR);
}
} /* jerry_port_init */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
index db90bc93..8810bf0c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
@@ -175,8 +175,8 @@ typedef enum
} ecma_date_timezone_t;
/* ecma-builtin-helpers-date.c */
-extern const char day_names_p[7][3];
-extern const char month_names_p[12][3];
+extern const char day_names_p[7][4];
+extern const char month_names_p[12][4];
int32_t ecma_date_day_from_time (ecma_number_t time);
int32_t ecma_date_year_from_time (ecma_number_t time);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
index 280a94c4..fd5233b5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
@@ -36,12 +36,12 @@
/**
* Day names
*/
-const char day_names_p[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
+const char day_names_p[7][4] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
/**
* Month names
*/
-const char month_names_p[12][3] = {
+const char month_names_p[12][4] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};