| Index: src/api.cc
|
| diff --git a/src/api.cc b/src/api.cc
|
| index e5bcd24bd7b7ff4238a5266ea038d3d2ad9c68e0..32db8e7768e9deee23e97b6df85017b379d4ddf8 100644
|
| --- a/src/api.cc
|
| +++ b/src/api.cc
|
| @@ -3867,15 +3867,27 @@ Local<Object> v8::Object::FindInstanceInPrototypeChain(
|
| return Utils::ToLocal(i::handle(iter.GetCurrent<i::JSObject>(), isolate));
|
| }
|
|
|
| -
|
| MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context) {
|
| + return GetPropertyNames(
|
| + context, INCLUDE_PROTOS,
|
| + static_cast<v8::PropertyFilter>(ONLY_ENUMERABLE | SKIP_SYMBOLS),
|
| + INCLUDE_INDICES);
|
| +}
|
| +
|
| +MaybeLocal<Array> v8::Object::GetPropertyNames(Local<Context> context,
|
| + KeysCollectionLimit limit,
|
| + PropertyFilter property_filter,
|
| + IndexFilter index_filter) {
|
| PREPARE_FOR_EXECUTION(context, Object, GetPropertyNames, Array);
|
| auto self = Utils::OpenHandle(this);
|
| i::Handle<i::FixedArray> value;
|
| - has_pending_exception = !i::KeyAccumulator::GetKeys(self, i::INCLUDE_PROTOS,
|
| - i::ENUMERABLE_STRINGS)
|
| - .ToHandle(&value);
|
| + i::KeyAccumulator accumulator(
|
| + isolate, static_cast<i::KeysCollectionLimit>(limit),
|
| + static_cast<i::PropertyFilter>(property_filter));
|
| + accumulator.set_skip_indices(index_filter == SKIP_INDICES);
|
| + has_pending_exception = accumulator.CollectKeys(self, self).IsNothing();
|
| RETURN_ON_FAILED_EXECUTION(Array);
|
| + value = accumulator.GetKeys(i::CONVERT_TO_STRING);
|
| DCHECK(self->map()->EnumLength() == i::kInvalidEnumCacheSentinel ||
|
| self->map()->EnumLength() == 0 ||
|
| self->map()->instance_descriptors()->GetEnumCache() != *value);
|
| @@ -3901,19 +3913,7 @@ Local<Array> v8::Object::GetOwnPropertyNames() {
|
|
|
| MaybeLocal<Array> v8::Object::GetOwnPropertyNames(Local<Context> context,
|
| PropertyFilter filter) {
|
| - PREPARE_FOR_EXECUTION(context, Object, GetOwnPropertyNames, Array);
|
| - auto self = Utils::OpenHandle(this);
|
| - i::Handle<i::FixedArray> value;
|
| - has_pending_exception =
|
| - !i::KeyAccumulator::GetKeys(self, i::OWN_ONLY,
|
| - static_cast<i::PropertyFilter>(filter))
|
| - .ToHandle(&value);
|
| - RETURN_ON_FAILED_EXECUTION(Array);
|
| - 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));
|
| + return GetPropertyNames(context, OWN_ONLY, filter, INCLUDE_INDICES);
|
| }
|
|
|
| MaybeLocal<String> v8::Object::ObjectProtoToString(Local<Context> context) {
|
|
|