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

Side by Side Diff: src/objects.cc

Issue 1021163002: Revert of Add debug checks to catch PropertyCell::cast failures. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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 | « src/lookup-inl.h ('k') | src/runtime/runtime-object.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 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 <iomanip> 5 #include <iomanip>
6 #include <sstream> 6 #include <sstream>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 15183 matching lines...) Expand 10 before | Expand all | Expand 10 after
15194 DCHECK(!global->HasFastProperties()); 15194 DCHECK(!global->HasFastProperties());
15195 auto dictionary = handle(global->property_dictionary()); 15195 auto dictionary = handle(global->property_dictionary());
15196 int entry = dictionary->FindEntry(name); 15196 int entry = dictionary->FindEntry(name);
15197 Handle<PropertyCell> cell; 15197 Handle<PropertyCell> cell;
15198 if (entry != NameDictionary::kNotFound) { 15198 if (entry != NameDictionary::kNotFound) {
15199 // This call should be idempotent. 15199 // This call should be idempotent.
15200 DCHECK(dictionary->DetailsAt(entry).cell_type() == 15200 DCHECK(dictionary->DetailsAt(entry).cell_type() ==
15201 PropertyCellType::kUninitialized || 15201 PropertyCellType::kUninitialized ||
15202 dictionary->DetailsAt(entry).cell_type() == 15202 dictionary->DetailsAt(entry).cell_type() ==
15203 PropertyCellType::kDeleted); 15203 PropertyCellType::kDeleted);
15204 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell());
15205 cell = handle(PropertyCell::cast(dictionary->ValueAt(entry))); 15204 cell = handle(PropertyCell::cast(dictionary->ValueAt(entry)));
15206 DCHECK(cell->value()->IsTheHole()); 15205 DCHECK(cell->value()->IsTheHole());
15207 return cell; 15206 return cell;
15208 } 15207 }
15209 Isolate* isolate = global->GetIsolate(); 15208 Isolate* isolate = global->GetIsolate();
15210 cell = isolate->factory()->NewPropertyCell(); 15209 cell = isolate->factory()->NewPropertyCell();
15211 PropertyDetails details(NONE, DATA, 0, PropertyCellType::kUninitialized); 15210 PropertyDetails details(NONE, DATA, 0, PropertyCellType::kUninitialized);
15212 dictionary = NameDictionary::Add(dictionary, name, cell, details); 15211 dictionary = NameDictionary::Add(dictionary, name, cell, details);
15213 global->set_properties(*dictionary); 15212 global->set_properties(*dictionary);
15214 return cell; 15213 return cell;
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
15811 return dictionary; 15810 return dictionary;
15812 } 15811 }
15813 15812
15814 15813
15815 template <DictionaryEntryType type, typename D> 15814 template <DictionaryEntryType type, typename D>
15816 static inline bool IsDeleted(D d, int i) { 15815 static inline bool IsDeleted(D d, int i) {
15817 switch (type) { 15816 switch (type) {
15818 case DictionaryEntryType::kObjects: 15817 case DictionaryEntryType::kObjects:
15819 return false; 15818 return false;
15820 case DictionaryEntryType::kCells: 15819 case DictionaryEntryType::kCells:
15821 DCHECK(d->ValueAt(i)->IsPropertyCell());
15822 return PropertyCell::cast(d->ValueAt(i))->value()->IsTheHole(); 15820 return PropertyCell::cast(d->ValueAt(i))->value()->IsTheHole();
15823 } 15821 }
15824 UNREACHABLE(); 15822 UNREACHABLE();
15825 return false; 15823 return false;
15826 } 15824 }
15827 15825
15828 15826
15829 template <typename Derived, typename Shape, typename Key> 15827 template <typename Derived, typename Shape, typename Key>
15830 template <DictionaryEntryType type> 15828 template <DictionaryEntryType type>
15831 int Dictionary<Derived, Shape, Key>::NumberOfElementsFilterAttributes( 15829 int Dictionary<Derived, Shape, Key>::NumberOfElementsFilterAttributes(
(...skipping 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after
16967 } 16965 }
16968 Handle<JSTypedArray> self(this); 16966 Handle<JSTypedArray> self(this);
16969 return MaterializeArrayBuffer(self); 16967 return MaterializeArrayBuffer(self);
16970 } 16968 }
16971 16969
16972 16970
16973 Handle<PropertyCell> PropertyCell::InvalidateEntry( 16971 Handle<PropertyCell> PropertyCell::InvalidateEntry(
16974 Handle<NameDictionary> dictionary, int entry) { 16972 Handle<NameDictionary> dictionary, int entry) {
16975 Isolate* isolate = dictionary->GetIsolate(); 16973 Isolate* isolate = dictionary->GetIsolate();
16976 // Swap with a copy. 16974 // Swap with a copy.
16977 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell());
16978 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); 16975 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry)));
16979 auto new_cell = isolate->factory()->NewPropertyCell(); 16976 auto new_cell = isolate->factory()->NewPropertyCell();
16980 new_cell->set_value(cell->value()); 16977 new_cell->set_value(cell->value());
16981 dictionary->ValueAtPut(entry, *new_cell); 16978 dictionary->ValueAtPut(entry, *new_cell);
16982 bool is_the_hole = cell->value()->IsTheHole(); 16979 bool is_the_hole = cell->value()->IsTheHole();
16983 // Cell is officially mutable henceforth. 16980 // Cell is officially mutable henceforth.
16984 auto details = dictionary->DetailsAt(entry); 16981 auto details = dictionary->DetailsAt(entry);
16985 details = details.set_cell_type(is_the_hole ? PropertyCellType::kDeleted 16982 details = details.set_cell_type(is_the_hole ? PropertyCellType::kDeleted
16986 : PropertyCellType::kMutable); 16983 : PropertyCellType::kMutable);
16987 dictionary->DetailsAtPut(entry, details); 16984 dictionary->DetailsAtPut(entry, details);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
17021 } 17018 }
17022 UNREACHABLE(); 17019 UNREACHABLE();
17023 return PropertyCellType::kMutable; 17020 return PropertyCellType::kMutable;
17024 } 17021 }
17025 17022
17026 17023
17027 Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary, 17024 Handle<Object> PropertyCell::UpdateCell(Handle<NameDictionary> dictionary,
17028 int entry, Handle<Object> value, 17025 int entry, Handle<Object> value,
17029 PropertyDetails details) { 17026 PropertyDetails details) {
17030 DCHECK(!value->IsTheHole()); 17027 DCHECK(!value->IsTheHole());
17031 DCHECK(dictionary->ValueAt(entry)->IsPropertyCell());
17032 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry))); 17028 Handle<PropertyCell> cell(PropertyCell::cast(dictionary->ValueAt(entry)));
17033 const PropertyDetails original_details = dictionary->DetailsAt(entry); 17029 const PropertyDetails original_details = dictionary->DetailsAt(entry);
17034 // Data accesses could be cached in ics or optimized code. 17030 // Data accesses could be cached in ics or optimized code.
17035 bool invalidate = 17031 bool invalidate =
17036 original_details.kind() == kData && details.kind() == kAccessor; 17032 original_details.kind() == kData && details.kind() == kAccessor;
17037 int index = original_details.dictionary_index(); 17033 int index = original_details.dictionary_index();
17038 auto old_type = original_details.cell_type(); 17034 auto old_type = original_details.cell_type();
17039 // Preserve the enumeration index unless the property was deleted or never 17035 // Preserve the enumeration index unless the property was deleted or never
17040 // initialized. 17036 // initialized.
17041 if (cell->value()->IsTheHole()) { 17037 if (cell->value()->IsTheHole()) {
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
17083 CompilationInfo* info) { 17079 CompilationInfo* info) {
17084 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo( 17080 Handle<DependentCode> codes = DependentCode::InsertCompilationInfo(
17085 handle(cell->dependent_code(), info->isolate()), 17081 handle(cell->dependent_code(), info->isolate()),
17086 DependentCode::kPropertyCellChangedGroup, info->object_wrapper()); 17082 DependentCode::kPropertyCellChangedGroup, info->object_wrapper());
17087 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes); 17083 if (*codes != cell->dependent_code()) cell->set_dependent_code(*codes);
17088 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add( 17084 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
17089 cell, info->zone()); 17085 cell, info->zone());
17090 } 17086 }
17091 17087
17092 } } // namespace v8::internal 17088 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/lookup-inl.h ('k') | src/runtime/runtime-object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698