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

Side by Side Diff: src/objects.cc

Issue 1384673003: Fix FixedArrayBase cast in NumberOfOwnElements (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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 | « no previous file | test/mjsunit/regress/regress-crbug-538086.js » ('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 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 13883 matching lines...) Expand 10 before | Expand all | Expand 10 after
13894 } else { 13894 } else {
13895 return property_dictionary()->CopyKeysTo(storage, index, filter, 13895 return property_dictionary()->CopyKeysTo(storage, index, filter,
13896 NameDictionary::UNSORTED); 13896 NameDictionary::UNSORTED);
13897 } 13897 }
13898 } 13898 }
13899 13899
13900 13900
13901 int JSObject::NumberOfOwnElements(PropertyAttributes filter) { 13901 int JSObject::NumberOfOwnElements(PropertyAttributes filter) {
13902 // Fast case for objects with no elements. 13902 // Fast case for objects with no elements.
13903 if (!IsJSValue() && HasFastElements()) { 13903 if (!IsJSValue() && HasFastElements()) {
13904 uint32_t length = IsJSArray() ? 13904 uint32_t length =
13905 static_cast<uint32_t>( 13905 IsJSArray()
13906 Smi::cast(JSArray::cast(this)->length())->value()) : 13906 ? static_cast<uint32_t>(
13907 static_cast<uint32_t>(FixedArray::cast(elements())->length()); 13907 Smi::cast(JSArray::cast(this)->length())->value())
13908 : static_cast<uint32_t>(FixedArrayBase::cast(elements())->length());
13908 if (length == 0) return 0; 13909 if (length == 0) return 0;
13909 } 13910 }
13910 // Compute the number of enumerable elements. 13911 // Compute the number of enumerable elements.
13911 return GetOwnElementKeys(NULL, filter); 13912 return GetOwnElementKeys(NULL, filter);
13912 } 13913 }
13913 13914
13914 13915
13915 int JSObject::NumberOfEnumElements() { 13916 int JSObject::NumberOfEnumElements() {
13916 return NumberOfOwnElements(static_cast<PropertyAttributes>(DONT_ENUM)); 13917 return NumberOfOwnElements(static_cast<PropertyAttributes>(DONT_ENUM));
13917 } 13918 }
(...skipping 2950 matching lines...) Expand 10 before | Expand all | Expand 10 after
16868 if (cell->value() != *new_value) { 16869 if (cell->value() != *new_value) {
16869 cell->set_value(*new_value); 16870 cell->set_value(*new_value);
16870 Isolate* isolate = cell->GetIsolate(); 16871 Isolate* isolate = cell->GetIsolate();
16871 cell->dependent_code()->DeoptimizeDependentCodeGroup( 16872 cell->dependent_code()->DeoptimizeDependentCodeGroup(
16872 isolate, DependentCode::kPropertyCellChangedGroup); 16873 isolate, DependentCode::kPropertyCellChangedGroup);
16873 } 16874 }
16874 } 16875 }
16875 16876
16876 } // namespace internal 16877 } // namespace internal
16877 } // namespace v8 16878 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-crbug-538086.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698