Skip to content

Commit f31ab3d

Browse files
committed
typo fixes
1 parent 27a2391 commit f31ab3d

7 files changed

Lines changed: 29 additions & 29 deletions

File tree

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ MicroQuickJS
33

44
## Introduction
55

6-
MicroQuickJS (aka. MQuickJS) is a JavaScript engine targetted at
6+
MicroQuickJS (aka. MQuickJS) is a JavaScript engine targeted at
77
embedded systems. It compiles and runs JavaScript programs using as little
88
as 10 kB of RAM. The whole engine requires about 100 kB of ROM (ARM
99
Thumb-2 code) including the C library. The speed is comparable to
@@ -269,7 +269,7 @@ case, it must be relocated before being flashed into ROM (see
269269
`JS_LoadBytecode()` and run as normal script with `JS_Run()` (see
270270
`mqjs.c`).
271271

272-
As with QuickJS, no backward compatibility is garanteed at the
272+
As with QuickJS, no backward compatibility is guaranteed at the
273273
bytecode level. Moreover, the bytecode is not verified before being
274274
executed. Only run JavaScript bytecode from trusted sources.
275275

@@ -358,7 +358,7 @@ Running the QuickJS micro benchmark:
358358
make microbench
359359
``
360360

361-
Addtional tests and a patched version of the Octane benchmark running
361+
Additional tests and a patched version of the Octane benchmark running
362362
in stricter mode can be downloaded
363363
[here](https://bellard.org/mquickjs/mquickjs-extras.tar.xz):
364364

dtoa.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,14 +1184,14 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
11841184
if (fmt == JS_DTOA_FORMAT_FREE) {
11851185
int P_max, E0, e1, E_found, P_found;
11861186
uint64_t m1, mant_found, mant, mant_max1;
1187-
/* P_max is guarranteed to work by construction */
1187+
/* P_max is guaranteed to work by construction */
11881188
P_max = dtoa_max_digits_table[radix - 2];
11891189
E0 = E;
11901190
E_found = 0;
11911191
P_found = 0;
11921192
mant_found = 0;
11931193
/* find the minimum number of digits by successive tries */
1194-
P = P_max; /* P_max is guarateed to work */
1194+
P = P_max; /* P_max is guaranteed to work */
11951195
for(;;) {
11961196
/* mant_max always fits on 64 bits */
11971197
mant_max1 = pow_ui(radix, P);
@@ -1210,7 +1210,7 @@ int js_dtoa(char *buf, double d, int radix, int n_digits, int flags,
12101210
mant /= radix;
12111211
P--;
12121212
}
1213-
/* garanteed to work for P = P_max */
1213+
/* guaranteed to work for P = P_max */
12141214
if (P_found == 0)
12151215
goto prec_found;
12161216
/* convert back to base 2 */

libm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ double js_scalbn(double x, int n)
484484
* If (2) is false, then q = q ; otherwise q = q + 2 .
485485
* i+1 i i+1 i
486486
*
487-
* With some algebric manipulation, it is not difficult to see
487+
* With some algebraic manipulation, it is not difficult to see
488488
* that (2) is equivalent to
489489
* -(i+1)
490490
* s + 2 <= y (3)
@@ -1937,7 +1937,7 @@ double js_exp(double x)
19371937
* 1. Compute and return log2(x) in two pieces:
19381938
* log2(x) = w1 + w2,
19391939
* where w1 has 53-24 = 29 bit trailing zeros.
1940-
* 2. Perform y*log2(x) = n+y' by simulating muti-precision
1940+
* 2. Perform y*log2(x) = n+y' by simulating multi-precision
19411941
* arithmetic, where |y'|<=0.5.
19421942
* 3. Return x**y = 2**n*exp(y'*log2)
19431943
*
@@ -2086,7 +2086,7 @@ static double js_log_internal(double x, int flag)
20862086
} else {
20872087
t = zero_low(t);
20882088
if (flag == 1) {
2089-
/* mutiply (p_l+p_h) by lg2 */
2089+
/* multiply (p_l+p_h) by lg2 */
20902090
u = t*lg2_h;
20912091
v = (p_l-(t-p_h))*lg2+t*lg2_l;
20922092
} else {
@@ -2249,7 +2249,7 @@ double js_pow(double x, double y)
22492249
if(j<0) n = -n;
22502250
p_h -= t;
22512251
}
2252-
/* mutiply (p_l+p_h) by lg2 */
2252+
/* multiply (p_l+p_h) by lg2 */
22532253
t = zero_low(p_l+p_h);
22542254
u = t*lg2_h;
22552255
v = (p_l-(t-p_h))*lg2+t*lg2_l;

mquickjs.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
/*
3939
TODO:
4040
- regexp: better error position info
41-
- use a specific MTAG for short functions intead of an immediate value
41+
- use a specific MTAG for short functions instead of an immediate value
4242
- use hash table for atoms
4343
- set the length accessors as non configurable so that the
4444
'get_length' instruction optimizations are always safe.
@@ -51,7 +51,7 @@
5151
saved bytecode ?
5252
- reduced memory usage:
5353
- reduce JSFunctionBytecode size (remove source_pos)
54-
- do not explictely store function names for get/set/bound
54+
- do not explicitly store function names for get/set/bound
5555
- use JSSTDLibraryDef fields instead of copying them to JSContext ?
5656
*/
5757

@@ -1583,7 +1583,7 @@ static BOOL is_utf8_right_surrogate(const uint8_t *p)
15831583

15841584
typedef struct {
15851585
JSValue buffer; /* string, JSByteBuffer or JS_EXCEPTION */
1586-
int len; /* currrent string length (in bytes) */
1586+
int len; /* current string length (in bytes) */
15871587
BOOL is_ascii;
15881588
} StringBuffer;
15891589

@@ -3845,7 +3845,7 @@ static uint32_t get_ugolomb(const uint8_t *buf, uint32_t buf_len,
38453845
break;
38463846
i++;
38473847
if (i == 32) {
3848-
/* errror */
3848+
/* error */
38493849
*pindex = index;
38503850
return 0xffffffff;
38513851
}
@@ -5820,7 +5820,7 @@ JSValue JS_Call(JSContext *ctx, int call_flags)
58205820
goto get_field_slow;
58215821
for(;;) {
58225822
/* no array check is necessary because 'prop' is
5823-
guaranted not to be a numeric property */
5823+
guaranteed not to be a numeric property */
58245824
/* XXX: slow due to short ints */
58255825
pr = find_own_property_inlined(ctx, p, prop);
58265826
if (pr) {
@@ -5918,7 +5918,7 @@ JSValue JS_Call(JSContext *ctx, int call_flags)
59185918
if (unlikely(p->mtag != JS_MTAG_OBJECT))
59195919
goto put_field_slow;
59205920
/* no array check is necessary because 'prop' is
5921-
guaranted not to be a numeric property */
5921+
guaranteed not to be a numeric property */
59225922
/* XXX: slow due to short ints */
59235923
pr = find_own_property_inlined(ctx, p, prop);
59245924
if (unlikely(!pr))
@@ -9160,10 +9160,10 @@ static JSValue js_parse_pop_val(JSParseState *s)
91609160
}
91619161

91629162
/* WARNING: local variables are not preserved across PARSE_CALL(). So
9163-
they must be explicitely saved and restored */
9163+
they must be explicitly saved and restored */
91649164
#define PARSE_CALL(s, cur_state, func, param) return (cur_state | (PARSE_FUNC_ ## func << 8) | ((param) << 16)); parse_state ## cur_state : ;
91659165

9166-
/* preserve var1, ... accross the call */
9166+
/* preserve var1, ... across the call */
91679167
#define PARSE_CALL_SAVE1(s, cur_state, func, param, var1) \
91689168
PARSE_PUSH_INT(s, var1); \
91699169
PARSE_CALL(s, cur_state, func, param); \
@@ -11227,13 +11227,13 @@ static void compute_stack_size_push(JSParseState *s,
1122711227
js_printf(s->ctx, "%5d: %d\n", pos, stack_len);
1122811228
#endif
1122911229
if (pos >= (uint32_t)arr->size)
11230-
js_parse_error(s, "bytecode buffer overlow (pc=%d)", pos);
11230+
js_parse_error(s, "bytecode buffer overflow (pc=%d)", pos);
1123111231
/* XXX: could avoid the division */
1123211232
short_stack_len = 1 + ((unsigned)stack_len % 255);
1123311233
if (explore_tab[pos] != 0) {
1123411234
/* already explored: check that the stack size is consistent */
1123511235
if (explore_tab[pos] != short_stack_len) {
11236-
js_parse_error(s, "unconsistent stack size: %d %d (pc=%d)", explore_tab[pos] - 1, short_stack_len - 1, (int)pos);
11236+
js_parse_error(s, "inconsistent stack size: %d %d (pc=%d)", explore_tab[pos] - 1, short_stack_len - 1, (int)pos);
1123711237
}
1123811238
} else {
1123911239
explore_tab[pos] = short_stack_len;
@@ -11291,7 +11291,7 @@ static void compute_stack_size(JSParseState *s, JSValue *pfunc)
1129111291
oi = &opcode_info[op];
1129211292
op_len = oi->size;
1129311293
if ((pos + op_len - 1) > arr->size) {
11294-
js_parse_error(s, "bytecode buffer overlow (pc=%d)", (int)(pos - 1));
11294+
js_parse_error(s, "bytecode buffer overflow (pc=%d)", (int)(pos - 1));
1129511295
}
1129611296
n_pop = oi->n_pop;
1129711297
if (oi->fmt == OP_FMT_npop)
@@ -14797,7 +14797,7 @@ JSValue js_array_sort(JSContext *ctx, JSValue *this_val,
1479714797

1479814798
p = JS_VALUE_TO_PTR(*this_val);
1479914799
arr = JS_VALUE_TO_PTR(p->u.array.tab);
14800-
/* XXX: could resize the array in case it was shrinked by the compare function */
14800+
/* XXX: could resize the array in case it was shrank by the compare function */
1480114801
len = min_int(len, p->u.array.len);
1480214802
for(i = 0; i < len; i++) {
1480314803
arr->arr[i] = tab->arr[2 * i];

mquickjs_build.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,7 @@ static int atom_cmp(const void *p1, const void *p2)
284284
return strcmp(a1->str, a2->str);
285285
}
286286

287-
/* js_atom_table must be propertly aligned because the property hash
287+
/* js_atom_table must be properly aligned because the property hash
288288
table uses the low bits of the atom pointer value */
289289
#define ATOM_ALIGN 64
290290

tests/microbench.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ function string_length(n)
757757
return n * 4;
758758
}
759759

760-
/* incremental string contruction as local var */
760+
/* incremental string construction as local var */
761761
function string_build1(n)
762762
{
763763
var i, j, r;
@@ -770,7 +770,7 @@ function string_build1(n)
770770
return n * 100;
771771
}
772772

773-
/* incremental string contruction as arg */
773+
/* incremental string construction as arg */
774774
function string_build2(n, r)
775775
{
776776
var i, j;
@@ -783,7 +783,7 @@ function string_build2(n, r)
783783
return n * 100;
784784
}
785785

786-
/* incremental string contruction by prepending */
786+
/* incremental string construction by prepending */
787787
function string_build3(n, r)
788788
{
789789
var i, j;
@@ -796,7 +796,7 @@ function string_build3(n, r)
796796
return n * 100;
797797
}
798798

799-
/* incremental string contruction with multiple reference */
799+
/* incremental string construction with multiple reference */
800800
function string_build4(n)
801801
{
802802
var i, j, r, s;

tests/test_loop.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function test_for_in()
9292
}
9393
assert(tab.toString(), "1,x,y,4", "for_in");
9494

95-
/* non enumerable properties hide enumerables ones in the
95+
/* non enumerable properties hide enumerable ones in the
9696
prototype chain */
9797
a = {y: 2, "1": 3};
9898
Object.defineProperty(a, "x", { value: 1 });
@@ -138,7 +138,7 @@ function test_for_in()
138138
}
139139
assert(tab.toString(), "x,y", "for_in");
140140

141-
/* variable assigment in the for in */
141+
/* variable assignment in the for in */
142142
/*
143143
tab = [];
144144
for(var k = 2 in {x:1, y: 2}) {

0 commit comments

Comments
 (0)