MCPcopy Create free account
hub / github.com/Constellation/iv / ToJSArray

Method ToJSArray

iv/lv5/jsvector.h:117–131  ·  view source on GitHub ↗

Once gain JSArray, JSVector is disabled, do not touch.

Source from the content-addressed store, hash-verified

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)

Callers 15

SupportedLocalesFunction · 0.80
SplitMethod · 0.80
ParseJSONArrayMethod · 0.80
ExecGlobalMethod · 0.80
ExecMethod · 0.80
VisitMethod · 0.80
SupportedLocalesFunction · 0.80
ObjectKeysFunction · 0.80
ReflectKeysFunction · 0.80
ArrayConstructorFunction · 0.80

Calls 7

sizeFunction · 0.85
EnsureMapMethod · 0.80
set_lengthMethod · 0.80
StoredSlotClass · 0.70
DataClass · 0.50
insertMethod · 0.45
resizeMethod · 0.45

Tested by

no test coverage detected