Reviewers: Igor Sheludko,
Description:
Ensure that constant-capacity elements are initialized on copy
[email protected]
Please review this at https://codereview.chromium.org/308003015/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+13, -11 lines):
M src/hydrogen.cc
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index
c836dc21653129de5d7255a3c8d8b2e9c63e71c0..c25d1f77d260db6a71e3bbad65a22b5bf2200cab
100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2536,6 +2536,17 @@ void HGraphBuilder::BuildCopyElements(HValue* array,
}
}
+ bool pre_fill_with_holes =
+ IsFastDoubleElementsKind(from_elements_kind) &&
+ IsFastObjectElementsKind(to_elements_kind);
+ if (pre_fill_with_holes) {
+ // If the copy might trigger a GC, make sure that the FixedArray is
+ // pre-initialized with holes to make sure that it's always in a
+ // consistent state.
+ BuildFillElementsWithHole(to_elements, to_elements_kind,
+ graph()->GetConstant0(), NULL);
+ }
+
if (constant_capacity != -1) {
// Unroll the loop for small elements kinds.
for (int i = 0; i < constant_capacity; i++) {
@@ -2546,17 +2557,8 @@ void HGraphBuilder::BuildCopyElements(HValue* array,
Add<HStoreKeyed>(to_elements, key_constant, value, to_elements_kind);
}
} else {
- bool pre_fill_with_holes =
- IsFastDoubleElementsKind(from_elements_kind) &&
- IsFastObjectElementsKind(to_elements_kind);
-
- if (pre_fill_with_holes) {
- // If the copy might trigger a GC, make sure that the FixedArray is
- // pre-initialized with holes to make sure that it's always in a
- // consistent state.
- BuildFillElementsWithHole(to_elements, to_elements_kind,
- graph()->GetConstant0(), NULL);
- } else if (capacity == NULL || !length->Equals(capacity)) {
+ if (!pre_fill_with_holes &&
+ (capacity == NULL || !length->Equals(capacity))) {
BuildFillElementsWithHole(to_elements, to_elements_kind,
length, NULL);
}
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.