Index: src/builtins.cc |
diff --git a/src/builtins.cc b/src/builtins.cc |
index 6f1fc0732b566b556082c13f3dc63a97751780a8..9cc26db23b622e67c63ea7f144ea109f93a495de 100644 |
--- a/src/builtins.cc |
+++ b/src/builtins.cc |
@@ -1753,10 +1753,22 @@ |
Handle<JSReceiver> receiver; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
Object::ToObject(isolate, object)); |
- Handle<FixedArray> values; |
+ Handle<FixedArray> keys; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, values, JSReceiver::GetOwnValues(receiver, ENUMERABLE_STRINGS)); |
- return *isolate->factory()->NewJSArrayWithElements(values); |
+ 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); |
} |
@@ -1766,11 +1778,26 @@ |
Handle<JSReceiver> receiver; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, receiver, |
Object::ToObject(isolate, object)); |
- Handle<FixedArray> entries; |
+ Handle<FixedArray> keys; |
ASSIGN_RETURN_FAILURE_ON_EXCEPTION( |
- isolate, entries, |
- JSReceiver::GetOwnEntries(receiver, ENUMERABLE_STRINGS)); |
- return *isolate->factory()->NewJSArrayWithElements(entries); |
+ 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); |
} |