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

Side by Side Diff: src/objects.cc

Issue 1472293002: Make sure that NormalizeElements and ShouldConvertToFastElements are based on the same values (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 | « src/elements.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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/objects.h" 5 #include "src/objects.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <iomanip> 8 #include <iomanip>
9 #include <sstream> 9 #include <sstream>
10 10
(...skipping 14628 matching lines...) Expand 10 before | Expand all | Expand 10 after
14639 Object* length = JSArray::cast(object)->length(); 14639 Object* length = JSArray::cast(object)->length();
14640 if (!length->IsSmi()) return false; 14640 if (!length->IsSmi()) return false;
14641 *new_capacity = static_cast<uint32_t>(Smi::cast(length)->value()); 14641 *new_capacity = static_cast<uint32_t>(Smi::cast(length)->value());
14642 } else { 14642 } else {
14643 *new_capacity = dictionary->max_number_key() + 1; 14643 *new_capacity = dictionary->max_number_key() + 1;
14644 } 14644 }
14645 *new_capacity = Max(index + 1, *new_capacity); 14645 *new_capacity = Max(index + 1, *new_capacity);
14646 14646
14647 uint32_t dictionary_size = static_cast<uint32_t>(dictionary->Capacity()) * 14647 uint32_t dictionary_size = static_cast<uint32_t>(dictionary->Capacity()) *
14648 SeededNumberDictionary::kEntrySize; 14648 SeededNumberDictionary::kEntrySize;
14649
14650 // Turn fast if the dictionary only saves 50% space.
14649 return 2 * dictionary_size >= *new_capacity; 14651 return 2 * dictionary_size >= *new_capacity;
14650 } 14652 }
14651 14653
14652 14654
14653 // static 14655 // static
14654 MaybeHandle<Object> JSObject::AddDataElement(Handle<JSObject> object, 14656 MaybeHandle<Object> JSObject::AddDataElement(Handle<JSObject> object,
14655 uint32_t index, 14657 uint32_t index,
14656 Handle<Object> value, 14658 Handle<Object> value,
14657 PropertyAttributes attributes) { 14659 PropertyAttributes attributes) {
14658 MAYBE_RETURN_NULL( 14660 MAYBE_RETURN_NULL(
(...skipping 3882 matching lines...) Expand 10 before | Expand all | Expand 10 after
18541 if (cell->value() != *new_value) { 18543 if (cell->value() != *new_value) {
18542 cell->set_value(*new_value); 18544 cell->set_value(*new_value);
18543 Isolate* isolate = cell->GetIsolate(); 18545 Isolate* isolate = cell->GetIsolate();
18544 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18546 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18545 isolate, DependentCode::kPropertyCellChangedGroup); 18547 isolate, DependentCode::kPropertyCellChangedGroup);
18546 } 18548 }
18547 } 18549 }
18548 18550
18549 } // namespace internal 18551 } // namespace internal
18550 } // namespace v8 18552 } // namespace v8
OLDNEW
« no previous file with comments | « src/elements.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698