Skip to content

Commit 2ba4eea

Browse files
bnoordhuisjasnell
authored andcommitted
lib: remove simd support from util.format()
Upstream V8 is removing SIMD support. Be proactive and follow suit. Refs: https://bugs.chromium.org/p/v8/issues/detail?id=4124 PR-URL: #11346 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Evan Lucas <evanlucas@me.com> Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net>
1 parent c5d1851 commit 2ba4eea

File tree

2 files changed

+0
-103
lines changed

2 files changed

+0
-103
lines changed

lib/util.js

-41
Original file line numberDiff line numberDiff line change
@@ -18,41 +18,6 @@ const inspectDefaultOptions = Object.seal({
1818
});
1919

2020
var Debug;
21-
var simdFormatters;
22-
23-
// SIMD is only available when --harmony_simd is specified on the command line
24-
// and the set of available types differs between v5 and v6, that's why we use
25-
// a map to look up and store the formatters. It also provides a modicum of
26-
// protection against users monkey-patching the SIMD object.
27-
if (typeof global.SIMD === 'object' && global.SIMD !== null) {
28-
simdFormatters = new Map();
29-
30-
const make =
31-
(extractLane, count) => (ctx, value, recurseTimes, visibleKeys, keys) => {
32-
const output = new Array(count);
33-
for (var i = 0; i < count; i += 1)
34-
output[i] = formatPrimitive(ctx, extractLane(value, i));
35-
return output;
36-
};
37-
38-
const countPerType = {
39-
Bool16x8: 8,
40-
Bool32x4: 4,
41-
Bool8x16: 16,
42-
Float32x4: 4,
43-
Int16x8: 8,
44-
Int32x4: 4,
45-
Int8x16: 16,
46-
Uint16x8: 8,
47-
Uint32x4: 4,
48-
Uint8x16: 16
49-
};
50-
51-
for (const key in countPerType) {
52-
const type = global.SIMD[key];
53-
simdFormatters.set(type, make(type.extractLane, countPerType[key]));
54-
}
55-
}
5621

5722
function tryStringify(arg) {
5823
try {
@@ -508,7 +473,6 @@ function formatValue(ctx, value, recurseTimes) {
508473
braces = ['{', '}'];
509474
formatter = formatPromise;
510475
} else {
511-
let maybeSimdFormatter;
512476
if (binding.isMapIterator(value)) {
513477
constructor = { name: 'MapIterator' };
514478
braces = ['{', '}'];
@@ -519,11 +483,6 @@ function formatValue(ctx, value, recurseTimes) {
519483
braces = ['{', '}'];
520484
empty = false;
521485
formatter = formatCollectionIterator;
522-
} else if (simdFormatters &&
523-
typeof constructor === 'function' &&
524-
(maybeSimdFormatter = simdFormatters.get(constructor))) {
525-
braces = ['[', ']'];
526-
formatter = maybeSimdFormatter;
527486
} else {
528487
// Unset the constructor to prevent "Object {...}" for ordinary objects.
529488
if (constructor && constructor.name === 'Object')

test/parallel/test-util-inspect-simd.js

-62
This file was deleted.

0 commit comments

Comments
 (0)