mirror of
https://github.com/Samsung/escargot.git
synced 2026-06-22 10:01:50 +00:00
1. optimize String buffer acquire functions
2. implment String.prototype.toLowerCase, toUpperCase 3. implment Array.prototype.sort 4. fix codeBlock bugs Signed-off-by: seonghyun kim <sh8281.kim@samsung.com>
This commit is contained in:
parent
5da7c24500
commit
61eb45b0c7
20 changed files with 444 additions and 104 deletions
|
|
@ -75,4 +75,19 @@ void ArrayObject::enumeration(ExecutionState& state, std::function<bool(const Ob
|
|||
}
|
||||
Object::enumeration(state, callback);
|
||||
}
|
||||
|
||||
void ArrayObject::sort(ExecutionState& state, std::function<bool(const Value& a, const Value& b)> comp)
|
||||
{
|
||||
if (isFastModeArray()) {
|
||||
if (m_fastModeData.size()) {
|
||||
std::vector<Value, gc_malloc_ignore_off_page_allocator<Value>> values(&m_fastModeData[0], m_fastModeData.data() + m_fastModeData.size());
|
||||
std::sort(values.begin(), values.end(), comp);
|
||||
for (size_t i = 0; i < values.size(); i++) {
|
||||
m_fastModeData[i] = values[i];
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
Object::sort(state, comp);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue