Commit 9334fd5
committed
Reduce the usage of strlen
* Improve jerry_string_sz only accept UTF-8 string(that's a rare case accept CESU-8 in c/cpp code)
* The document about jerry_string_sz only support ASCII(the fact is CESU-8 before this MR), update it to support UTF-8 after this MR
* Improve all _sz function to take jerry_value_t that can construct from `jerry_string_sz`
* Improve JERRY_ZSTR_ARG can only accept string literal(that's UTF-8)
* Add function jerry_value_list_free to free a list of jerry_value_t
* All call to jerry_string/jerry_string_cesu8 in core indeed are removed, so when there is no linkage to it, code size is saved
The prototype of new/improved function/macros is:
```c
jerry_value_t jerry_string_cesu8 (const jerry_char_t *buffer_p, jerry_size_t buffer_size);
jerry_value_t jerry_string_utf8 (const jerry_char_t *buffer_p, jerry_size_t buffer_size);
#define jerry_string_sz(str) jerry_string_utf8 (JERRY_ZSTR_ARG (str))
jerry_value_t jerry_error_sz (jerry_error_t error_type, const jerry_value_t message_sz);
jerry_value_t jerry_regexp_sz (const jerry_value_t pattern_sz, uint16_t flags);
jerry_value_t jerry_object_delete_sz (const jerry_value_t object, const jerry_value_t key_sz);
jerry_value_t jerry_object_get_sz (const jerry_value_t object, const jerry_value_t key_sz);
jerry_value_t jerry_object_has_sz (const jerry_value_t object, const jerry_value_t key_sz);
jerry_value_t jerry_object_set_sz (jerry_value_t object, const jerry_value_t key_sz, const jerry_value_t value);
```
Rename jerry_port_log to jerry_port_log_buffer
Add buffer_size parameter for function jerry_port_log_buffer, so that jerry_port_log_buffer
won't need calculate strlen when printing
JerryScript-DCO-1.0-Signed-off-by: Yonggang Luo [email protected]1 parent c509a06 commit 9334fd5
File tree
94 files changed
+758
-781
lines changed- docs
- jerry-core
- api
- debugger
- ecma
- base
- builtin-objects
- operations
- include
- jrt
- lit
- jerry-ext
- arg
- common
- debugger
- include/jerryscript-ext
- module
- util
- jerry-main
- benchmark
- jerry-port/common
- targets
- baremetal-sdk/espressif/main
- os
- mbedos
- nuttx
- riot/source
- zephyr/src
- tests
- unit-core
- unit-ext
- module
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
94 files changed
+758
-781
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
155 | 155 | | |
156 | 156 | | |
157 | 157 | | |
158 | | - | |
| 158 | + | |
159 | 159 | | |
160 | 160 | | |
161 | 161 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
751 | 751 | | |
752 | 752 | | |
753 | 753 | | |
754 | | - | |
755 | 754 | | |
756 | 755 | | |
757 | 756 | | |
| |||
809 | 808 | | |
810 | 809 | | |
811 | 810 | | |
812 | | - | |
813 | 811 | | |
814 | 812 | | |
815 | 813 | | |
| |||
3750 | 3748 | | |
3751 | 3749 | | |
3752 | 3750 | | |
3753 | | - | |
| 3751 | + | |
3754 | 3752 | | |
3755 | 3753 | | |
3756 | 3754 | | |
| |||
3868 | 3866 | | |
3869 | 3867 | | |
3870 | 3868 | | |
3871 | | - | |
| 3869 | + | |
3872 | 3870 | | |
3873 | 3871 | | |
3874 | 3872 | | |
| |||
4062 | 4060 | | |
4063 | 4061 | | |
4064 | 4062 | | |
4065 | | - | |
| 4063 | + | |
4066 | 4064 | | |
4067 | 4065 | | |
4068 | 4066 | | |
| |||
4353 | 4351 | | |
4354 | 4352 | | |
4355 | 4353 | | |
4356 | | - | |
4357 | | - | |
| 4354 | + | |
| 4355 | + | |
4358 | 4356 | | |
4359 | 4357 | | |
4360 | 4358 | | |
| |||
4367 | 4365 | | |
4368 | 4366 | | |
4369 | 4367 | | |
4370 | | - | |
4371 | 4368 | | |
4372 | 4369 | | |
4373 | 4370 | | |
| |||
4381 | 4378 | | |
4382 | 4379 | | |
4383 | 4380 | | |
4384 | | - | |
| 4381 | + | |
4385 | 4382 | | |
4386 | 4383 | | |
4387 | 4384 | | |
| |||
4414 | 4411 | | |
4415 | 4412 | | |
4416 | 4413 | | |
4417 | | - | |
| 4414 | + | |
4418 | 4415 | | |
4419 | | - | |
| 4416 | + | |
4420 | 4417 | | |
4421 | 4418 | | |
4422 | 4419 | | |
| |||
4437 | 4434 | | |
4438 | 4435 | | |
4439 | 4436 | | |
4440 | | - | |
4441 | 4437 | | |
4442 | 4438 | | |
4443 | 4439 | | |
| |||
6948 | 6944 | | |
6949 | 6945 | | |
6950 | 6946 | | |
6951 | | - | |
| 6947 | + | |
| 6948 | + | |
6952 | 6949 | | |
6953 | | - | |
6954 | | - | |
| 6950 | + | |
| 6951 | + | |
| 6952 | + | |
| 6953 | + | |
6955 | 6954 | | |
6956 | 6955 | | |
6957 | 6956 | | |
6958 | 6957 | | |
6959 | 6958 | | |
6960 | | - | |
| 6959 | + | |
6961 | 6960 | | |
6962 | 6961 | | |
6963 | 6962 | | |
6964 | | - | |
| 6963 | + | |
6965 | 6964 | | |
6966 | 6965 | | |
6967 | 6966 | | |
6968 | 6967 | | |
6969 | 6968 | | |
6970 | 6969 | | |
6971 | | - | |
| 6970 | + | |
6972 | 6971 | | |
6973 | 6972 | | |
6974 | 6973 | | |
| |||
7472 | 7471 | | |
7473 | 7472 | | |
7474 | 7473 | | |
7475 | | - | |
| 7474 | + | |
| 7475 | + | |
7476 | 7476 | | |
7477 | 7477 | | |
7478 | 7478 | | |
| |||
7481 | 7481 | | |
7482 | 7482 | | |
7483 | 7483 | | |
7484 | | - | |
| 7484 | + | |
7485 | 7485 | | |
7486 | 7486 | | |
7487 | | - | |
| 7487 | + | |
7488 | 7488 | | |
7489 | 7489 | | |
7490 | 7490 | | |
7491 | 7491 | | |
7492 | 7492 | | |
7493 | 7493 | | |
7494 | | - | |
| 7494 | + | |
7495 | 7495 | | |
7496 | 7496 | | |
7497 | 7497 | | |
| |||
7502 | 7502 | | |
7503 | 7503 | | |
7504 | 7504 | | |
7505 | | - | |
| 7505 | + | |
7506 | 7506 | | |
7507 | 7507 | | |
7508 | 7508 | | |
| |||
7549 | 7549 | | |
7550 | 7550 | | |
7551 | 7551 | | |
7552 | | - | |
7553 | | - | |
7554 | | - | |
7555 | | - | |
7556 | | - | |
7557 | | - | |
7558 | | - | |
7559 | | - | |
7560 | | - | |
7561 | | - | |
7562 | | - | |
7563 | | - | |
7564 | | - | |
7565 | | - | |
7566 | | - | |
7567 | | - | |
7568 | | - | |
7569 | | - | |
7570 | | - | |
7571 | | - | |
7572 | | - | |
7573 | | - | |
7574 | | - | |
7575 | | - | |
7576 | | - | |
7577 | | - | |
7578 | | - | |
7579 | | - | |
7580 | | - | |
7581 | | - | |
7582 | | - | |
7583 | | - | |
7584 | | - | |
7585 | | - | |
7586 | | - | |
7587 | | - | |
7588 | | - | |
7589 | | - | |
7590 | | - | |
7591 | | - | |
7592 | | - | |
7593 | | - | |
7594 | | - | |
7595 | | - | |
7596 | | - | |
7597 | | - | |
7598 | | - | |
7599 | | - | |
7600 | 7552 | | |
7601 | 7553 | | |
7602 | 7554 | | |
| |||
7647 | 7599 | | |
7648 | 7600 | | |
7649 | 7601 | | |
7650 | | - | |
| 7602 | + | |
7651 | 7603 | | |
7652 | 7604 | | |
7653 | 7605 | | |
| |||
7794 | 7746 | | |
7795 | 7747 | | |
7796 | 7748 | | |
7797 | | - | |
| 7749 | + | |
7798 | 7750 | | |
7799 | 7751 | | |
7800 | | - | |
| 7752 | + | |
7801 | 7753 | | |
7802 | 7754 | | |
7803 | 7755 | | |
| |||
7836 | 7788 | | |
7837 | 7789 | | |
7838 | 7790 | | |
7839 | | - | |
| 7791 | + | |
7840 | 7792 | | |
7841 | 7793 | | |
7842 | 7794 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
393 | 393 | | |
394 | 394 | | |
395 | 395 | | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
396 | 400 | | |
| 401 | + | |
| 402 | + | |
397 | 403 | | |
| 404 | + | |
398 | 405 | | |
| 406 | + | |
399 | 407 | | |
400 | 408 | | |
401 | 409 | | |
| |||
407 | 415 | | |
408 | 416 | | |
409 | 417 | | |
410 | | - | |
| 418 | + | |
411 | 419 | | |
412 | 420 | | |
413 | 421 | | |
| |||
470 | 478 | | |
471 | 479 | | |
472 | 480 | | |
473 | | - | |
| 481 | + | |
474 | 482 | | |
475 | 483 | | |
476 | 484 | | |
| |||
729 | 737 | | |
730 | 738 | | |
731 | 739 | | |
732 | | - | |
| 740 | + | |
733 | 741 | | |
734 | 742 | | |
735 | 743 | | |
| |||
808 | 816 | | |
809 | 817 | | |
810 | 818 | | |
811 | | - | |
812 | | - | |
813 | | - | |
814 | | - | |
| 819 | + | |
| 820 | + | |
815 | 821 | | |
816 | 822 | | |
817 | 823 | | |
| |||
821 | 827 | | |
822 | 828 | | |
823 | 829 | | |
824 | | - | |
| 830 | + | |
825 | 831 | | |
826 | 832 | | |
827 | 833 | | |
| |||
831 | 837 | | |
832 | 838 | | |
833 | 839 | | |
834 | | - | |
| 840 | + | |
835 | 841 | | |
836 | 842 | | |
837 | | - | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
838 | 847 | | |
839 | 848 | | |
840 | 849 | | |
| |||
958 | 967 | | |
959 | 968 | | |
960 | 969 | | |
961 | | - | |
| 970 | + | |
962 | 971 | | |
963 | 972 | | |
964 | 973 | | |
| |||
1058 | 1067 | | |
1059 | 1068 | | |
1060 | 1069 | | |
1061 | | - | |
| 1070 | + | |
1062 | 1071 | | |
1063 | 1072 | | |
1064 | 1073 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
112 | 112 | | |
113 | 113 | | |
114 | 114 | | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
115 | 118 | | |
116 | | - | |
| 119 | + | |
117 | 120 | | |
118 | 121 | | |
119 | 122 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
135 | 135 | | |
136 | 136 | | |
137 | 137 | | |
138 | | - | |
| 138 | + | |
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
318 | 318 | | |
319 | 319 | | |
320 | 320 | | |
321 | | - | |
322 | | - | |
323 | | - | |
| 321 | + | |
| 322 | + | |
324 | 323 | | |
325 | 324 | | |
326 | 325 | | |
| |||
0 commit comments