Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 9cc26db23b622e67c63ea7f144ea109f93a495de..6f1fc0732b566b556082c13f3dc63a97751780a8 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -1753,22 +1753,10 @@ BUILTIN(ObjectValues) { |
Handle<JSReceiver> receiver; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
Object::ToObject(isolate, object)); |
- Handle<FixedArray> keys; |
+ Handle<FixedArray> values; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, keys, JSReceiver::GetKeys(receiver, OWN_ONLY, ENUMERABLE_STRINGS, |
- CONVERT_TO_STRING)); |
- |
- for (int i = 0; i < keys->length(); ++i) { |
- auto key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate)); |
- Handle<Object> value; |
- |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, value, Object::GetPropertyOrElement(receiver, key, STRICT)); |
- |
- keys->set(i, *value); |
- } |
- |
- return *isolate->factory()->NewJSArrayWithElements(keys); |
+ isolate, values, JSReceiver::GetOwnValues(receiver, ENUMERABLE_STRINGS)); |
+ return *isolate->factory()->NewJSArrayWithElements(values); |
} |
@@ -1778,26 +1766,11 @@ BUILTIN(ObjectEntries) { |
Handle<JSReceiver> receiver; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
Object::ToObject(isolate, object)); |
- Handle<FixedArray> keys; |
+ Handle<FixedArray> entries; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, keys, JSReceiver::GetKeys(receiver, OWN_ONLY, ENUMERABLE_STRINGS, |
- CONVERT_TO_STRING)); |
- |
- for (int i = 0; i < keys->length(); ++i) { |
- auto key = Handle<Name>::cast(FixedArray::get(*keys, i, isolate)); |
- Handle<Object> value; |
- |
- ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, value, Object::GetPropertyOrElement(receiver, key, STRICT)); |
- |
- auto entry_storage = isolate->factory()->NewUninitializedFixedArray(2); |
- entry_storage->set(0, *key); |
- entry_storage->set(1, *value); |
- auto entry = isolate->factory()->NewJSArrayWithElements(entry_storage); |
- keys->set(i, *entry); |
- } |
- |
- return *isolate->factory()->NewJSArrayWithElements(keys); |
+ isolate, entries, |
+ JSReceiver::GetOwnEntries(receiver, ENUMERABLE_STRINGS)); |
+ return *isolate->factory()->NewJSArrayWithElements(entries); |
} |