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/property-details.h

Issue 1062163005: track global accesses to constant types (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/objects.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 #ifndef V8_PROPERTY_DETAILS_H_ 5 #ifndef V8_PROPERTY_DETAILS_H_
6 #define V8_PROPERTY_DETAILS_H_ 6 #define V8_PROPERTY_DETAILS_H_
7 7
8 #include "include/v8.h" 8 #include "include/v8.h"
9 #include "src/allocation.h" 9 #include "src/allocation.h"
10 #include "src/utils.h" 10 #include "src/utils.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 static const int kDescriptorIndexBitCount = 10; 179 static const int kDescriptorIndexBitCount = 10;
180 // The maximum number of descriptors we want in a descriptor array (should 180 // The maximum number of descriptors we want in a descriptor array (should
181 // fit in a page). 181 // fit in a page).
182 static const int kMaxNumberOfDescriptors = 182 static const int kMaxNumberOfDescriptors =
183 (1 << kDescriptorIndexBitCount) - 2; 183 (1 << kDescriptorIndexBitCount) - 2;
184 static const int kInvalidEnumCacheSentinel = 184 static const int kInvalidEnumCacheSentinel =
185 (1 << kDescriptorIndexBitCount) - 1; 185 (1 << kDescriptorIndexBitCount) - 1;
186 186
187 187
188 enum class PropertyCellType { 188 enum class PropertyCellType {
189 kUninitialized, // Cell is deleted or not yet defined. 189 // Meaningful when a property cell does not contain the hole.
190 kUndefined, // The PREMONOMORPHIC of property cells. 190 kUndefined, // The PREMONOMORPHIC of property cells.
191 kConstant, // Cell has been assigned only once. 191 kConstant, // Cell has been assigned only once.
192 kMutable, // Cell will no longer be tracked as constant. 192 kConstantType, // Cell has been assigned only one type.
193 kDeleted = kConstant, // like kUninitialized, but for cells already deleted. 193 kMutable, // Cell will no longer be tracked as constant.
194 kInvalid = kMutable, // For dictionaries not holding cells. 194
195 // Meaningful when a property cell contains the hole.
196 kUninitialized = kUndefined, // Cell has never been initialized.
197 kInvalidated = kConstant, // Cell has been deleted or invalidated.
198
199 // For dictionaries not holding cells.
200 kNoCell = kMutable,
195 }; 201 };
196 202
197 203
204 enum class PropertyCellConstantType {
205 kSmi,
206 kStableMap,
207 };
208
209
198 // PropertyDetails captures type and attributes for a property. 210 // PropertyDetails captures type and attributes for a property.
199 // They are used both in property dictionaries and instance descriptors. 211 // They are used both in property dictionaries and instance descriptors.
200 class PropertyDetails BASE_EMBEDDED { 212 class PropertyDetails BASE_EMBEDDED {
201 public: 213 public:
202 PropertyDetails(PropertyAttributes attributes, PropertyType type, int index, 214 PropertyDetails(PropertyAttributes attributes, PropertyType type, int index,
203 PropertyCellType cell_type) { 215 PropertyCellType cell_type) {
204 value_ = TypeField::encode(type) | AttributesField::encode(attributes) | 216 value_ = TypeField::encode(type) | AttributesField::encode(attributes) |
205 DictionaryStorageField::encode(index) | 217 DictionaryStorageField::encode(index) |
206 PropertyCellTypeField::encode(cell_type); 218 PropertyCellTypeField::encode(cell_type);
207 219
(...skipping 14 matching lines...) Expand all
222 PropertyDetails(PropertyAttributes attributes, PropertyKind kind, 234 PropertyDetails(PropertyAttributes attributes, PropertyKind kind,
223 PropertyLocation location, Representation representation, 235 PropertyLocation location, Representation representation,
224 int field_index = 0) { 236 int field_index = 0) {
225 value_ = KindField::encode(kind) | LocationField::encode(location) | 237 value_ = KindField::encode(kind) | LocationField::encode(location) |
226 AttributesField::encode(attributes) | 238 AttributesField::encode(attributes) |
227 RepresentationField::encode(EncodeRepresentation(representation)) | 239 RepresentationField::encode(EncodeRepresentation(representation)) |
228 FieldIndexField::encode(field_index); 240 FieldIndexField::encode(field_index);
229 } 241 }
230 242
231 static PropertyDetails Empty() { 243 static PropertyDetails Empty() {
232 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kInvalid); 244 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell);
233 } 245 }
234 246
235 int pointer() const { return DescriptorPointer::decode(value_); } 247 int pointer() const { return DescriptorPointer::decode(value_); }
236 248
237 PropertyDetails set_pointer(int i) const { 249 PropertyDetails set_pointer(int i) const {
238 return PropertyDetails(value_, i); 250 return PropertyDetails(value_, i);
239 } 251 }
240 252
241 PropertyDetails set_cell_type(PropertyCellType type) const { 253 PropertyDetails set_cell_type(PropertyCellType type) const {
242 PropertyDetails details = *this; 254 PropertyDetails details = *this;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 uint32_t value_; 365 uint32_t value_;
354 }; 366 };
355 367
356 368
357 std::ostream& operator<<(std::ostream& os, 369 std::ostream& operator<<(std::ostream& os,
358 const PropertyAttributes& attributes); 370 const PropertyAttributes& attributes);
359 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details); 371 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details);
360 } } // namespace v8::internal 372 } } // namespace v8::internal
361 373
362 #endif // V8_PROPERTY_DETAILS_H_ 374 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/objects.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698