}
+void JSArray::EnsureSize(int required_size) {
+ ASSERT(HasFastElements());
+ if (elements()->length() >= required_size) return;
+ Expand(required_size);
+}
+
+
void JSArray::SetContent(FixedArray* storage) {
set_length(Smi::FromInt(storage->length()), SKIP_WRITE_BARRIER);
set_elements(storage);
}
-void JSArray::EnsureSize(int required_size) {
+void JSArray::Expand(int required_size) {
Handle<JSArray> self(this);
- ASSERT(HasFastElements());
- if (elements()->length() >= required_size) return;
Handle<FixedArray> old_backing(elements());
int old_size = old_backing->length();
// Doubling in size would be overkill, but leave some slack to avoid
// Uses handles. Ensures that the fixed array backing the JSArray has at
// least the stated size.
- void EnsureSize(int minimum_size_of_backing_fixed_array);
+ inline void EnsureSize(int minimum_size_of_backing_fixed_array);
// Dispatched behavior.
#ifdef DEBUG
static const int kSize = kLengthOffset + kPointerSize;
private:
+ // Expand the fixed array backing of a fast-case JSArray to at least
+ // the requested size.
+ void Expand(int minimum_size_of_backing_fixed_array);
+
DISALLOW_IMPLICIT_CONSTRUCTORS(JSArray);
};