GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — deps: V8: cherry-pick f93055fbd5aa · nodejs/node@de8386d

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • common.gypi
  • deps/v8/src/objects
    • keys.cc
    • keys.h
Expand file treeCollapse file tree
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.6',
41+
'v8_embedder_string': '-node.7',
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
@@ -463,6 +463,8 @@ MaybeHandle<FixedArray> FastKeyAccumulator::GetKeys(
463463
return keys;
464464
}
465465
if (isolate_->has_exception()) return MaybeHandle<FixedArray>();
466+
} else if (filter_ == SKIP_STRINGS && !MayHaveSymbols()) {
467+
return isolate_->factory()->empty_fixed_array();
466468
}
467469

468470
if (try_prototype_info_cache_) {
@@ -471,6 +473,34 @@ MaybeHandle<FixedArray> FastKeyAccumulator::GetKeys(
471473
return GetKeysSlow(keys_conversion);
472474
}
473475

476+
bool FastKeyAccumulator::MayHaveSymbols() {
477+
bool own_only = has_empty_prototype_ || mode_ == KeyCollectionMode::kOwnOnly;
478+
Tagged<Map> map = receiver_->map();
479+
if (!own_only || IsCustomElementsReceiverMap(map)) {
480+
return true;
481+
}
482+
483+
// From this point on we are certain to only collect own keys.
484+
DCHECK(IsJSObject(*receiver_));
485+
486+
if (map->is_dictionary_map()) {
487+
// TODO(olivf): Keep a bit in the dictionary to remember if we have any
488+
// symbols.
489+
return true;
490+
}
491+
int num = map->NumberOfOwnDescriptors();
492+
if (num == 0) {
493+
return false;
494+
}
495+
int enum_length = receiver_->map()->EnumLength();
496+
if (enum_length != kInvalidEnumCacheSentinel) {
497+
return enum_length != num;
498+
}
499+
// TODO(olivf): Keep a bit in the descriptor to remember if we have any
500+
// symbols.
501+
return true;
502+
}
503+
474504
MaybeHandle<FixedArray> FastKeyAccumulator::GetKeysFast(
475505
GetKeysConversion keys_conversion) {
476506
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)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.