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

Unified Diff: src/objects.cc

Issue 1769043003: Revert of [key-accumulator] Starting to reimplement the key-accumulator (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 9 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/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index 0def5286ec3d22d83500452646f5c302c2e4c1f5..1100adb3fc98d2bee567ea5ed65e78ed7d96d219 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -34,7 +34,7 @@
#include "src/interpreter/bytecodes.h"
#include "src/interpreter/source-position-table.h"
#include "src/isolate-inl.h"
-#include "src/keys.h"
+#include "src/key-accumulator.h"
#include "src/list.h"
#include "src/log.h"
#include "src/lookup.h"
@@ -8239,9 +8239,7 @@
// TODO(cbruni/jkummerow): Consider moving this into elements.cc.
-bool JSObject::HasEnumerableElements() {
- // TODO(cbruni): cleanup
- JSObject* object = this;
+bool HasEnumerableElements(JSObject* object) {
switch (object->GetElementsKind()) {
case FAST_SMI_ELEMENTS:
case FAST_ELEMENTS:
@@ -8305,6 +8303,7 @@
UNREACHABLE();
return true;
}
+
// Tests for the fast common case for property enumeration:
// - This object and all prototypes has an enum cache (which means that
@@ -8322,7 +8321,7 @@
if (current->IsAccessCheckNeeded()) return false;
DCHECK(!current->HasNamedInterceptor());
DCHECK(!current->HasIndexedInterceptor());
- if (current->HasEnumerableElements()) return false;
+ if (HasEnumerableElements(current)) return false;
if (current != this && enum_length != 0) return false;
}
return true;
@@ -8386,9 +8385,10 @@
!has_hidden_prototype() && !is_dictionary_map();
}
-// static
-Handle<FixedArray> JSObject::GetFastEnumPropertyKeys(Isolate* isolate,
- Handle<JSObject> object) {
+namespace {
+
+Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate,
+ Handle<JSObject> object) {
Handle<Map> map(object->map());
bool cache_enum_length = map->OnlyHasSimpleProperties();
@@ -8439,9 +8439,8 @@
for (int i = 0; i < size; i++) {
PropertyDetails details = descs->GetDetails(i);
- if (details.IsDontEnum()) continue;
Object* key = descs->GetKey(i);
- if (key->IsSymbol()) continue;
+ if (details.IsDontEnum() || key->IsSymbol()) continue;
storage->set(index, key);
if (!indices.is_null()) {
if (details.type() != DATA) {
@@ -8463,6 +8462,7 @@
return storage;
}
+} // namespace
Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object) {
Isolate* isolate = object->GetIsolate();
@@ -10679,6 +10679,7 @@
array->SetLength(length + 1);
return array;
}
+
Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1,
Handle<Object> obj2, AddMode mode) {
@@ -16441,6 +16442,7 @@
}
}
+
void JSObject::CollectOwnPropertyNames(KeyAccumulator* keys,
PropertyFilter filter) {
if (HasFastProperties()) {
@@ -16480,6 +16482,7 @@
// Compute the number of enumerable elements.
return GetOwnElementKeys(NULL, filter);
}
+
void JSObject::CollectOwnElementKeys(Handle<JSObject> object,
KeyAccumulator* keys,
@@ -18488,6 +18491,7 @@
return index - start_index;
}
+
template <typename Derived, typename Shape, typename Key>
void Dictionary<Derived, Shape, Key>::CollectKeysTo(
Handle<Dictionary<Derived, Shape, Key> > dictionary, KeyAccumulator* keys,
« no previous file with comments | « src/objects.h ('k') | src/objects-printer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698