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

Side by Side Diff: src/objects.cc

Issue 17895004: Add DependentCode to PropertyCells (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Moar review feedback Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('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 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
654 654
655 MaybeObject* JSObject::SetNormalizedProperty(Name* name, 655 MaybeObject* JSObject::SetNormalizedProperty(Name* name,
656 Object* value, 656 Object* value,
657 PropertyDetails details) { 657 PropertyDetails details) {
658 ASSERT(!HasFastProperties()); 658 ASSERT(!HasFastProperties());
659 int entry = property_dictionary()->FindEntry(name); 659 int entry = property_dictionary()->FindEntry(name);
660 if (entry == NameDictionary::kNotFound) { 660 if (entry == NameDictionary::kNotFound) {
661 Object* store_value = value; 661 Object* store_value = value;
662 if (IsGlobalObject()) { 662 if (IsGlobalObject()) {
663 Heap* heap = name->GetHeap(); 663 Heap* heap = name->GetHeap();
664 MaybeObject* maybe_store_value = 664 MaybeObject* maybe_store_value = heap->AllocatePropertyCell(value);
665 heap->AllocatePropertyCell(value);
666 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value; 665 if (!maybe_store_value->ToObject(&store_value)) return maybe_store_value;
667 } 666 }
668 Object* dict; 667 Object* dict;
669 { MaybeObject* maybe_dict = 668 { MaybeObject* maybe_dict =
670 property_dictionary()->Add(name, store_value, details); 669 property_dictionary()->Add(name, store_value, details);
671 if (!maybe_dict->ToObject(&dict)) return maybe_dict; 670 if (!maybe_dict->ToObject(&dict)) return maybe_dict;
672 } 671 }
673 set_properties(NameDictionary::cast(dict)); 672 set_properties(NameDictionary::cast(dict));
674 return value; 673 return value;
675 } 674 }
(...skipping 10393 matching lines...) Expand 10 before | Expand all | Expand 10 after
11069 proto_transitions->length()); 11068 proto_transitions->length());
11070 } 11069 }
11071 11070
11072 11071
11073 void Map::AddDependentCompilationInfo(DependentCode::DependencyGroup group, 11072 void Map::AddDependentCompilationInfo(DependentCode::DependencyGroup group,
11074 CompilationInfo* info) { 11073 CompilationInfo* info) {
11075 Handle<DependentCode> dep(dependent_code()); 11074 Handle<DependentCode> dep(dependent_code());
11076 Handle<DependentCode> codes = 11075 Handle<DependentCode> codes =
11077 DependentCode::Insert(dep, group, info->object_wrapper()); 11076 DependentCode::Insert(dep, group, info->object_wrapper());
11078 if (*codes != dependent_code()) set_dependent_code(*codes); 11077 if (*codes != dependent_code()) set_dependent_code(*codes);
11079 info->dependent_maps(group)->Add(Handle<Map>(this), info->zone()); 11078 info->dependencies(group)->Add(Handle<HeapObject>(this), info->zone());
11080 } 11079 }
11081 11080
11082 11081
11083 void Map::AddDependentCode(DependentCode::DependencyGroup group, 11082 void Map::AddDependentCode(DependentCode::DependencyGroup group,
11084 Handle<Code> code) { 11083 Handle<Code> code) {
11085 Handle<DependentCode> codes = DependentCode::Insert( 11084 Handle<DependentCode> codes = DependentCode::Insert(
11086 Handle<DependentCode>(dependent_code()), group, code); 11085 Handle<DependentCode>(dependent_code()), group, code);
11087 if (*codes != dependent_code()) set_dependent_code(*codes); 11086 if (*codes != dependent_code()) set_dependent_code(*codes);
11088 } 11087 }
11089 11088
11090 11089
11091 DependentCode::GroupStartIndexes::GroupStartIndexes(DependentCode* entries) { 11090 DependentCode::GroupStartIndexes::GroupStartIndexes(DependentCode* entries) {
11092 Recompute(entries); 11091 Recompute(entries);
11093 } 11092 }
11094 11093
11095 11094
11096 void DependentCode::GroupStartIndexes::Recompute(DependentCode* entries) { 11095 void DependentCode::GroupStartIndexes::Recompute(DependentCode* entries) {
11097 start_indexes_[0] = 0; 11096 start_indexes_[0] = 0;
11098 for (int g = 1; g <= kGroupCount; g++) { 11097 for (int g = 1; g <= kGroupCount; g++) {
11099 int count = entries->number_of_entries(static_cast<DependencyGroup>(g - 1)); 11098 int count = entries->number_of_entries(static_cast<DependencyGroup>(g - 1));
11100 start_indexes_[g] = start_indexes_[g - 1] + count; 11099 start_indexes_[g] = start_indexes_[g - 1] + count;
11101 } 11100 }
11102 } 11101 }
11103 11102
11104 11103
11104 DependentCode* DependentCode::ForObject(Handle<HeapObject> object,
11105 DependencyGroup group) {
11106 AllowDeferredHandleDereference dependencies_are_safe;
11107 if (group == DependentCode::kPropertyCellChangedGroup) {
11108 return Handle<PropertyCell>::cast(object)->dependent_code();
11109 }
11110 return Handle<Map>::cast(object)->dependent_code();
11111 }
11112
11113
11105 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries, 11114 Handle<DependentCode> DependentCode::Insert(Handle<DependentCode> entries,
11106 DependencyGroup group, 11115 DependencyGroup group,
11107 Handle<Object> object) { 11116 Handle<Object> object) {
11108 GroupStartIndexes starts(*entries); 11117 GroupStartIndexes starts(*entries);
11109 int start = starts.at(group); 11118 int start = starts.at(group);
11110 int end = starts.at(group + 1); 11119 int end = starts.at(group + 1);
11111 int number_of_entries = starts.number_of_entries(); 11120 int number_of_entries = starts.number_of_entries();
11112 if (start < end && entries->object_at(end - 1) == *object) { 11121 if (start < end && entries->object_at(end - 1) == *object) {
11113 // Do not append the compilation info if it is already in the array. 11122 // Do not append the compilation info if it is already in the array.
11114 // It is sufficient to just check only the last element because 11123 // It is sufficient to just check only the last element because
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
11233 int start = starts.at(group); 11242 int start = starts.at(group);
11234 int end = starts.at(group + 1); 11243 int end = starts.at(group + 1);
11235 int code_entries = starts.number_of_entries(); 11244 int code_entries = starts.number_of_entries();
11236 if (start == end) return; 11245 if (start == end) return;
11237 for (int i = start; i < end; i++) { 11246 for (int i = start; i < end; i++) {
11238 if (is_code_at(i)) { 11247 if (is_code_at(i)) {
11239 Code* code = code_at(i); 11248 Code* code = code_at(i);
11240 code->set_marked_for_deoptimization(true); 11249 code->set_marked_for_deoptimization(true);
11241 } else { 11250 } else {
11242 CompilationInfo* info = compilation_info_at(i); 11251 CompilationInfo* info = compilation_info_at(i);
11243 info->AbortDueToDependentMap(); 11252 info->AbortDueToDependencyChange();
11244 } 11253 }
11245 } 11254 }
11246 // Compact the array by moving all subsequent groups to fill in the new holes. 11255 // Compact the array by moving all subsequent groups to fill in the new holes.
11247 for (int src = end, dst = start; src < code_entries; src++, dst++) { 11256 for (int src = end, dst = start; src < code_entries; src++, dst++) {
11248 copy(src, dst); 11257 copy(src, dst);
11249 } 11258 }
11250 // Now the holes are at the end of the array, zap them for heap-verifier. 11259 // Now the holes are at the end of the array, zap them for heap-verifier.
11251 int removed = end - start; 11260 int removed = end - start;
11252 for (int i = code_entries - removed; i < code_entries; i++) { 11261 for (int i = code_entries - removed; i < code_entries; i++) {
11253 clear_at(i); 11262 clear_at(i);
(...skipping 4512 matching lines...) Expand 10 before | Expand all | Expand 10 after
15766 Type* PropertyCell::type() { 15775 Type* PropertyCell::type() {
15767 return static_cast<Type*>(type_raw()); 15776 return static_cast<Type*>(type_raw());
15768 } 15777 }
15769 15778
15770 15779
15771 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) { 15780 void PropertyCell::set_type(Type* type, WriteBarrierMode ignored) {
15772 set_type_raw(type, ignored); 15781 set_type_raw(type, ignored);
15773 } 15782 }
15774 15783
15775 15784
15785 void PropertyCell::AddDependentCompilationInfo(CompilationInfo* info) {
15786 Handle<DependentCode> dep(dependent_code());
15787 Handle<DependentCode> codes =
15788 DependentCode::Insert(dep, DependentCode::kPropertyCellChangedGroup,
15789 info->object_wrapper());
15790 if (*codes != dependent_code()) set_dependent_code(*codes);
15791 info->dependencies(DependentCode::kPropertyCellChangedGroup)->Add(
15792 Handle<HeapObject>(this), info->zone());
15793 }
15794
15795
15796 void PropertyCell::AddDependentCode(Handle<Code> code) {
15797 Handle<DependentCode> codes = DependentCode::Insert(
15798 Handle<DependentCode>(dependent_code()),
15799 DependentCode::kPropertyCellChangedGroup, code);
15800 if (*codes != dependent_code()) set_dependent_code(*codes);
15801 }
15802
15803
15776 } } // namespace v8::internal 15804 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/objects.h ('k') | src/objects-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698