Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/child_process.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const {
ArrayPrototypePushApply,
ArrayPrototypeSlice,
ArrayPrototypeSort,
ArrayPrototypeSplice,
ArrayPrototypeToSpliced,
ArrayPrototypeUnshift,
ObjectAssign,
ObjectDefineProperty,
Expand Down Expand Up @@ -157,8 +157,7 @@ function fork(modulePath, args = [], options) {
const index = ArrayPrototypeLastIndexOf(execArgv, process._eval);
if (index > 0) {
// Remove the -e switch to avoid fork bombing ourselves.
execArgv = ArrayPrototypeSlice(execArgv);
ArrayPrototypeSplice(execArgv, index - 1, 2);
execArgv = ArrayPrototypeToSpliced(execArgv, index - 1, 2);
}
}

Expand Down
7 changes: 3 additions & 4 deletions lib/domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const {
ArrayPrototypePush,
ArrayPrototypeSlice,
ArrayPrototypeSplice,
ArrayPrototypeToSpliced,
Error,
FunctionPrototypeCall,
ObjectDefineProperty,
Expand Down Expand Up @@ -391,8 +392,7 @@ Domain.prototype.enter = function() {
// Note that this might be a no-op, but we still need
// to push it onto the stack so that we can pop it later.
const currentStore = getDomainStore() || { domain: null, stack: [] };
const newStack = ArrayPrototypeSlice(currentStore.stack);
ArrayPrototypePush(newStack, this);
const newStack = ArrayPrototypeToSpliced(currentStore.stack, currentStore.stack.length, 0, this);
setDomainStore({ domain: this, stack: newStack });
exports.active = this;
currentDomain = this;
Expand Down Expand Up @@ -471,8 +471,7 @@ Domain.prototype.remove = function(ee) {
// exit() only runs on success.
function runInDomain(domain, thisArg, fn, args) {
const currentStore = getDomainStore() || { domain: null, stack: [] };
const newStack = ArrayPrototypeSlice(currentStore.stack);
ArrayPrototypePush(newStack, domain);
const newStack = ArrayPrototypeToSpliced(currentStore.stack, currentStore.stack.length, 0, domain);
const previousDomain = currentDomain;
const previousStack = currentStack;

Expand Down
4 changes: 2 additions & 2 deletions lib/internal/bench_runner/benchmark.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const {
ArrayPrototypeReverse,
ArrayPrototypeSlice,
ArrayPrototypeSort,
ArrayPrototypeToSorted,
Float64Array,
JSONStringify,
MathFloor,
Expand Down Expand Up @@ -532,8 +533,7 @@ function summarizeSamples(samples) {
variance /= rates.length;
const stddev = MathSqrt(variance);

const sorted = ArrayPrototypeSlice(rates);
ArrayPrototypeSort(sorted, (a, b) => a - b);
const sorted = ArrayPrototypeToSorted(rates, (a, b) => a - b);
const middle = MathFloor(sorted.length / 2);
const median = sorted.length % 2 === 0 ?
(sorted[middle - 1] + sorted[middle]) / 2 : sorted[middle];
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/debugger/inspect_probe.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const {
ArrayPrototypePush,
ArrayPrototypeSlice,
ArrayPrototypeSome,
ArrayPrototypeToSpliced,
FunctionPrototypeBind,
JSONStringify,
NumberIsNaN,
Expand Down Expand Up @@ -989,8 +990,7 @@ class ProbeInspectorSession {
}

buildReport({ exitCode, terminal }) {
const results = ArrayPrototypeSlice(this.results);
ArrayPrototypePush(results, terminal);
const results = ArrayPrototypeToSpliced(this.results, this.results.length, 0, terminal);
return {
code: exitCode,
report: {
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/histogram.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
'use strict';

const {
ArrayPrototypeToSorted,
BigInt,
Float64Array,
Map,
Expand Down Expand Up @@ -596,7 +597,7 @@ class Histogram {
throw new ERR_OUT_OF_RANGE(
`percentiles[${i}]`, '> 0 && <= 100', percentiles[i]);
}
const sorted = [...percentiles].sort((a, b) => a - b);
const sorted = ArrayPrototypeToSorted(percentiles, (a, b) => a - b);
const input = new Float64Array(sorted);
const map = new Map();
this[kHandle]?.percentilesAt(map, input);
Expand Down
5 changes: 2 additions & 3 deletions lib/internal/zip/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@

const {
ArrayPrototypePush,
ArrayPrototypeSlice,
ArrayPrototypeSort,
ArrayPrototypeToSorted,
Date,
DateNow,
JSONStringify,
Expand Down Expand Up @@ -1057,7 +1056,7 @@ function* readArchiveEntries(buf, end) {
}
// Sort a separate range list; entries themselves are yielded in central
// directory order.
const ranges = ArrayPrototypeSort(ArrayPrototypeSlice(parsed), (a, b) => a.start - b.start);
const ranges = ArrayPrototypeToSorted(parsed, (a, b) => a.start - b.start);
for (let i = 0; i < ranges.length; i++) {
const bound = i + 1 < ranges.length ? ranges[i + 1].start : end.centralDirectoryOffset;
if (ranges[i].dataEnd > bound) {
Expand Down
Loading