[runtime] JSObject::GetKeys never returns the EnumCache, so we don't need to copy

BUG=148757
LOG=n

Review URL: https://codereview.chromium.org/1768443003

Cr-Commit-Position: refs/heads/master@{#34495}
This commit is contained in:
verwaest 2016-03-04 05:22:41 -08:00 committed by Commit bot
parent 10f6a9e62b
commit 4e46149f5a

View File

@ -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));
}