Index: src/objects-inl.h |
diff --git a/src/objects-inl.h b/src/objects-inl.h |
index 006aff394c20cd517c516e0823424f3aa42c9c80..7b2ac766418d7e4dce84ee3d1d6edb2da2d75501 100644 |
--- a/src/objects-inl.h |
+++ b/src/objects-inl.h |
@@ -5516,19 +5516,24 @@ ElementsKind JSObject::GetElementsKind() { |
#if DEBUG |
FixedArrayBase* fixed_array = |
reinterpret_cast<FixedArrayBase*>(READ_FIELD(this, kElementsOffset)); |
- Map* map = fixed_array->map(); |
- ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
- (map == GetHeap()->fixed_array_map() || |
- map == GetHeap()->fixed_cow_array_map())) || |
- (IsFastDoubleElementsKind(kind) && |
- (fixed_array->IsFixedDoubleArray() || |
- fixed_array == GetHeap()->empty_fixed_array())) || |
- (kind == DICTIONARY_ELEMENTS && |
+ |
+ // If a GC was caused while constructing this object, the elements |
+ // pointer may point to a one pointer filler map. |
+ if (ElementsAreSafeToExamine()) { |
+ Map* map = fixed_array->map(); |
+ ASSERT((IsFastSmiOrObjectElementsKind(kind) && |
+ (map == GetHeap()->fixed_array_map() || |
+ map == GetHeap()->fixed_cow_array_map())) || |
+ (IsFastDoubleElementsKind(kind) && |
+ (fixed_array->IsFixedDoubleArray() || |
+ fixed_array == GetHeap()->empty_fixed_array())) || |
+ (kind == DICTIONARY_ELEMENTS && |
fixed_array->IsFixedArray() && |
- fixed_array->IsDictionary()) || |
- (kind > DICTIONARY_ELEMENTS)); |
- ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || |
- (elements()->IsFixedArray() && elements()->length() >= 2)); |
+ fixed_array->IsDictionary()) || |
+ (kind > DICTIONARY_ELEMENTS)); |
+ ASSERT((kind != NON_STRICT_ARGUMENTS_ELEMENTS) || |
+ (elements()->IsFixedArray() && elements()->length() >= 2)); |
+ } |
#endif |
return kind; |
} |