deps: V8: backport 8901c793e439 · nodejs/node@9ce8ef4 · GitHub
Skip to content

Commit 9ce8ef4

Browse files
verwaestinoway46
authored andcommitted
deps: V8: backport 8901c793e439
Original commit message: [compiler] Stop collecting array and object prototypes We can check in O(1) whether an object is either Object.prototype or Array.prototype by directly comparing it with the objects, so there's no need to collect them. Change-Id: Iadedf8b05cae3d67191fb4836c186620dc009118 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/6487694 Commit-Queue: Toon Verwaest <verwaest@chromium.org> Reviewed-by: Igor Sheludko <ishell@chromium.org> Commit-Queue: Igor Sheludko <ishell@chromium.org> Auto-Submit: Toon Verwaest <verwaest@chromium.org> Cr-Commit-Position: refs/heads/main@{#99894} Refs: v8/v8@8901c79 Co-authored-by: inoway46 <inoueyuya416@gmail.com> PR-URL: #66089 Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 83b3431 commit 9ce8ef4

4 files changed

Lines changed: 9 additions & 45 deletions

File tree

‎common.gypi‎

Lines changed: 1 addition & 1 deletion

‎deps/v8/src/compiler/heap-refs.cc‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1039,8 +1039,6 @@ void JSHeapBroker::InitializeAndStartSerializing(
10391039
refs_ =
10401040
zone()->New<RefsMap>(kInitialRefsBucketCount, AddressMatcher(), zone());
10411041

1042-
CollectArrayAndObjectPrototypes();
1043-
10441042
SetTargetNativeContextRef(target_native_context);
10451043
}
10461044

‎deps/v8/src/compiler/js-heap-broker.cc‎

Lines changed: 3 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ JSHeapBroker::JSHeapBroker(Isolate* isolate, Zone* broker_zone,
4747
refs_(zone()->New<RefsMap>(kMinimalRefsBucketCount, AddressMatcher(),
4848
zone())),
4949
root_index_map_(isolate),
50-
array_and_object_prototypes_(zone()),
5150
tracing_enabled_(tracing_enabled),
5251
code_kind_(code_kind),
5352
feedback_(zone()),
@@ -118,28 +117,6 @@ void JSHeapBroker::SetTargetNativeContextRef(
118117
target_native_context_ = MakeRef(this, *native_context);
119118
}
120119

121-
void JSHeapBroker::CollectArrayAndObjectPrototypes() {
122-
DisallowGarbageCollection no_gc;
123-
CHECK_EQ(mode(), kSerializing);
124-
CHECK(array_and_object_prototypes_.empty());
125-
126-
Tagged<Object> maybe_context = isolate()->heap()->native_contexts_list();
127-
while (!IsUndefined(maybe_context, isolate())) {
128-
Tagged<Context> context = Cast<Context>(maybe_context);
129-
Tagged<Object> array_prot =
130-
context->get(Context::INITIAL_ARRAY_PROTOTYPE_INDEX);
131-
Tagged<Object> object_prot =
132-
context->get(Context::INITIAL_OBJECT_PROTOTYPE_INDEX);
133-
array_and_object_prototypes_.emplace(
134-
CanonicalPersistentHandle(Cast<JSObject>(array_prot)));
135-
array_and_object_prototypes_.emplace(
136-
CanonicalPersistentHandle(Cast<JSObject>(object_prot)));
137-
maybe_context = context->next_context_link();
138-
}
139-
140-
CHECK(!array_and_object_prototypes_.empty());
141-
}
142-
143120
StringRef JSHeapBroker::GetTypedArrayStringTag(ElementsKind kind) {
144121
DCHECK(IsTypedArrayOrRabGsabTypedArrayElementsKind(kind));
145122
switch (kind) {
@@ -159,14 +136,9 @@ bool JSHeapBroker::IsArrayOrObjectPrototype(JSObjectRef object) const {
159136
}
160137

161138
bool JSHeapBroker::IsArrayOrObjectPrototype(Handle<JSObject> object) const {
162-
if (mode() == kDisabled) {
163-
return isolate()->IsInCreationContext(
164-
*object, Context::INITIAL_ARRAY_PROTOTYPE_INDEX) ||
165-
object->map(isolate_)->instance_type() == JS_OBJECT_PROTOTYPE_TYPE;
166-
}
167-
CHECK(!array_and_object_prototypes_.empty());
168-
return array_and_object_prototypes_.find(object) !=
169-
array_and_object_prototypes_.end();
139+
return isolate()->IsInCreationContext(
140+
*object, Context::INITIAL_ARRAY_PROTOTYPE_INDEX) ||
141+
object->map(isolate_)->instance_type() == JS_OBJECT_PROTOTYPE_TYPE;
170142
}
171143

172144
ObjectData* JSHeapBroker::TryGetOrCreateData(Tagged<Object> object,

‎deps/v8/src/compiler/js-heap-broker.h‎

Lines changed: 5 additions & 11 deletions

0 commit comments

Comments
 (0)