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

Function AssignmentExpression

tools/acorn-optimizer.mjs:1003–1031  ·  view source on GitHub ↗
(node, c)

Source from the content-addressed store, hash-verified

1001 }
1002 },
1003 AssignmentExpression(node, c) {
1004 const target = node.left;
1005 const value = node.right;
1006 c(value);
1007 const heap = isHEAPAccess(target);
1008 const growHeap = isGrowHEAPAccess(target);
1009 if (heap) {
1010 // replace the heap access with LE_HEAP_STORE
1011 const idx = target.property;
1012 const helper = littleEndianHelper[heap];
1013 if (helper) {
1014 // "nameXX[idx] = value" -> "LE_HEAP_STORE_XX(idx*XX, value)"
1015 makeCallExpression(node, helper.store, [multiply(idx, helper.width), value]);
1016 }
1017 } else if (growHeap) {
1018 const idx = target.property;
1019 const helper = littleEndianHelper[growHeap];
1020 if (helper) {
1021 // "(growMemViews(),nameXX)[idx] = value" -> "LE_HEAP_STORE_XX((growMemViews(),idx*XX), value)"
1022 makeCallExpression(node, helper.store, [
1023 makeSequence(makeCallGrowMemViews(), multiply(idx, helper.width)),
1024 value,
1025 ]);
1026 }
1027 } else {
1028 // not accessing the HEAP
1029 c(target);
1030 }
1031 },
1032 CallExpression(node, c) {
1033 if (node.arguments) {
1034 for (var a of node.arguments) c(a);

Callers

nothing calls this directly

Calls 9

isHEAPAccessFunction · 0.85
isGrowHEAPAccessFunction · 0.85
makeCallExpressionFunction · 0.85
makeSequenceFunction · 0.85
makeCallGrowMemViewsFunction · 0.85
asanifyTransformFunction · 0.85
safeHeapTransformFunction · 0.85
multiplyFunction · 0.70
cFunction · 0.50

Tested by

no test coverage detected