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

Unified Diff: src/heap/heap.cc

Issue 1144393003: Also allocate small typed arrays on heap when initialized from an array-like (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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/heap/heap.h ('k') | src/hydrogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 76209c42b5ec1cd198118589b78909cf3329478a..877b21d2eb123aae3b6303575d142a5edc869264 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -3730,6 +3730,7 @@ static void ForFixedTypedArray(ExternalArrayType array_type, int* element_size,
AllocationResult Heap::AllocateFixedTypedArray(int length,
ExternalArrayType array_type,
+ bool initialize,
PretenureFlag pretenure) {
int element_size;
ElementsKind elements_kind;
@@ -3747,7 +3748,7 @@ AllocationResult Heap::AllocateFixedTypedArray(int length,
object->set_map(MapForFixedTypedArray(array_type));
FixedTypedArrayBase* elements = FixedTypedArrayBase::cast(object);
elements->set_length(length);
- memset(elements->DataPtr(), 0, elements->DataSize());
+ if (initialize) memset(elements->DataPtr(), 0, elements->DataSize());
return elements;
}
@@ -4317,7 +4318,7 @@ AllocationResult Heap::CopyAndTenureFixedCOWArray(FixedArray* src) {
AllocationResult Heap::AllocateEmptyFixedTypedArray(
ExternalArrayType array_type) {
- return AllocateFixedTypedArray(0, array_type, TENURED);
+ return AllocateFixedTypedArray(0, array_type, false, TENURED);
}
« no previous file with comments | « src/heap/heap.h ('k') | src/hydrogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698