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

Unified Diff: src/hydrogen.cc

Issue 330053002: ARM, ARM64: Optimize array copy (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 6 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 | « src/arm64/macro-assembler-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 3162eb606ad687924ae6bcd9ff04d0a1e9570869..cf48732b157b5e8bcc8ef1c86e3ded0fed578ae1 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -2696,6 +2696,11 @@ void HGraphBuilder::BuildFillElementsWithValue(HValue* elements,
to = AddLoadFixedArrayLength(elements);
}
+#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
+ from = AddUncasted<HForceRepresentation>(from, Representation::Integer32());
+ to = AddUncasted<HForceRepresentation>(to, Representation::Integer32());
+ Add<HFillElements>(elements, from, to, value);
+#else
// Special loop unfolding case
STATIC_ASSERT(JSArray::kPreallocatedArrayElements <=
kElementLoopUnrollThreshold);
@@ -2736,6 +2741,7 @@ void HGraphBuilder::BuildFillElementsWithValue(HValue* elements,
builder.EndBody();
}
+#endif
}
@@ -2803,42 +2809,52 @@ void HGraphBuilder::BuildCopyElements(HValue* from_elements,
capacity = AddLoadFixedArrayLength(to_elements);
}
- LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement);
-
- HValue* key = builder.BeginBody(length, graph()->GetConstant0(),
- Token::GT);
-
- key = AddUncasted<HSub>(key, graph()->GetConstant1());
- key->ClearFlag(HValue::kCanOverflow);
-
- HValue* element = Add<HLoadKeyed>(from_elements, key,
- static_cast<HValue*>(NULL),
- from_elements_kind,
- ALLOW_RETURN_HOLE);
-
- ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) &&
- IsFastSmiElementsKind(to_elements_kind))
- ? FAST_HOLEY_ELEMENTS : to_elements_kind;
-
- if (IsHoleyElementsKind(from_elements_kind) &&
- from_elements_kind != to_elements_kind) {
- IfBuilder if_hole(this);
- if_hole.If<HCompareHoleAndBranch>(element);
- if_hole.Then();
- HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind)
- ? Add<HConstant>(FixedDoubleArray::hole_nan_as_double())
- : graph()->GetConstantHole();
- Add<HStoreKeyed>(to_elements, key, hole_constant, kind);
- if_hole.Else();
- HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
- store->SetFlag(HValue::kAllowUndefinedAsNaN);
- if_hole.End();
+#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
+ if (from_elements_kind == to_elements_kind) {
+ length =
+ AddUncasted<HForceRepresentation>(length, Representation::Integer32());
+ Add<HCopyElements>(from_elements, to_elements, length, to_elements_kind);
} else {
- HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
- store->SetFlag(HValue::kAllowUndefinedAsNaN);
- }
+#endif
+ LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement);
+
+ HValue* key = builder.BeginBody(length, graph()->GetConstant0(),
+ Token::GT);
+
+ key = AddUncasted<HSub>(key, graph()->GetConstant1());
+ key->ClearFlag(HValue::kCanOverflow);
+
+ HValue* element = Add<HLoadKeyed>(from_elements, key,
+ static_cast<HValue*>(NULL),
+ from_elements_kind,
+ ALLOW_RETURN_HOLE);
+
+ ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) &&
+ IsFastSmiElementsKind(to_elements_kind))
+ ? FAST_HOLEY_ELEMENTS : to_elements_kind;
+
+ if (IsHoleyElementsKind(from_elements_kind) &&
+ from_elements_kind != to_elements_kind) {
+ IfBuilder if_hole(this);
+ if_hole.If<HCompareHoleAndBranch>(element);
+ if_hole.Then();
+ HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind)
+ ? Add<HConstant>(FixedDoubleArray::hole_nan_as_double())
+ : graph()->GetConstantHole();
+ Add<HStoreKeyed>(to_elements, key, hole_constant, kind);
+ if_hole.Else();
+ HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
+ store->SetFlag(HValue::kAllowUndefinedAsNaN);
+ if_hole.End();
+ } else {
+ HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
+ store->SetFlag(HValue::kAllowUndefinedAsNaN);
+ }
- builder.EndBody();
+ builder.EndBody();
+#if V8_TARGET_ARCH_ARM || V8_TARGET_ARCH_ARM64
+ }
+#endif
}
Counters* counters = isolate()->counters();
« no previous file with comments | « src/arm64/macro-assembler-arm64.cc ('k') | src/hydrogen-instructions.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698