Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 94c077422d87c4aa80152160ea772363a28556b7..cdf9bea4c8aa1c1cf2644fbed197c315265b9480 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -8336,7 +8336,9 @@ MaybeHandle<Object> JSReceiver::OrdinaryToPrimitive( |
// TODO(cbruni/jkummerow): Consider moving this into elements.cc. |
-bool HasEnumerableElements(JSObject* object) { |
+bool JSObject::HasEnumerableElements() { |
+ // TODO(cbruni): cleanup |
+ JSObject* object = this; |
switch (object->GetElementsKind()) { |
case FAST_SMI_ELEMENTS: |
case FAST_ELEMENTS: |
@@ -8401,7 +8403,6 @@ bool HasEnumerableElements(JSObject* object) { |
return true; |
} |
- |
// Tests for the fast common case for property enumeration: |
// - This object and all prototypes has an enum cache (which means that |
// it is no proxy, has no interceptors and needs no access checks). |
@@ -8418,7 +8419,7 @@ bool JSReceiver::IsSimpleEnum() { |
if (current->IsAccessCheckNeeded()) return false; |
DCHECK(!current->HasNamedInterceptor()); |
DCHECK(!current->HasIndexedInterceptor()); |
- if (HasEnumerableElements(current)) return false; |
+ if (current->HasEnumerableElements()) return false; |
if (current != this && enum_length != 0) return false; |
} |
return true; |
@@ -8483,10 +8484,9 @@ bool Map::OnlyHasSimpleProperties() { |
!is_dictionary_map(); |
} |
-namespace { |
- |
-Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate, |
- Handle<JSObject> object) { |
+// stati |
Toon Verwaest
2016/02/24 15:07:06
static
|
+Handle<FixedArray> JSObject::GetFastEnumPropertyKeys(Isolate* isolate, |
+ Handle<JSObject> object) { |
Handle<Map> map(object->map()); |
bool cache_enum_length = map->OnlyHasSimpleProperties(); |
@@ -8537,8 +8537,9 @@ Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate, |
for (int i = 0; i < size; i++) { |
PropertyDetails details = descs->GetDetails(i); |
+ if (details.IsDontEnum()) continue; |
Object* key = descs->GetKey(i); |
- if (details.IsDontEnum() || key->IsSymbol()) continue; |
+ if (key->IsSymbol()) continue; |
storage->set(index, key); |
if (!indices.is_null()) { |
if (details.type() != DATA) { |
@@ -8560,7 +8561,6 @@ Handle<FixedArray> GetFastEnumPropertyKeys(Isolate* isolate, |
return storage; |
} |
-} // namespace |
Handle<FixedArray> JSObject::GetEnumPropertyKeys(Handle<JSObject> object) { |
Isolate* isolate = object->GetIsolate(); |
@@ -10840,6 +10840,18 @@ Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj, |
return array; |
} |
+Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Smi* smi, |
+ AddMode mode) { |
+ int length = array->Length(); |
+ array = EnsureSpace(array, length + 1); |
+ if (mode == kReloadLengthAfterAllocation) { |
+ DCHECK(array->Length() <= length); |
+ length = array->Length(); |
+ } |
+ array->Set(length, smi); |
+ array->SetLength(length + 1); |
+ return array; |
+} |
Handle<ArrayList> ArrayList::Add(Handle<ArrayList> array, Handle<Object> obj1, |
Handle<Object> obj2, AddMode mode) { |
@@ -16599,7 +16611,6 @@ void FixedArray::SortPairs(FixedArray* numbers, uint32_t len) { |
} |
} |
- |
void JSObject::CollectOwnPropertyNames(KeyAccumulator* keys, |
PropertyFilter filter) { |
if (HasFastProperties()) { |
@@ -16640,7 +16651,6 @@ int JSObject::NumberOfOwnElements(PropertyFilter filter) { |
return GetOwnElementKeys(NULL, filter); |
} |
- |
void JSObject::CollectOwnElementKeys(Handle<JSObject> object, |
KeyAccumulator* keys, |
PropertyFilter filter) { |
@@ -18640,7 +18650,6 @@ int Dictionary<Derived, Shape, Key>::CopyKeysTo( |
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, |