Skip to content

deps: cherry-pick 8ed65b97 from V8's upstream

Checklist
  • make -j4 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

deps/v8

Description of change

Um, hope I’m doing this right by backporting v8/v8@8ed65b97 to v6.x – in master that should not be necessary as this will come with a regular V8 5.4 update before v7.x is cut?

The test needed a little fixup to work with V8 5.1.


Original commit message:

Make FieldType::None() non-nullptr value to avoid undefined behaviour

When FieldType::None() returns a cast Smi::FromInt(0), which translates
as nullptr, the FieldType::IsNone() check becomes equivalent to
`this == nullptr` which is not allowed by the standard and
therefore optimized away as a false constant by GCC 6.

This has lead to crashes when invoking methods on FieldType::None().

Using a different Smi constant for FieldType::None() makes the compiler
always include a comparison against that value. The choice of these
constants has no effect as they are effectively arbitrary.

BUG=https://github.com/nodejs/node/issues/8310

Review-Url: https://codereview.chromium.org/2292953002
Cr-Commit-Position: refs/heads/master@{#39023}

Fixes: #8310 (closed)

CI: https://ci.nodejs.org/job/node-test-commit/4923/ https://ci.nodejs.org/job/node-test-commit-v8-linux/305/

Merge request reports

Loading