Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 04d568e

Browse filesBrowse files
o-targos
authored andcommitted
deps: V8: cherry-pick f93055fbd5aa
Original commit message: [runtime] Fastcase for empty getOwnPropertySymbols() Since symbols are not enumerable we can rule them out in case all properties are in the enum cache. Bug: 447154198 Change-Id: Ib2d58b67e5058d98323fcebaef3daba88c6304b5 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6983286 Commit-Queue: Olivier Flückiger <olivf@chromium.org> Reviewed-by: Toon Verwaest <verwaest@chromium.org> Auto-Submit: Olivier Flückiger <olivf@chromium.org> Cr-Commit-Position: refs/heads/main@{#102878} Refs: v8/v8@f93055f PR-URL: #60105 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
1 parent e273c20 commit 04d568e
Copy full SHA for 04d568e

File tree

Expand file treeCollapse file tree

3 files changed

+32
-1
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

3 files changed

+32
-1
lines changed
Open diff view settings
Collapse file

‎common.gypi‎

Copy file name to clipboardExpand all lines: common.gypi
+1-1Lines 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.27',
41+
'v8_embedder_string': '-node.28',
4242

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

Collapse file

‎deps/v8/src/objects/keys.cc‎

Copy file name to clipboardExpand all lines: deps/v8/src/objects/keys.cc
+30Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -464,6 +464,8 @@ MaybeHandle<FixedArray> FastKeyAccumulator::GetKeys(
464464
return keys;
465465
}
466466
if (isolate_->has_exception()) return MaybeHandle<FixedArray>();
467+
} else if (filter_ == SKIP_STRINGS && !MayHaveSymbols()) {
468+
return isolate_->factory()->empty_fixed_array();
467469
}
468470

469471
if (try_prototype_info_cache_) {
@@ -472,6 +474,34 @@ MaybeHandle<FixedArray> FastKeyAccumulator::GetKeys(
472474
return GetKeysSlow(keys_conversion);
473475
}
474476

477+
bool FastKeyAccumulator::MayHaveSymbols() {
478+
bool own_only = has_empty_prototype_ || mode_ == KeyCollectionMode::kOwnOnly;
479+
Tagged<Map> map = receiver_->map();
480+
if (!own_only || IsCustomElementsReceiverMap(map)) {
481+
return true;
482+
}
483+
484+
// From this point on we are certain to only collect own keys.
485+
DCHECK(IsJSObject(*receiver_));
486+
487+
if (map->is_dictionary_map()) {
488+
// TODO(olivf): Keep a bit in the dictionary to remember if we have any
489+
// symbols.
490+
return true;
491+
}
492+
int num = map->NumberOfOwnDescriptors();
493+
if (num == 0) {
494+
return false;
495+
}
496+
int enum_length = receiver_->map()->EnumLength();
497+
if (enum_length != kInvalidEnumCacheSentinel) {
498+
return enum_length != num;
499+
}
500+
// TODO(olivf): Keep a bit in the descriptor to remember if we have any
501+
// symbols.
502+
return true;
503+
}
504+
475505
MaybeHandle<FixedArray> FastKeyAccumulator::GetKeysFast(
476506
GetKeysConversion keys_conversion) {
477507
bool own_only = has_empty_prototype_ || mode_ == KeyCollectionMode::kOwnOnly;
Collapse file

‎deps/v8/src/objects/keys.h‎

Copy file name to clipboardExpand all lines: deps/v8/src/objects/keys.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,7 @@ class FastKeyAccumulator {
197197
bool is_receiver_simple_enum() { return is_receiver_simple_enum_; }
198198
bool has_empty_prototype() { return has_empty_prototype_; }
199199
bool may_have_elements() { return may_have_elements_; }
200+
bool MayHaveSymbols();
200201

201202
MaybeHandle<FixedArray> GetKeys(
202203
GetKeysConversion convert = GetKeysConversion::kKeepNumbers);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.