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

Unified Diff: src/objects-inl.h

Issue 1191313003: More cleanup related to setting array.length (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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/objects.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects-inl.h
diff --git a/src/objects-inl.h b/src/objects-inl.h
index 203f152d9bc2e882e31cd515341e1419c47fe030..39891513caedde2ee0179e71d31a14af71040e70 100644
--- a/src/objects-inl.h
+++ b/src/objects-inl.h
@@ -6969,18 +6969,16 @@ void JSArray::set_length(Smi* length) {
}
-bool JSArray::SetElementsLengthWouldNormalize(
- Heap* heap, Handle<Object> new_length_handle) {
+bool JSArray::SetLengthWouldNormalize(Heap* heap, uint32_t new_length) {
// 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>((heap->MaxOldGenerationSize() / kDoubleSize) / 4);
- return new_length_handle->IsNumber() &&
- NumberToInt32(*new_length_handle) >= max_fast_array_size;
+ uint32_t max_fast_array_size =
+ static_cast<uint32_t>((heap->MaxOldGenerationSize() / kDoubleSize) / 4);
+ return new_length >= max_fast_array_size;
}
-bool JSArray::AllowsSetElementsLength() {
+bool JSArray::AllowsSetLength() {
bool result = elements()->IsFixedArray() || elements()->IsFixedDoubleArray();
DCHECK(result == !HasExternalArrayElements());
return result;
« no previous file with comments | « src/objects.cc ('k') | src/runtime/runtime-array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698