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

Side by Side Diff: src/objects.cc

Issue 1468313007: Remove whiteness witness from runtime. (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/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 // 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 9067 matching lines...) Expand 10 before | Expand all | Expand 10 after
9078 PropertyAttributes attributes, 9078 PropertyAttributes attributes,
9079 int slack) { 9079 int slack) {
9080 if (enumeration_index + slack == 0) { 9080 if (enumeration_index + slack == 0) {
9081 return desc->GetIsolate()->factory()->empty_descriptor_array(); 9081 return desc->GetIsolate()->factory()->empty_descriptor_array();
9082 } 9082 }
9083 9083
9084 int size = enumeration_index; 9084 int size = enumeration_index;
9085 9085
9086 Handle<DescriptorArray> descriptors = 9086 Handle<DescriptorArray> descriptors =
9087 DescriptorArray::Allocate(desc->GetIsolate(), size, slack); 9087 DescriptorArray::Allocate(desc->GetIsolate(), size, slack);
9088 DescriptorArray::WhitenessWitness witness(*descriptors);
9089 9088
9090 if (attributes != NONE) { 9089 if (attributes != NONE) {
9091 for (int i = 0; i < size; ++i) { 9090 for (int i = 0; i < size; ++i) {
9092 Object* value = desc->GetValue(i); 9091 Object* value = desc->GetValue(i);
9093 Name* key = desc->GetKey(i); 9092 Name* key = desc->GetKey(i);
9094 PropertyDetails details = desc->GetDetails(i); 9093 PropertyDetails details = desc->GetDetails(i);
9095 // Bulk attribute changes never affect private properties. 9094 // Bulk attribute changes never affect private properties.
9096 if (!key->IsSymbol() || !Symbol::cast(key)->is_private()) { 9095 if (!key->IsSymbol() || !Symbol::cast(key)->is_private()) {
9097 int mask = DONT_DELETE | DONT_ENUM; 9096 int mask = DONT_DELETE | DONT_ENUM;
9098 // READ_ONLY is an invalid attribute for JS setters/getters. 9097 // READ_ONLY is an invalid attribute for JS setters/getters.
9099 if (details.type() != ACCESSOR_CONSTANT || !value->IsAccessorPair()) { 9098 if (details.type() != ACCESSOR_CONSTANT || !value->IsAccessorPair()) {
9100 mask |= READ_ONLY; 9099 mask |= READ_ONLY;
9101 } 9100 }
9102 details = details.CopyAddAttributes( 9101 details = details.CopyAddAttributes(
9103 static_cast<PropertyAttributes>(attributes & mask)); 9102 static_cast<PropertyAttributes>(attributes & mask));
9104 } 9103 }
9105 Descriptor inner_desc( 9104 Descriptor inner_desc(
9106 handle(key), handle(value, desc->GetIsolate()), details); 9105 handle(key), handle(value, desc->GetIsolate()), details);
9107 descriptors->Set(i, &inner_desc, witness); 9106 descriptors->SetDescriptor(i, &inner_desc);
9108 } 9107 }
9109 } else { 9108 } else {
9110 for (int i = 0; i < size; ++i) { 9109 for (int i = 0; i < size; ++i) {
9111 descriptors->CopyFrom(i, *desc, witness); 9110 descriptors->CopyFrom(i, *desc);
9112 } 9111 }
9113 } 9112 }
9114 9113
9115 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort(); 9114 if (desc->number_of_descriptors() != enumeration_index) descriptors->Sort();
9116 9115
9117 return descriptors; 9116 return descriptors;
9118 } 9117 }
9119 9118
9120 9119
9121 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map, 9120 Handle<Map> Map::CopyReplaceDescriptor(Handle<Map> map,
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
9860 bridge_storage->set(kEnumCacheBridgeCacheIndex, *new_cache); 9859 bridge_storage->set(kEnumCacheBridgeCacheIndex, *new_cache);
9861 bridge_storage->set(kEnumCacheBridgeIndicesCacheIndex, 9860 bridge_storage->set(kEnumCacheBridgeIndicesCacheIndex,
9862 new_index_cache.is_null() ? Object::cast(Smi::FromInt(0)) 9861 new_index_cache.is_null() ? Object::cast(Smi::FromInt(0))
9863 : *new_index_cache); 9862 : *new_index_cache);
9864 if (needs_new_enum_cache) { 9863 if (needs_new_enum_cache) {
9865 descriptors->set(kEnumCacheIndex, bridge_storage); 9864 descriptors->set(kEnumCacheIndex, bridge_storage);
9866 } 9865 }
9867 } 9866 }
9868 9867
9869 9868
9870 void DescriptorArray::CopyFrom(int index, DescriptorArray* src, 9869 void DescriptorArray::CopyFrom(int index, DescriptorArray* src) {
9871 const WhitenessWitness& witness) {
9872 Object* value = src->GetValue(index); 9870 Object* value = src->GetValue(index);
9873 PropertyDetails details = src->GetDetails(index); 9871 PropertyDetails details = src->GetDetails(index);
9874 Descriptor desc(handle(src->GetKey(index)), 9872 Descriptor desc(handle(src->GetKey(index)),
9875 handle(value, src->GetIsolate()), 9873 handle(value, src->GetIsolate()),
9876 details); 9874 details);
9877 Set(index, &desc, witness); 9875 SetDescriptor(index, &desc);
9878 } 9876 }
9879 9877
9880 9878
9881 // We need the whiteness witness since sort will reshuffle the entries in the
9882 // descriptor array. If the descriptor array were to be black, the shuffling
9883 // would move a slot that was already recorded as pointing into an evacuation
9884 // candidate. This would result in missing updates upon evacuation.
9885 void DescriptorArray::Sort() { 9879 void DescriptorArray::Sort() {
9886 // In-place heap sort. 9880 // In-place heap sort.
9887 int len = number_of_descriptors(); 9881 int len = number_of_descriptors();
9888 // Reset sorting since the descriptor array might contain invalid pointers. 9882 // Reset sorting since the descriptor array might contain invalid pointers.
9889 for (int i = 0; i < len; ++i) SetSortedKey(i, i); 9883 for (int i = 0; i < len; ++i) SetSortedKey(i, i);
9890 // Bottom-up max-heap construction. 9884 // Bottom-up max-heap construction.
9891 // Index of the last node with children 9885 // Index of the last node with children
9892 const int max_parent_index = (len / 2) - 1; 9886 const int max_parent_index = (len / 2) - 1;
9893 for (int i = max_parent_index; i >= 0; --i) { 9887 for (int i = max_parent_index; i >= 0; --i) {
9894 int parent_index = i; 9888 int parent_index = i;
(...skipping 8653 matching lines...) Expand 10 before | Expand all | Expand 10 after
18548 if (cell->value() != *new_value) { 18542 if (cell->value() != *new_value) {
18549 cell->set_value(*new_value); 18543 cell->set_value(*new_value);
18550 Isolate* isolate = cell->GetIsolate(); 18544 Isolate* isolate = cell->GetIsolate();
18551 cell->dependent_code()->DeoptimizeDependentCodeGroup( 18545 cell->dependent_code()->DeoptimizeDependentCodeGroup(
18552 isolate, DependentCode::kPropertyCellChangedGroup); 18546 isolate, DependentCode::kPropertyCellChangedGroup);
18553 } 18547 }
18554 } 18548 }
18555 18549
18556 } // namespace internal 18550 } // namespace internal
18557 } // namespace v8 18551 } // namespace v8
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