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

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

Issue 1378323003: [runtime-object]: part fix element key list on global object (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixing 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 | « no previous file | test/cctest/test-global-object.cc » ('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 2e3fea2bb4282724e3c630c32374bf0210ecd9ee..f45447c429dca5492d67562e114d2910f30dffcf 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -896,11 +896,23 @@ RUNTIME_FUNCTION(Runtime_GetOwnElementNames) {
if (!args[0]->IsJSObject()) {
return isolate->heap()->undefined_value();
}
- CONVERT_ARG_HANDLE_CHECKED(JSObject, obj, 0);
+ CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
+
+ // TODO(cbruni): implement proper prototype lookup like in GetOwnPropertyNames
+ if (object->IsJSGlobalProxy()) {
+ // All the elements are stored on the globa_object and not directly on the
+ // global object proxy.
+ PrototypeIterator iter(isolate, object,
+ PrototypeIterator::START_AT_PROTOTYPE);
+ if (iter.IsAtEnd(PrototypeIterator::END_AT_NON_HIDDEN)) {
+ return *isolate->factory()->NewJSArray(0);
+ }
+ object = PrototypeIterator::GetCurrent<JSObject>(iter);
+ }
- int n = obj->NumberOfOwnElements(NONE);
+ int n = object->NumberOfOwnElements(NONE);
Handle<FixedArray> names = isolate->factory()->NewFixedArray(n);
- obj->GetOwnElementKeys(*names, NONE);
+ object->GetOwnElementKeys(*names, NONE);
return *isolate->factory()->NewJSArrayWithElements(names);
}
« no previous file with comments | « no previous file | test/cctest/test-global-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698