Commit 43a04030 authored by cbruni's avatar cbruni Committed by Commit bot

elements.cc CopyDoubleToObjectElements: avoid excessive HandleScopes

BUG=

Review URL: https://codereview.chromium.org/1341763002

Cr-Commit-Position: refs/heads/master@{#30717}
parent a0bc7651
......@@ -253,14 +253,22 @@ static void CopyDoubleToObjectElements(FixedArrayBase* from_base,
Isolate* isolate = from_base->GetIsolate();
Handle<FixedDoubleArray> from(FixedDoubleArray::cast(from_base), isolate);
Handle<FixedArray> to(FixedArray::cast(to_base), isolate);
for (int i = 0; i < copy_size; ++i) {
// create an outer loop to not waste too much time on creating HandleScopes
// on the other hand we might overflow a single handle scope depending on
// the copy_size
int offset = 0;
while (offset < copy_size) {
HandleScope scope(isolate);
if (IsFastSmiElementsKind(to_kind)) {
UNIMPLEMENTED();
} else {
DCHECK(IsFastObjectElementsKind(to_kind));
Handle<Object> value = FixedDoubleArray::get(from, i + from_start);
to->set(i + to_start, *value, UPDATE_WRITE_BARRIER);
offset += 100;
for (int i = offset - 100; i < offset && i < copy_size; ++i) {
if (IsFastSmiElementsKind(to_kind)) {
UNIMPLEMENTED();
} else {
DCHECK(IsFastObjectElementsKind(to_kind));
Handle<Object> value = FixedDoubleArray::get(from, i + from_start);
to->set(i + to_start, *value, UPDATE_WRITE_BARRIER);
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment