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

Unified Diff: src/objects.cc

Issue 1086873003: Array() in optimized code can create with wrong ElementsKind in corner cases. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Address comments and test failure. Created 5 years, 8 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/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index bb10a9b1c203b08793c58c5a0c2c936c0a8b9599..4e3ccb4ca79ca8fb57d00eb549d42f0682ee4548 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -11936,15 +11936,9 @@ MUST_USE_RESULT static MaybeHandle<Object> EndPerformSplice(
MaybeHandle<Object> JSArray::SetElementsLength(
Handle<JSArray> array,
Handle<Object> new_length_handle) {
- if (array->HasFastElements()) {
- // If the new array won't fit in a some non-trivial fraction of the max old
- // space size, then force it to go dictionary mode.
- int max_fast_array_size = static_cast<int>(
- (array->GetHeap()->MaxOldGenerationSize() / kDoubleSize) / 4);
- if (new_length_handle->IsNumber() &&
- NumberToInt32(*new_length_handle) >= max_fast_array_size) {
- NormalizeElements(array);
- }
+ if (array->HasFastElements() &&
+ SetElementsLengthWouldNormalize(array->GetHeap(), new_length_handle)) {
+ NormalizeElements(array);
}
// We should never end in here with a pixel or external array.
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698