Index: src/api.cc |
diff --git a/src/api.cc b/src/api.cc |
index bf57a3aa14376ab17e6c42a8004561e72a2f80e6..0fd806cdbd6a2e039f818ab94e052dc7864bf718 100644 |
--- a/src/api.cc |
+++ b/src/api.cc |
@@ -3791,11 +3791,10 @@ MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context) { |
!i::JSReceiver::GetKeys(self, i::OWN_ONLY, i::ENUMERABLE_STRINGS) |
.ToHandle(&value); |
RETURN_ON_FAILED_EXECUTION(Array); |
- // Because we use caching to speed up enumeration it is important |
- // to never change the result of the basic enumeration function so |
- // we clone the result. |
- auto elms = isolate->factory()->CopyFixedArray(value); |
- auto result = isolate->factory()->NewJSArrayWithElements(elms); |
+ DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel || |
+ self->map()->EnumLength() == 0 || |
+ self->map()->instance_descriptors()->GetEnumCache() != *value); |
+ auto result = isolate->factory()->NewJSArrayWithElements(value); |
RETURN_ESCAPED(Utils::ToLocal(result)); |
} |