Index: src/elements.cc |
diff --git a/src/elements.cc b/src/elements.cc |
index 3b3cda0abfe666d6e652fb41049b29c22fe3b382..ff3e29888bf6f73d48ff47e67913423301765de2 100644 |
--- a/src/elements.cc |
+++ b/src/elements.cc |
@@ -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); |
+ } |
} |
} |
} |