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

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

Issue 2598543003: [runtime][ic] Constant field tracking support. (Closed)
Patch Set: Addressing comments Created 3 years, 10 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/property.cc ('k') | src/value-serializer.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 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 // TODO(ishell): remove once FLAG_track_constant_fields is removed.
11 #include "src/flags.h"
10 #include "src/utils.h" 12 #include "src/utils.h"
11 13
12 namespace v8 { 14 namespace v8 {
13 namespace internal { 15 namespace internal {
14 16
15 // ES6 6.1.7.1 17 // ES6 6.1.7.1
16 enum PropertyAttributes { 18 enum PropertyAttributes {
17 NONE = ::v8::None, 19 NONE = ::v8::None,
18 READ_ONLY = ::v8::ReadOnly, 20 READ_ONLY = ::v8::ReadOnly,
19 DONT_ENUM = ::v8::DontEnum, 21 DONT_ENUM = ::v8::DontEnum,
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 enum PropertyKind { kData = 0, kAccessor = 1 }; 71 enum PropertyKind { kData = 0, kAccessor = 1 };
70 72
71 // Order of modes is significant. 73 // Order of modes is significant.
72 // Must fit in the BitField PropertyDetails::LocationField. 74 // Must fit in the BitField PropertyDetails::LocationField.
73 enum PropertyLocation { kField = 0, kDescriptor = 1 }; 75 enum PropertyLocation { kField = 0, kDescriptor = 1 };
74 76
75 // Order of modes is significant. 77 // Order of modes is significant.
76 // Must fit in the BitField PropertyDetails::ConstnessField. 78 // Must fit in the BitField PropertyDetails::ConstnessField.
77 enum PropertyConstness { kMutable = 0, kConst = 1 }; 79 enum PropertyConstness { kMutable = 0, kConst = 1 };
78 80
81 // TODO(ishell): remove once constant field tracking is done.
82 const PropertyConstness kDefaultFieldConstness =
83 FLAG_track_constant_fields ? kConst : kMutable;
84
79 class Representation { 85 class Representation {
80 public: 86 public:
81 enum Kind { 87 enum Kind {
82 kNone, 88 kNone,
83 kInteger8, 89 kInteger8,
84 kUInteger8, 90 kUInteger8,
85 kInteger16, 91 kInteger16,
86 kUInteger16, 92 kUInteger16,
87 kSmi, 93 kSmi,
88 kInteger32, 94 kInteger32,
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 269
264 PropertyDetails set_index(int index) const { 270 PropertyDetails set_index(int index) const {
265 PropertyDetails details = *this; 271 PropertyDetails details = *this;
266 details.value_ = DictionaryStorageField::update(details.value_, index); 272 details.value_ = DictionaryStorageField::update(details.value_, index);
267 return details; 273 return details;
268 } 274 }
269 275
270 PropertyDetails CopyWithRepresentation(Representation representation) const { 276 PropertyDetails CopyWithRepresentation(Representation representation) const {
271 return PropertyDetails(value_, representation); 277 return PropertyDetails(value_, representation);
272 } 278 }
279 PropertyDetails CopyWithConstness(PropertyConstness constness) const {
280 return PropertyDetails(value_, constness);
281 }
273 PropertyDetails CopyAddAttributes(PropertyAttributes new_attributes) const { 282 PropertyDetails CopyAddAttributes(PropertyAttributes new_attributes) const {
274 new_attributes = 283 new_attributes =
275 static_cast<PropertyAttributes>(attributes() | new_attributes); 284 static_cast<PropertyAttributes>(attributes() | new_attributes);
276 return PropertyDetails(value_, new_attributes); 285 return PropertyDetails(value_, new_attributes);
277 } 286 }
278 287
279 // Conversion for storing details as Object*. 288 // Conversion for storing details as Object*.
280 explicit inline PropertyDetails(Smi* smi); 289 explicit inline PropertyDetails(Smi* smi);
281 inline Smi* AsSmi() const; 290 inline Smi* AsSmi() const;
282 291
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
373 void PrintAsFastTo(std::ostream& out, PrintMode mode = kPrintFull); 382 void PrintAsFastTo(std::ostream& out, PrintMode mode = kPrintFull);
374 383
375 private: 384 private:
376 PropertyDetails(int value, int pointer) { 385 PropertyDetails(int value, int pointer) {
377 value_ = DescriptorPointer::update(value, pointer); 386 value_ = DescriptorPointer::update(value, pointer);
378 } 387 }
379 PropertyDetails(int value, Representation representation) { 388 PropertyDetails(int value, Representation representation) {
380 value_ = RepresentationField::update( 389 value_ = RepresentationField::update(
381 value, EncodeRepresentation(representation)); 390 value, EncodeRepresentation(representation));
382 } 391 }
392 PropertyDetails(int value, PropertyConstness constness) {
393 value_ = ConstnessField::update(value, constness);
394 }
383 PropertyDetails(int value, PropertyAttributes attributes) { 395 PropertyDetails(int value, PropertyAttributes attributes) {
384 value_ = AttributesField::update(value, attributes); 396 value_ = AttributesField::update(value, attributes);
385 } 397 }
386 398
387 uint32_t value_; 399 uint32_t value_;
388 }; 400 };
389 401
390 // kField location is more general than kDescriptor, kDescriptor generalizes 402 // kField location is more general than kDescriptor, kDescriptor generalizes
391 // only to itself. 403 // only to itself.
392 inline bool IsGeneralizableTo(PropertyLocation a, PropertyLocation b) { 404 inline bool IsGeneralizableTo(PropertyLocation a, PropertyLocation b) {
(...skipping 10 matching lines...) Expand all
403 PropertyConstness b) { 415 PropertyConstness b) {
404 return a == kMutable ? kMutable : b; 416 return a == kMutable ? kMutable : b;
405 } 417 }
406 418
407 std::ostream& operator<<(std::ostream& os, 419 std::ostream& operator<<(std::ostream& os,
408 const PropertyAttributes& attributes); 420 const PropertyAttributes& attributes);
409 } // namespace internal 421 } // namespace internal
410 } // namespace v8 422 } // namespace v8
411 423
412 #endif // V8_PROPERTY_DETAILS_H_ 424 #endif // V8_PROPERTY_DETAILS_H_
OLDNEW
« no previous file with comments | « src/property.cc ('k') | src/value-serializer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698