Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
44cccbe
deps: update V8 to 13.4.114.21
targos Apr 1, 2025
42f6adc
build: reset embedder string to "-node.0"
targos Apr 1, 2025
f3f4d5a
src: update NODE_MODULE_VERSION to 136
targos Feb 26, 2025
54c8717
deps: always define V8_EXPORT_PRIVATE as no-op
targos Sep 21, 2022
46d8aa0
deps: disable V8 concurrent sparkplug compilation
targos Apr 6, 2023
1da6497
deps: patch V8 to avoid duplicated zlib symbol
targos Sep 16, 2023
61b27b4
deps: patch V8 to support compilation with MSVC
StefanStojanovic Apr 21, 2024
17d1f7b
deps: fix FP16 bitcasts.h
StefanStojanovic May 28, 2024
a5c5ae3
deps: always define V8_NODISCARD as no-op
targos Aug 8, 2024
d73d8ab
deps: define V8_PRESERVE_MOST as no-op on Windows
StefanStojanovic Dec 16, 2024
a435680
deps: remove problematic comment from v8-internal
targos Mar 19, 2025
2025345
deps: patch V8 to fix armv7 build
targos Feb 25, 2025
a625a98
deps: patch V8 13.4 to support compilation with MSVC
StefanStojanovic Apr 1, 2025
517d514
deps: silence internal V8 deprecation warning
targos Apr 2, 2025
a546d83
deps: V8: cherry-pick a580b463ac35
joyeecheung Feb 14, 2025
59a87d1
deps: V8: backport 2a23d9fa5217
anonrig Feb 20, 2025
3b25814
deps: V8: backport c24df23717b6
legendecas Mar 12, 2025
950060b
deps: V8: cherry-pick c172ffc5bf54
tunz Mar 6, 2025
58b1ea4
build: remove support for s390 32-bit
richardlau Sep 18, 2024
e47a369
build: enable shared RO heap with ptr compression
targos Sep 21, 2024
a9842d4
tools: update V8 gypfiles for 13.1
targos Sep 25, 2024
97a3cfc
tools: update V8 gypfiles for 13.2
targos Oct 28, 2024
38403e2
build,src,tools: adapt build config for V8 13.3
targos Dec 19, 2024
a5e14b5
tools: update V8 gypfiles for 13.4
targos Jan 20, 2025
fadba44
build: add `/bigobj` to compile V8 on Windows
targos Feb 5, 2025
f50c28c
src: replace uses of FastApiTypedArray
targos Feb 8, 2025
0d0c8ae
Revert "test: disable fast API call count checks"
targos Jan 31, 2025
4bb419b
test: update test-linux-perf-logger
targos Feb 4, 2025
2f3618e
test: adapt assert tests to stack trace changes
targos Dec 20, 2024
f9168fc
test: handle explicit resource management globals
targos Dec 21, 2024
a1abd03
deps: remove deps/simdutf
targos Jan 29, 2025
ab90d04
tools: update license-builder and LICENSE for V8 deps
targos Jan 29, 2025
160062e
src: use `v8::ExternalMemoryAccounter`
targos Feb 15, 2025
6764e4a
src,test: add V8 API to test the hash seed
targos Feb 20, 2025
489cf80
build: pass `-fPIC` to linker as well for shared builds
targos Apr 2, 2025
59feb96
zlib: fix pointer alignment
jhofstee Apr 1, 2025
48b3aee
build: fix V8 TLS config for shared lib builds
targos Apr 3, 2025
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
Prev Previous commit
Next Next commit
src,test: add V8 API to test the hash seed
  • Loading branch information
targos committed Apr 3, 2025
commit 6764e4a21a48cb854c11be2e46b49a1a05a73375
8 changes: 1 addition & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,6 @@ test-internet: all ## Run internet tests.
test-tick-processor: all ## Run tick processor tests.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) tick-processor

.PHONY: test-hash-seed
test-hash-seed: all ## Verifu that the hash seed used by V8 for hashing is random.
$(NODE) test/pummel/test-hash-seed.js

.PHONY: test-doc
test-doc: doc-only lint-md ## Build, lint, and verify the docs.
@if [ "$(shell $(node_use_openssl_and_icu))" != "true" ]; then \
Expand Down Expand Up @@ -751,8 +747,6 @@ test-v8: v8 ## Run the V8 test suite on deps/v8.
mjsunit cctest debugger inspector message preparser \
$(TAP_V8)
$(call convert_to_junit,$(TAP_V8_JSON))
$(info Testing hash seed)
$(MAKE) test-hash-seed

test-v8-intl: v8 ## Run the v8 test suite, intl tests.
export PATH="$(NO_BIN_OVERRIDE_PATH)" && \
Expand All @@ -768,7 +762,7 @@ test-v8-benchmarks: v8 ## Run the v8 test suite, benchmarks.
$(TAP_V8_BENCHMARKS)
$(call convert_to_junit,$(TAP_V8_BENCHMARKS_JSON))

test-v8-updates: ## Run the v8 test suite, updates.
test-v8-updates: all ## Run the v8 test suite, updates.
$(PYTHON) tools/test.py $(PARALLEL_ARGS) --mode=$(BUILDTYPE_LOWER) v8-updates

test-v8-all: test-v8 test-v8-intl test-v8-benchmarks test-v8-updates ## Run the entire V8 test suite, including intl, benchmarks, and updates.
Expand Down
10 changes: 10 additions & 0 deletions src/node_v8.cc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
namespace node {
namespace v8_utils {
using v8::Array;
using v8::BigInt;
using v8::CFunction;
using v8::Context;
using v8::FunctionCallbackInfo;
Expand Down Expand Up @@ -260,6 +261,12 @@ static bool FastIsStringOneByteRepresentation(Local<Value> receiver,
CFunction fast_is_string_one_byte_representation_(
CFunction::Make(FastIsStringOneByteRepresentation));

void GetHashSeed(const FunctionCallbackInfo<Value>& args) {
Isolate* isolate = args.GetIsolate();
uint64_t hash_seed = isolate->GetHashSeed();
args.GetReturnValue().Set(BigInt::NewFromUnsigned(isolate, hash_seed));
}

static const char* GetGCTypeName(v8::GCType gc_type) {
switch (gc_type) {
case v8::GCType::kGCTypeScavenge:
Expand Down Expand Up @@ -694,6 +701,8 @@ void Initialize(Local<Object> target,
IsStringOneByteRepresentation,
&fast_is_string_one_byte_representation_);

SetMethodNoSideEffect(context, target, "getHashSeed", GetHashSeed);

// GCProfiler
Local<FunctionTemplate> t =
NewFunctionTemplate(env->isolate(), GCProfiler::New);
Expand Down Expand Up @@ -721,6 +730,7 @@ void RegisterExternalReferences(ExternalReferenceRegistry* registry) {
registry->Register(UpdateHeapCodeStatisticsBuffer);
registry->Register(UpdateHeapSpaceStatisticsBuffer);
registry->Register(SetFlagsFromString);
registry->Register(GetHashSeed);
registry->Register(SetHeapSnapshotNearHeapLimit);
registry->Register(GCProfiler::New);
registry->Register(GCProfiler::Start);
Expand Down
165 changes: 0 additions & 165 deletions test/fixtures/guess-hash-seed.js

This file was deleted.

27 changes: 27 additions & 0 deletions test/parallel/test-hash-seed.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import '../common/index.mjs';

import assert from 'node:assert';
import { execFile } from 'node:child_process';
import { promisify, debuglog } from 'node:util';

// This test verifies that the V8 hash seed is random
// and unique between child processes.

const execFilePromise = promisify(execFile);
const debug = debuglog('test');

const kRepetitions = 3;

const seeds = await Promise.all(Array.from({ length: kRepetitions }, generateSeed));
debug(`Seeds: ${seeds}`);
assert.strictEqual(new Set(seeds).size, seeds.length);
assert.strictEqual(seeds.length, kRepetitions);

async function generateSeed() {
const output = await execFilePromise(process.execPath, [
'--expose-internals',
'--print',
'require("internal/test/binding").internalBinding("v8").getHashSeed()',
]);
return output.stdout.trim();
}
38 changes: 0 additions & 38 deletions test/pummel/test-hash-seed.js

This file was deleted.