Skip to content

Commit c9b3ffd

Browse files
anonrigtargos
authored andcommitted
deps: V8: backport 2a23d9fa5217
Original commit message: Add Isolate::GetHashSeed() for testing purposes Embedders can get hash seed using native syntax prior to 13.4 but they can't after the upgrade. Prior work was done using the following code https://github.com/nodejs/node/blob/13d5a2f7025cf077db7a85548a75b2b429004045/test/fixtures/guess-hash-seed.js After this change V8 provides a valid way of getting the hash seed. Change-Id: I875f5ff721db1a3336dd67c61c1e72f05d7b7cf7 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6286748 Reviewed-by: Erik Corry <[email protected]> Reviewed-by: Leszek Swirski <[email protected]> Commit-Queue: Erik Corry <[email protected]> Cr-Commit-Position: refs/heads/main@{#98848} Refs: v8/v8@2a23d9f Co-authored-by: Michaël Zasso <[email protected]>
1 parent ca309f1 commit c9b3ffd

File tree

4 files changed

+18
-1
lines changed

4 files changed

+18
-1
lines changed

common.gypi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
# Reset this number to 0 on major V8 upgrades.
4040
# Increment by one for each non-official patch applied to deps/v8.
41-
'v8_embedder_string': '-node.12',
41+
'v8_embedder_string': '-node.13',
4242

4343
##### V8 defaults for Node.js #####
4444

deps/v8/include/v8-isolate.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1874,6 +1874,11 @@ class V8_EXPORT Isolate {
18741874
*/
18751875
std::string GetDefaultLocale();
18761876

1877+
/**
1878+
* Returns the hash seed for that isolate, for testing purposes.
1879+
*/
1880+
uint64_t GetHashSeed();
1881+
18771882
Isolate() = delete;
18781883
~Isolate() = delete;
18791884
Isolate(const Isolate&) = delete;

deps/v8/src/api/api.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11051,6 +11051,11 @@ std::string Isolate::GetDefaultLocale() {
1105111051
#endif
1105211052
}
1105311053

11054+
uint64_t Isolate::GetHashSeed() {
11055+
i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
11056+
return HashSeed(i_isolate);
11057+
}
11058+
1105411059
#if defined(V8_ENABLE_ETW_STACK_WALKING)
1105511060
void Isolate::SetFilterETWSessionByURLCallback(
1105611061
FilterETWSessionByURLCallback callback) {

deps/v8/test/cctest/test-api.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31175,3 +31175,10 @@ TEST(WrappedFunctionWithClass) {
3117531175
maybe_instance = the_class->NewInstance(context, 0, nullptr);
3117631176
CHECK(!maybe_instance.IsEmpty());
3117731177
}
31178+
31179+
TEST(GettingHashSeed) {
31180+
LocalContext env;
31181+
v8::Isolate* isolate = env->GetIsolate();
31182+
// Validate existence of the function.
31183+
CHECK_GT(isolate->GetHashSeed(), 0);
31184+
}

0 commit comments

Comments
 (0)