Skip to content

Commit

Permalink
lib: remove simd support from util.format()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Evan Lucas <[email protected]>
Reviewed-By: Ali Ijaz Sheikh <[email protected]>
Reviewed-By: Сковорода Никита Андреевич <[email protected]>
Reviewed-By: Sakthipriyan Vairamani <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
  • Loading branch information
bnoordhuis authored and jasnell committed Feb 15, 2017
1 parent c5d1851 commit 2ba4eea
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 103 deletions.
41 changes: 0 additions & 41 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,41 +18,6 @@ const inspectDefaultOptions = Object.seal({
});

var Debug;
var simdFormatters;

// SIMD is only available when --harmony_simd is specified on the command line
// and the set of available types differs between v5 and v6, that's why we use
// a map to look up and store the formatters. It also provides a modicum of
// protection against users monkey-patching the SIMD object.
if (typeof global.SIMD === 'object' && global.SIMD !== null) {
simdFormatters = new Map();

const make =
(extractLane, count) => (ctx, value, recurseTimes, visibleKeys, keys) => {
const output = new Array(count);
for (var i = 0; i < count; i += 1)
output[i] = formatPrimitive(ctx, extractLane(value, i));
return output;
};

const countPerType = {
Bool16x8: 8,
Bool32x4: 4,
Bool8x16: 16,
Float32x4: 4,
Int16x8: 8,
Int32x4: 4,
Int8x16: 16,
Uint16x8: 8,
Uint32x4: 4,
Uint8x16: 16
};

for (const key in countPerType) {
const type = global.SIMD[key];
simdFormatters.set(type, make(type.extractLane, countPerType[key]));
}
}

function tryStringify(arg) {
try {
Expand Down Expand Up @@ -508,7 +473,6 @@ function formatValue(ctx, value, recurseTimes) {
braces = ['{', '}'];
formatter = formatPromise;
} else {
let maybeSimdFormatter;
if (binding.isMapIterator(value)) {
constructor = { name: 'MapIterator' };
braces = ['{', '}'];
Expand All @@ -519,11 +483,6 @@ function formatValue(ctx, value, recurseTimes) {
braces = ['{', '}'];
empty = false;
formatter = formatCollectionIterator;
} else if (simdFormatters &&
typeof constructor === 'function' &&
(maybeSimdFormatter = simdFormatters.get(constructor))) {
braces = ['[', ']'];
formatter = maybeSimdFormatter;
} else {
// Unset the constructor to prevent "Object {...}" for ordinary objects.
if (constructor && constructor.name === 'Object')
Expand Down
62 changes: 0 additions & 62 deletions test/parallel/test-util-inspect-simd.js

This file was deleted.

0 comments on commit 2ba4eea

Please sign in to comment.