-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathm_v8.js
35 lines (29 loc) · 851 Bytes
/
m_v8.js
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
// webpack cannot pack this because it contains natives syntax
// the webpack parser (acorn) does not support natives syntax (eg. %IsSmi)
//
// i think it was the natives calls crashing the tab, not browser es modules, ainf
const m_v8_enabled = false;
const m_v8 = {
IsSmi: (x) => {
if (!m_v8_enabled) return true;
if (x != null && x != undefined && typeof(x) == 'number') { // idk, maybe prevents crashes
//return %IsSmi(x);
} else {
return false;
}
},
IsValidSmi: (x) => {
if (!m_v8_enabled) return true;
if (x != null && x != undefined && typeof(x) == 'number') { // idk, maybe prevents crashes
//return %IsValidSmi(x);
} else {
return false;
}
},
//
assert_smi: (x) => {
if (!m_v8_enabled) return true;
console.assert(m_v8.IsSmi(x));
console.assert(m_v8.IsValidSmi(x));
}
};