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

Side by Side Diff: src/property-details.h

Issue 2127583002: [runtime] Better encapsulation of dictionary objects handling in lookup iterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes Created 4 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
« no previous file with comments | « src/objects-printer.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 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 202
203 203
204 static const int kDescriptorIndexBitCount = 10; 204 static const int kDescriptorIndexBitCount = 10;
205 // The maximum number of descriptors we want in a descriptor array (should 205 // The maximum number of descriptors we want in a descriptor array (should
206 // fit in a page). 206 // fit in a page).
207 static const int kMaxNumberOfDescriptors = 207 static const int kMaxNumberOfDescriptors =
208 (1 << kDescriptorIndexBitCount) - 2; 208 (1 << kDescriptorIndexBitCount) - 2;
209 static const int kInvalidEnumCacheSentinel = 209 static const int kInvalidEnumCacheSentinel =
210 (1 << kDescriptorIndexBitCount) - 1; 210 (1 << kDescriptorIndexBitCount) - 1;
211 211
212
213 enum class PropertyCellType { 212 enum class PropertyCellType {
214 // Meaningful when a property cell does not contain the hole. 213 // Meaningful when a property cell does not contain the hole.
215 kUndefined, // The PREMONOMORPHIC of property cells. 214 kUndefined, // The PREMONOMORPHIC of property cells.
216 kConstant, // Cell has been assigned only once. 215 kConstant, // Cell has been assigned only once.
217 kConstantType, // Cell has been assigned only one type. 216 kConstantType, // Cell has been assigned only one type.
218 kMutable, // Cell will no longer be tracked as constant. 217 kMutable, // Cell will no longer be tracked as constant.
219 218
220 // Meaningful when a property cell contains the hole. 219 // Meaningful when a property cell contains the hole.
221 kUninitialized = kUndefined, // Cell has never been initialized. 220 kUninitialized = kUndefined, // Cell has never been initialized.
222 kInvalidated = kConstant, // Cell has been deleted or invalidated. 221 kInvalidated = kConstant, // Cell has been deleted, invalidated or never
222 // existed.
223 223
224 // For dictionaries not holding cells. 224 // For dictionaries not holding cells.
225 kNoCell = kMutable, 225 kNoCell = kMutable,
226 }; 226 };
227 227
228
229 enum class PropertyCellConstantType { 228 enum class PropertyCellConstantType {
230 kSmi, 229 kSmi,
231 kStableMap, 230 kStableMap,
232 }; 231 };
233 232
234 233
235 // PropertyDetails captures type and attributes for a property. 234 // PropertyDetails captures type and attributes for a property.
236 // They are used both in property dictionaries and instance descriptors. 235 // They are used both in property dictionaries and instance descriptors.
237 class PropertyDetails BASE_EMBEDDED { 236 class PropertyDetails BASE_EMBEDDED {
238 public: 237 public:
(...skipping 19 matching lines...) Expand all
258 257
259 PropertyDetails(PropertyAttributes attributes, PropertyKind kind, 258 PropertyDetails(PropertyAttributes attributes, PropertyKind kind,
260 PropertyLocation location, Representation representation, 259 PropertyLocation location, Representation representation,
261 int field_index = 0) { 260 int field_index = 0) {
262 value_ = KindField::encode(kind) | LocationField::encode(location) | 261 value_ = KindField::encode(kind) | LocationField::encode(location) |
263 AttributesField::encode(attributes) | 262 AttributesField::encode(attributes) |
264 RepresentationField::encode(EncodeRepresentation(representation)) | 263 RepresentationField::encode(EncodeRepresentation(representation)) |
265 FieldIndexField::encode(field_index); 264 FieldIndexField::encode(field_index);
266 } 265 }
267 266
268 static PropertyDetails Empty() { 267 static PropertyDetails Empty(
269 return PropertyDetails(NONE, DATA, 0, PropertyCellType::kNoCell); 268 PropertyCellType cell_type = PropertyCellType::kNoCell) {
269 return PropertyDetails(NONE, DATA, 0, cell_type);
270 } 270 }
271 271
272 int pointer() const { return DescriptorPointer::decode(value_); } 272 int pointer() const { return DescriptorPointer::decode(value_); }
273 273
274 PropertyDetails set_pointer(int i) const { 274 PropertyDetails set_pointer(int i) const {
275 return PropertyDetails(value_, i); 275 return PropertyDetails(value_, i);
276 } 276 }
277 277
278 PropertyDetails set_cell_type(PropertyCellType type) const { 278 PropertyDetails set_cell_type(PropertyCellType type) const {
279 PropertyDetails details = *this; 279 PropertyDetails details = *this;
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 }; 394 };
395 395
396 396
397 std::ostream& operator<<(std::ostream& os, 397 std::ostream& operator<<(std::ostream& os,
398 const PropertyAttributes& attributes); 398 const PropertyAttributes& attributes);
399 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details); 399 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details);
400 } // namespace internal 400 } // namespace internal
401 } // namespace v8 401 } // namespace v8
402 402
403 #endif // V8_PROPERTY_DETAILS_H_ 403 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/objects-printer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698