Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v14.x] Backport Apple silicon support #38051

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
e0b3523
deps: cherry-pick f4376ec801e1ded from V8 upstream
danbev Feb 4, 2021
292dffe
test: add arm64 arch to test-worker-prof status
danbev Feb 4, 2021
15ed780
deps: V8: cherry-pick beebee4f80ff
psmarshall Aug 5, 2020
69057eb
test: add cpu-profiler-crash test
santigimeno Feb 9, 2021
a7acd72
worker: add eventLoopUtilization()
trevnorris Oct 14, 2020
78c42ac
test: correct test-worker-eventlooputil
Flarna Oct 31, 2020
b297c11
doc: upgrade stability status of report API
gireeshpunathil Oct 15, 2020
44d6862
doc: fix YAML lint error on master
Trott Oct 19, 2020
1ca213c
dns: add setLocalAddress to Resolver
daguej Aug 18, 2020
c5a61d3
test: refactor coverage logic
bcoe Oct 23, 2020
772afde
doc: fix typo in BUILDING.md
RaisinTen Oct 26, 2020
a2a3b70
child_process: add ChildProcess 'spawn' event
zenflow Sep 27, 2020
372fa0f
tools: add msvc /P output to .gitignore
gengjiawen Oct 21, 2020
4594961
src: add loop idle time in diagnostic report
gireeshpunathil Nov 3, 2020
e8ec2a6
deps: upgrade to libuv 1.41.0
cjihrig Feb 13, 2021
2b33ec4
deps: update ICU to 68.1
targos Nov 20, 2020
0d2752e
tools: fix md5 hash for ICU 68.1 src
richardlau Jan 4, 2021
966eee7
deps: update ICU to 68.2
targos Jan 18, 2021
efb88ee
doc: fix maintaining ICU guide
targos Jan 18, 2021
8899f47
tools: cleanup old ICU version-specific fixes
targos Jan 18, 2021
6562506
errors: print original exception context
bcoe Mar 10, 2021
cb9ec6d
deps: upgrade npm to 6.14.12
ruyadorno Mar 25, 2021
fe5e2e3
deps: v8 backport 9689b17687b
guybedford Mar 22, 2021
697d6a0
deps: V8: cherry-pick c6ec36a6
oleavr Nov 6, 2020
68f8f4b
deps: V8: cherry-pick 086eecbd96b6
oleavr Nov 6, 2020
6be68ce
deps: V8: cherry-pick 4e077ff0444a
oleavr Nov 6, 2020
bb7e82e
deps: V8: cherry-pick 1d0f426311d4i
oleavr Nov 6, 2020
c2d8aef
test: add SIGTRAP to test-signal-handler
Dec 3, 2020
62f250d
deps: V8: cherry-pick 0c8b6e415c30
matinzd Feb 8, 2021
270801c
deps: cherry-pick 8957d4677aa794c230577f234071af0 from V8 upstream
aduh95 Jan 4, 2021
83501fd
deps: v8: cherry-pick cf71540c
a60814billy Apr 2, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -93,6 +93,9 @@ _UpgradeReport_Files/
/*.host.mk
/deps/openssl/openssl.target.mk
/deps/zlib/zlib.target.mk
# generated by MSVC with /P enabled
tools/*/*.i
tools/*/*.i.tmp

# === Rules for release artifacts ===
/*.tar.*
Expand Down
32 changes: 18 additions & 14 deletions BUILDING.md
Expand Up @@ -389,28 +389,32 @@ $ make coverage
```

A detailed coverage report will be written to `coverage/index.html` for
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage
(if you only want to run the JavaScript tests then you do not need to run
the first command `./configure --coverage`).
JavaScript coverage and to `coverage/cxxcoverage.html` for C++ coverage.

_Generating a test coverage report can take several minutes._

To collect coverage for a subset of tests you can set the `CI_JS_SUITES` and
`CI_NATIVE_SUITES` variables (to run specific suites, e.g., `child-process`, in
isolation, unset the opposing `_SUITES` variable):
If you only want to run the JavaScript tests then you do not need to run
the first command (`./configure --coverage`). Run `make coverage-run-js`,
to execute JavaScript tests independently of the C++ test suite:

```text
$ CI_JS_SUITES=child-process CI_NATIVE_SUITES= make coverage
$ make coverage-run-js
```

The above command executes tests for the `child-process` subsystem and
outputs the resulting coverage report.
If you are updating tests and want to collect coverage for a single test file
(e.g. `test/parallel/test-stream2-transform.js`):

```text
$ make coverage-clean
$ NODE_V8_COVERAGE=coverage/tmp python tools/test.py test/parallel/test-stream2-transform.js
$ make coverage-report-js
```

Alternatively, you can run `make coverage-run-js`, to execute JavaScript tests
independently of the C++ test suite:
You can collect coverage for the entire suite of tests for a given subsystem
by providing the name of a subsystem:

```text
$ CI_JS_SUITES=fs CI_NATIVE_SUITES= make coverage-run-js
$ make coverage-clean
$ NODE_V8_COVERAGE=coverage/tmp python tools/test.py -J --mode=release child-process
$ make coverage-report-js
```

The `make coverage` command downloads some tools to the project root directory.
Expand Down
6 changes: 3 additions & 3 deletions LICENSE
Expand Up @@ -418,9 +418,9 @@ The externally maintained libraries used by Node.js are:
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
# Project: http://code.google.com/p/lao-dictionary/
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# Project: https://github.com/veer66/lao-dictionary
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
Expand Down
35 changes: 9 additions & 26 deletions Makefile
Expand Up @@ -197,20 +197,11 @@ check: test
# Remove files generated by running coverage, put the non-instrumented lib back
# in place
coverage-clean:
if [ -d lib_ ]; then $(RM) -r lib; mv lib_ lib; fi
$(RM) -r node_modules
$(RM) -r gcovr build
$(RM) -r out/$(BUILDTYPE)/.coverage
$(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node/gen/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/node/src/tracing/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/cctest/src/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/cctest/test/cctest/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/embedtest/src/*.gcno
$(RM) out/$(BUILDTYPE)/obj.target/embedtest/test/embedding/*.gcno
$(RM) -r coverage/tmp
$(FIND) out/$(BUILDTYPE)/obj.target \( -name "*.gcda" -o -name "*.gcno" \) \
-type f -exec $(RM) {} \;

.PHONY: coverage
# Build and test with code coverage reporting. Leave the lib directory
Expand Down Expand Up @@ -245,8 +236,8 @@ coverage-test: coverage-build
$(RM) out/$(BUILDTYPE)/obj.target/node/src/*/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*.gcda
$(RM) out/$(BUILDTYPE)/obj.target/node_lib/src/*/*.gcda
-NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
-NODE_V8_COVERAGE=coverage/tmp \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) $(COVTESTS)
$(MAKE) coverage-report-js
-(cd out && "../gcovr/scripts/gcovr" \
--gcov-exclude='.*\b(deps|usr|out|cctest|embedding)\b' -v \
Expand All @@ -259,17 +250,10 @@ coverage-test: coverage-build
@grep -A3 Lines coverage/cxxcoverage.html | grep style \
| sed 's/<[^>]*>//g'| sed 's/ //g'

COV_REPORT_OPTIONS = --reporter=html \
--temp-directory=out/$(BUILDTYPE)/.coverage --omit-relative=false \
--resolve=./lib --exclude="benchmark/" --exclude="deps/" --exclude="test/" --exclude="tools/" \
--wrapper-length=0
ifdef COV_ENFORCE_THRESHOLD
COV_REPORT_OPTIONS += --check-coverage --lines=$(COV_ENFORCE_THRESHOLD)
endif

.PHONY: coverage-report-js
coverage-report-js:
$(NODE) ./node_modules/.bin/c8 report $(COV_REPORT_OPTIONS)
-$(MAKE) coverage-build-js
$(NODE) ./node_modules/.bin/c8 report

.PHONY: cctest
# Runs the C++ tests using the built `cctest` executable.
Expand Down Expand Up @@ -304,9 +288,8 @@ tooltest:

.PHONY: coverage-run-js
coverage-run-js:
$(RM) -r out/$(BUILDTYPE)/.coverage
$(MAKE) coverage-build-js
-NODE_V8_COVERAGE=out/$(BUILDTYPE)/.coverage CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
$(RM) -r coverage/tmp
-NODE_V8_COVERAGE=coverage/tmp CI_SKIP_TESTS=$(COV_SKIP_TESTS) \
TEST_CI_ARGS="$(TEST_CI_ARGS) --type=coverage" $(MAKE) jstest
$(MAKE) coverage-report-js

Expand Down
61 changes: 61 additions & 0 deletions benchmark/worker/bench-eventlooputil.js
@@ -0,0 +1,61 @@
'use strict';

const common = require('../common.js');
const { Worker, parentPort } = require('worker_threads');

if (process.argv[2] === 'idle cats') {
return parentPort.once('message', () => {});
}

const bench = common.createBenchmark(main, {
n: [1e6],
method: [
'ELU_simple',
'ELU_passed',
],
});

function main({ method, n }) {
switch (method) {
case 'ELU_simple':
benchELUSimple(n);
break;
case 'ELU_passed':
benchELUPassed(n);
break;
default:
throw new Error(`Unsupported method ${method}`);
}
}

function benchELUSimple(n) {
const worker = new Worker(__filename, { argv: ['idle cats'] });

spinUntilIdle(worker, () => {
bench.start();
for (let i = 0; i < n; i++)
worker.performance.eventLoopUtilization();
bench.end(n);
worker.postMessage('bye');
});
}

function benchELUPassed(n) {
const worker = new Worker(__filename, { argv: ['idle cats'] });

spinUntilIdle(worker, () => {
let elu = worker.performance.eventLoopUtilization();
bench.start();
for (let i = 0; i < n; i++)
elu = worker.performance.eventLoopUtilization(elu);
bench.end(n);
worker.postMessage('bye');
});
}

function spinUntilIdle(w, cb) {
const t = w.performance.eventLoopUtilization();
if (t.idle + t.active > 0)
return process.nextTick(cb);
setTimeout(() => spinUntilIdle(w, cb), 1);
}
2 changes: 1 addition & 1 deletion common.gypi
Expand Up @@ -36,7 +36,7 @@

# Reset this number to 0 on major V8 upgrades.
# Increment by one for each non-official patch applied to deps/v8.
'v8_embedder_string': '-node.18',
'v8_embedder_string': '-node.27',

##### V8 defaults for Node.js #####

Expand Down
6 changes: 3 additions & 3 deletions deps/icu-small/LICENSE
Expand Up @@ -284,9 +284,9 @@ property of their respective owners.
# Copyright (c) 2013 International Business Machines Corporation
# and others. All Rights Reserved.
#
# Project: http://code.google.com/p/lao-dictionary/
# Dictionary: http://lao-dictionary.googlecode.com/git/Lao-Dictionary.txt
# License: http://lao-dictionary.googlecode.com/git/Lao-Dictionary-LICENSE.txt
# Project: https://github.com/veer66/lao-dictionary
# Dictionary: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary.txt
# License: https://github.com/veer66/lao-dictionary/blob/master/Lao-Dictionary-LICENSE.txt
# (copied below)
#
# This file is derived from the above dictionary, with slight
Expand Down
4 changes: 2 additions & 2 deletions deps/icu-small/README-FULL-ICU.txt
@@ -1,8 +1,8 @@
ICU sources - auto generated by shrink-icu-src.py

This directory contains the ICU subset used by --with-intl=full-icu
It is a strict subset of ICU 67 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt67l.dat.bz2 : compressed data file
It is a strict subset of ICU 68 source files with the following exception(s):
* deps/icu-small/source/data/in/icudt68l.dat.bz2 : compressed data file


To rebuild this directory, see ../../tools/icu/README.md
11 changes: 11 additions & 0 deletions deps/icu-small/source/.clang-format
@@ -0,0 +1,11 @@
# © 2020 and later: Unicode, Inc. and others.
# License & terms of use: http://www.unicode.org/copyright.html

---
Language: Cpp
BasedOnStyle: LLVM
IndentWidth: 4
ColumnLimit: 105
AllowShortBlocksOnASingleLine: false
AllowShortIfStatementsOnASingleLine: true
...
2 changes: 1 addition & 1 deletion deps/icu-small/source/common/bmpset.h
Expand Up @@ -101,7 +101,7 @@ class BMPSet : public UMemory {
*/
UBool latin1Contains[0x100];

/* TRUE if contains(U+FFFD). */
/* true if contains(U+FFFD). */
UBool containsFFFD;

/*
Expand Down
4 changes: 2 additions & 2 deletions deps/icu-small/source/common/brkeng.h
Expand Up @@ -54,7 +54,7 @@ class LanguageBreakEngine : public UMemory {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @return TRUE if this engine handles the particular character and break
* @return true if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c) const = 0;
Expand Down Expand Up @@ -171,7 +171,7 @@ class UnhandledEngine : public LanguageBreakEngine {
* a particular kind of break.</p>
*
* @param c A character which begins a run that the engine might handle
* @return TRUE if this engine handles the particular character and break
* @return true if this engine handles the particular character and break
* type.
*/
virtual UBool handles(UChar32 c) const;
Expand Down
4 changes: 2 additions & 2 deletions deps/icu-small/source/common/bytesinkutil.h
Expand Up @@ -45,9 +45,9 @@ class U_COMMON_API ByteSinkUtil {
static UBool appendUnchanged(const uint8_t *s, int32_t length,
ByteSink &sink, uint32_t options, Edits *edits,
UErrorCode &errorCode) {
if (U_FAILURE(errorCode)) { return FALSE; }
if (U_FAILURE(errorCode)) { return false; }
if (length > 0) { appendNonEmptyUnchanged(s, length, sink, options, edits); }
return TRUE;
return true;
}

static UBool appendUnchanged(const uint8_t *s, const uint8_t *limit,
Expand Down
28 changes: 26 additions & 2 deletions deps/icu-small/source/common/charstr.cpp
Expand Up @@ -20,6 +20,7 @@
#include "cmemory.h"
#include "cstring.h"
#include "uinvchar.h"
#include "ustr_imp.h"

U_NAMESPACE_BEGIN

Expand All @@ -46,6 +47,19 @@ char *CharString::cloneData(UErrorCode &errorCode) const {
return p;
}

int32_t CharString::extract(char *dest, int32_t capacity, UErrorCode &errorCode) const {
if (U_FAILURE(errorCode)) { return len; }
if (capacity < 0 || (capacity > 0 && dest == nullptr)) {
errorCode = U_ILLEGAL_ARGUMENT_ERROR;
return len;
}
const char *src = buffer.getAlias();
if (0 < len && len <= capacity && src != dest) {
uprv_memcpy(dest, src, len);
}
return u_terminateChars(dest, capacity, len, &errorCode);
}

CharString &CharString::copyFrom(const CharString &s, UErrorCode &errorCode) {
if(U_SUCCESS(errorCode) && this!=&s && ensureCapacity(s.len+1, 0, errorCode)) {
len=s.len;
Expand Down Expand Up @@ -197,7 +211,7 @@ CharString &CharString::appendPathPart(StringPiece s, UErrorCode &errorCode) {
}
char c;
if(len>0 && (c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
append(U_FILE_SEP_CHAR, errorCode);
append(getDirSepChar(), errorCode);
}
append(s, errorCode);
return *this;
Expand All @@ -207,9 +221,19 @@ CharString &CharString::ensureEndsWithFileSeparator(UErrorCode &errorCode) {
char c;
if(U_SUCCESS(errorCode) && len>0 &&
(c=buffer[len-1])!=U_FILE_SEP_CHAR && c!=U_FILE_ALT_SEP_CHAR) {
append(U_FILE_SEP_CHAR, errorCode);
append(getDirSepChar(), errorCode);
}
return *this;
}

char CharString::getDirSepChar() const {
char dirSepChar = U_FILE_SEP_CHAR;
#if (U_FILE_SEP_CHAR != U_FILE_ALT_SEP_CHAR)
// We may need to return a different directory separator when building for Cygwin or MSYS2.
if(len>0 && !uprv_strchr(data(), U_FILE_SEP_CHAR) && uprv_strchr(data(), U_FILE_ALT_SEP_CHAR))
dirSepChar = U_FILE_ALT_SEP_CHAR;
#endif
return dirSepChar;
}

U_NAMESPACE_END
26 changes: 24 additions & 2 deletions deps/icu-small/source/common/charstr.h
Expand Up @@ -87,6 +87,22 @@ class U_COMMON_API CharString : public UMemory {
* The caller must uprv_free() the result.
*/
char *cloneData(UErrorCode &errorCode) const;
/**
* Copies the contents of the string into dest.
* Checks if there is enough space in dest, extracts the entire string if possible,
* and NUL-terminates dest if possible.
*
* If the string fits into dest but cannot be NUL-terminated (length()==capacity),
* then the error code is set to U_STRING_NOT_TERMINATED_WARNING.
* If the string itself does not fit into dest (length()>capacity),
* then the error code is set to U_BUFFER_OVERFLOW_ERROR.
*
* @param dest Destination string buffer.
* @param capacity Size of the dest buffer (number of chars).
* @param errorCode ICU error code.
* @return length()
*/
int32_t extract(char *dest, int32_t capacity, UErrorCode &errorCode) const;

bool operator==(StringPiece other) const {
return len == other.length() && (len == 0 || uprv_memcmp(data(), other.data(), len) == 0);
Expand Down Expand Up @@ -141,13 +157,13 @@ class U_COMMON_API CharString : public UMemory {

/**
* Appends a filename/path part, e.g., a directory name.
* First appends a U_FILE_SEP_CHAR if necessary.
* First appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if necessary.
* Does nothing if s is empty.
*/
CharString &appendPathPart(StringPiece s, UErrorCode &errorCode);

/**
* Appends a U_FILE_SEP_CHAR if this string is not empty
* Appends a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR if this string is not empty
* and does not already end with a U_FILE_SEP_CHAR or U_FILE_ALT_SEP_CHAR.
*/
CharString &ensureEndsWithFileSeparator(UErrorCode &errorCode);
Expand All @@ -160,6 +176,12 @@ class U_COMMON_API CharString : public UMemory {

CharString(const CharString &other); // forbid copying of this class
CharString &operator=(const CharString &other); // forbid copying of this class

/**
* Returns U_FILE_ALT_SEP_CHAR if found in string, and U_FILE_SEP_CHAR is not found.
* Otherwise returns U_FILE_SEP_CHAR.
*/
char getDirSepChar() const;
};

U_NAMESPACE_END
Expand Down