Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index e4ecfe8dd63df799b4bd083f59b849808c6e5973..5e7a84e38b8377a6009a93ecc4967832f168dc19 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -227,7 +227,9 @@ class FastElementsAccessor |
public: |
static MaybeObject* DeleteCommon(JSObject* obj, |
uint32_t key) { |
- ASSERT(obj->HasFastElements() || obj->HasFastArgumentsElements()); |
+ ASSERT(obj->HasFastElements() || |
+ obj->HasFastSmiOnlyElements() || |
+ obj->HasFastArgumentsElements()); |
Heap* heap = obj->GetHeap(); |
FixedArray* backing_store = FixedArray::cast(obj->elements()); |
if (backing_store->map() == heap->non_strict_arguments_elements_map()) { |
@@ -596,6 +598,9 @@ ElementsAccessor* ElementsAccessor::ForArray(FixedArrayBase* array) { |
void ElementsAccessor::InitializeOncePerProcess() { |
static struct ConcreteElementsAccessors { |
+ // Use the fast element handler for smi-only arrays. The implementation is |
+ // currently identical. |
+ FastElementsAccessor fast_smi_elements_handler; |
FastElementsAccessor fast_elements_handler; |
FastDoubleElementsAccessor fast_double_elements_handler; |
DictionaryElementsAccessor dictionary_elements_handler; |
@@ -612,6 +617,7 @@ void ElementsAccessor::InitializeOncePerProcess() { |
} element_accessors; |
static ElementsAccessor* accessor_array[] = { |
+ &element_accessors.fast_smi_elements_handler, |
&element_accessors.fast_elements_handler, |
&element_accessors.fast_double_elements_handler, |
&element_accessors.dictionary_elements_handler, |
@@ -627,6 +633,9 @@ void ElementsAccessor::InitializeOncePerProcess() { |
&element_accessors.pixel_elements_handler |
}; |
+ STATIC_ASSERT((sizeof(accessor_array) / sizeof(*accessor_array)) == |
+ kElementsKindCount); |
+ |
elements_accessors_ = accessor_array; |
} |