Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Unified Diff: src/elements.cc

Issue 1341763002: elements.cc CopyDoubleToObjectElements: avoid excessive HandleScopes (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Extending comment Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ }
}
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698