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

Side by Side Diff: src/elements.cc

Issue 1568223002: Version 4.8.271.13 (cherry-pick) (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@4.8
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « include/v8-version.h ('k') | src/objects.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/elements.h" 5 #include "src/elements.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/conversions.h" 8 #include "src/conversions.h"
9 #include "src/factory.h" 9 #include "src/factory.h"
10 #include "src/messages.h" 10 #include "src/messages.h"
(...skipping 1217 matching lines...) Expand 10 before | Expand all | Expand 10 after
1228 for (i = entry + 1; i < length; i++) { 1228 for (i = entry + 1; i < length; i++) {
1229 if (!backing_store->is_the_hole(i)) break; 1229 if (!backing_store->is_the_hole(i)) break;
1230 } 1230 }
1231 if (i == length) { 1231 if (i == length) {
1232 DeleteAtEnd(obj, backing_store, entry); 1232 DeleteAtEnd(obj, backing_store, entry);
1233 return; 1233 return;
1234 } 1234 }
1235 } 1235 }
1236 int num_used = 0; 1236 int num_used = 0;
1237 for (int i = 0; i < backing_store->length(); ++i) { 1237 for (int i = 0; i < backing_store->length(); ++i) {
1238 if (!backing_store->is_the_hole(i)) ++num_used; 1238 if (!backing_store->is_the_hole(i)) {
1239 // Bail out early if more than 1/4 is used. 1239 ++num_used;
1240 if (4 * num_used > backing_store->length()) break; 1240 // Bail out if a number dictionary wouldn't be able to save at least
1241 // 75% space.
1242 if (4 * SeededNumberDictionary::ComputeCapacity(num_used) *
1243 SeededNumberDictionary::kEntrySize >
1244 backing_store->length()) {
1245 return;
1246 }
1247 }
1241 } 1248 }
1242 if (4 * num_used <= backing_store->length()) { 1249 JSObject::NormalizeElements(obj);
1243 JSObject::NormalizeElements(obj);
1244 }
1245 } 1250 }
1246 } 1251 }
1247 1252
1248 static void ReconfigureImpl(Handle<JSObject> object, 1253 static void ReconfigureImpl(Handle<JSObject> object,
1249 Handle<FixedArrayBase> store, uint32_t entry, 1254 Handle<FixedArrayBase> store, uint32_t entry,
1250 Handle<Object> value, 1255 Handle<Object> value,
1251 PropertyAttributes attributes) { 1256 PropertyAttributes attributes) {
1252 Handle<SeededNumberDictionary> dictionary = 1257 Handle<SeededNumberDictionary> dictionary =
1253 JSObject::NormalizeElements(object); 1258 JSObject::NormalizeElements(object);
1254 entry = dictionary->FindEntry(entry); 1259 entry = dictionary->FindEntry(entry);
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
2382 } 2387 }
2383 } 2388 }
2384 2389
2385 DCHECK(j == result_len); 2390 DCHECK(j == result_len);
2386 return result_array; 2391 return result_array;
2387 } 2392 }
2388 2393
2389 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL; 2394 ElementsAccessor** ElementsAccessor::elements_accessors_ = NULL;
2390 } // namespace internal 2395 } // namespace internal
2391 } // namespace v8 2396 } // namespace v8
OLDNEW
« no previous file with comments | « include/v8-version.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698