Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1109)

Unified Diff: src/runtime/runtime-object.cc

Issue 1397063002: [runtime] Fancify KeyAccumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: nits Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/third_party/object-keys/object-keys.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime/runtime-object.cc
diff --git a/src/runtime/runtime-object.cc b/src/runtime/runtime-object.cc
index 53e541a2c8cdd3d7ccaedf96490995ad430d9920..423d60e5e20c962fd5ab88303a0a2ef91e19df98 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -981,34 +981,9 @@ RUNTIME_FUNCTION(Runtime_OwnKeys) {
Handle<FixedArray> contents;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, contents, JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY));
-
- // Some fast paths through GetKeysInFixedArrayFor reuse a cached
- // property array and since the result is mutable we have to create
- // a fresh clone on each invocation.
- int length = contents->length();
- Handle<FixedArray> copy = isolate->factory()->NewFixedArray(length);
- int offset = 0;
- // Use an outer loop to avoid creating too many handles in the current
- // handle scope.
- while (offset < length) {
- HandleScope scope(isolate);
- offset += 100;
- int end = Min(offset, length);
- for (int i = offset - 100; i < end; i++) {
- Object* entry = contents->get(i);
- if (entry->IsString()) {
- copy->set(i, entry);
- } else {
- DCHECK(entry->IsNumber());
- Handle<Object> entry_handle(entry, isolate);
- Handle<Object> entry_str =
- isolate->factory()->NumberToString(entry_handle);
- copy->set(i, *entry_str);
- }
- }
- }
- return *isolate->factory()->NewJSArrayWithElements(copy);
+ isolate, contents, JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY,
+ SKIP_SYMBOLS, CONVERT_TO_STRING));
+ return *isolate->factory()->NewJSArrayWithElements(contents);
}
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/mjsunit/third_party/object-keys/object-keys.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698