Once gain JSArray, JSVector is disabled, do not touch.
| 115 | |
| 116 | // Once gain JSArray, JSVector is disabled, do not touch. |
| 117 | JSArray* ToJSArray() { |
| 118 | const size_type total = size(); |
| 119 | if (total > IndexedElements::kMaxVectorSize) { |
| 120 | // alloc map |
| 121 | SparseArrayMap* sparse = elements_.EnsureMap(); |
| 122 | uint32_t i = IndexedElements::kMaxVectorSize; |
| 123 | for (const_iterator it = cbegin() + i, |
| 124 | last = cend(); it != last; ++it, ++i) { |
| 125 | sparse->insert(std::make_pair(i, StoredSlot(*it, ATTR::Object::Data()))); |
| 126 | } |
| 127 | elements_.vector.resize(IndexedElements::kMaxVectorSize); |
| 128 | } |
| 129 | elements_.set_length(total); |
| 130 | return static_cast<JSArray*>(this); |
| 131 | } |
| 132 | |
| 133 | private: |
| 134 | explicit JSVector(Context* ctx) |
no test coverage detected