MCPcopy Create free account
hub / github.com/emscripten-core/emscripten / asanify

Function asanify

tools/acorn-optimizer.mjs:1251–1281  ·  view source on GitHub ↗
(ast)

Source from the content-addressed store, hash-verified

1249// Add ASan check to direct HEAP* loads/stores.
1250// That lets ASan cover JS too.
1251function asanify(ast) {
1252 recursiveWalk(ast, {
1253 FunctionDeclaration(node, c) {
1254 if (node.id.type === 'Identifier' && node.id.name === 'establishStackSpace') {
1255 // skip establishStackSpace, because it sets up variables used by ASan itself
1256 } else {
1257 c(node.body);
1258 }
1259 },
1260 AssignmentExpression(node, c) {
1261 const target = node.left;
1262 const value = node.right;
1263 c(value);
1264 if (isHEAPAccess(target)) {
1265 // Instrument a store.
1266 asanifyTransform(target, '___asan_storeN');
1267 } else {
1268 c(target);
1269 }
1270 },
1271 MemberExpression(node, c) {
1272 c(node.property);
1273 if (!isHEAPAccess(node)) {
1274 c(node.object);
1275 } else {
1276 // Instrument a load.
1277 asanifyTransform(node, '___asan_loadN');
1278 }
1279 },
1280 });
1281}
1282
1283function multiply(value, by) {
1284 return {

Callers

nothing calls this directly

Calls 1

recursiveWalkFunction · 0.85

Tested by

no test coverage detected