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

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

Issue 1492653004: [cleanup] Introduce PropertyFilter (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: windows ♥ Created 5 years 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/cctest/test-alloc.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 ad69a1004bf27bb847b8ce5c6fe46427390d690d..25cadc68d9fb7df7877f234baa6db2268d9078aa 100644
--- a/src/runtime/runtime-object.cc
+++ b/src/runtime/runtime-object.cc
@@ -214,14 +214,13 @@ MUST_USE_RESULT static MaybeHandle<Object> GetOwnProperty(Isolate* isolate,
Heap* heap = isolate->heap();
Factory* factory = isolate->factory();
- PropertyAttributes attrs;
// Get attributes.
LookupIterator it = LookupIterator::PropertyOrElement(isolate, obj, name,
LookupIterator::HIDDEN);
Maybe<PropertyAttributes> maybe = JSObject::GetPropertyAttributes(&it);
if (!maybe.IsJust()) return MaybeHandle<Object>();
- attrs = maybe.FromJust();
+ PropertyAttributes attrs = maybe.FromJust();
if (attrs == ABSENT) return factory->undefined_value();
DCHECK(!isolate->has_pending_exception());
@@ -787,8 +786,8 @@ RUNTIME_FUNCTION(Runtime_GetPropertyNamesFast) {
Handle<JSReceiver> object(raw_object);
Handle<FixedArray> content;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, content,
- JSReceiver::GetKeys(object, JSReceiver::INCLUDE_PROTOS));
+ isolate, content, JSReceiver::GetKeys(object, JSReceiver::INCLUDE_PROTOS,
+ ENUMERABLE_STRINGS));
// Test again, since cache may have been built by preceding call.
if (object->IsSimpleEnum()) return object->map();
@@ -810,7 +809,20 @@ RUNTIME_FUNCTION(Runtime_GetOwnPropertyNames) {
}
CONVERT_ARG_HANDLE_CHECKED(JSObject, object, 0);
CONVERT_SMI_ARG_CHECKED(filter_value, 1);
- PropertyAttributes filter = static_cast<PropertyAttributes>(filter_value);
+
+ // TODO(jkummerow): Temporary compatibility measure. Refactor callers.
+ // Values of filter_value are defined in macros.py.
+ PropertyFilter filter = ALL_PROPERTIES;
+ if (filter_value & 2) {
+ filter = static_cast<PropertyFilter>(filter | ONLY_ENUMERABLE);
+ }
+ if (filter_value & 8) {
+ filter = static_cast<PropertyFilter>(filter | SKIP_STRINGS);
+ }
+ if (filter_value & 16) {
+ filter = static_cast<PropertyFilter>(filter | SKIP_SYMBOLS);
+ }
+ DCHECK(filter_value & 32);
// Find the number of own properties for each of the objects.
int total_property_count = 0;
@@ -925,9 +937,9 @@ RUNTIME_FUNCTION(Runtime_GetOwnElementNames) {
object = PrototypeIterator::GetCurrent<JSObject>(iter);
}
- int n = object->NumberOfOwnElements(NONE);
+ int n = object->NumberOfOwnElements(ALL_PROPERTIES);
Handle<FixedArray> names = isolate->factory()->NewFixedArray(n);
- object->GetOwnElementKeys(*names, NONE);
+ object->GetOwnElementKeys(*names, ALL_PROPERTIES);
return *isolate->factory()->NewJSArrayWithElements(names);
}
@@ -991,8 +1003,9 @@ RUNTIME_FUNCTION(Runtime_OwnKeys) {
Handle<FixedArray> contents;
ASSIGN_RETURN_FAILURE_ON_EXCEPTION(
- isolate, contents, JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY,
- SKIP_SYMBOLS, CONVERT_TO_STRING));
+ isolate, contents,
+ JSReceiver::GetKeys(object, JSReceiver::OWN_ONLY, ENUMERABLE_STRINGS,
+ CONVERT_TO_STRING));
return *isolate->factory()->NewJSArrayWithElements(contents);
}
« no previous file with comments | « src/runtime/runtime-array.cc ('k') | test/cctest/test-alloc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698