OLD | NEW |
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" |
11 | 11 |
12 // Ecma-262 3rd 8.6.1 | 12 namespace v8 { |
| 13 namespace internal { |
| 14 |
| 15 // ES6 6.1.7.1 |
13 enum PropertyAttributes { | 16 enum PropertyAttributes { |
14 NONE = v8::None, | 17 NONE = ::v8::None, |
15 READ_ONLY = v8::ReadOnly, | 18 READ_ONLY = ::v8::ReadOnly, |
16 DONT_ENUM = v8::DontEnum, | 19 DONT_ENUM = ::v8::DontEnum, |
17 DONT_DELETE = v8::DontDelete, | 20 DONT_DELETE = ::v8::DontDelete, |
| 21 |
| 22 ALL_ATTRIBUTES_MASK = READ_ONLY | DONT_ENUM | DONT_DELETE, |
18 | 23 |
19 SEALED = DONT_DELETE, | 24 SEALED = DONT_DELETE, |
20 FROZEN = SEALED | READ_ONLY, | 25 FROZEN = SEALED | READ_ONLY, |
21 | 26 |
22 STRING = 8, // Used to filter symbols and string names | |
23 SYMBOLIC = 16, | |
24 PRIVATE_SYMBOL = 32, | |
25 | |
26 DONT_SHOW = DONT_ENUM | SYMBOLIC | PRIVATE_SYMBOL, | |
27 ABSENT = 64, // Used in runtime to indicate a property is absent. | 27 ABSENT = 64, // Used in runtime to indicate a property is absent. |
28 // ABSENT can never be stored in or returned from a descriptor's attributes | 28 // ABSENT can never be stored in or returned from a descriptor's attributes |
29 // bitfield. It is only used as a return value meaning the attributes of | 29 // bitfield. It is only used as a return value meaning the attributes of |
30 // a non-existent property. | 30 // a non-existent property. |
31 | 31 |
32 // When creating a property, EVAL_DECLARED used to indicate that the property | 32 // When creating a property, EVAL_DECLARED used to indicate that the property |
33 // came from a sloppy-mode direct eval, and certain checks need to be done. | 33 // came from a sloppy-mode direct eval, and certain checks need to be done. |
34 // Cannot be stored in or returned from a descriptor's attributes bitfield. | 34 // Cannot be stored in or returned from a descriptor's attributes bitfield. |
35 EVAL_DECLARED = 128 | 35 EVAL_DECLARED = 128 |
36 }; | 36 }; |
37 | 37 |
38 | 38 |
39 namespace v8 { | 39 enum PropertyFilter { |
40 namespace internal { | 40 ALL_PROPERTIES = 0, |
| 41 ONLY_ENUMERABLE = 2, |
| 42 SKIP_STRINGS = 8, |
| 43 SKIP_SYMBOLS = 16, |
| 44 ONLY_ALL_CAN_READ = 32, |
| 45 ENUMERABLE_STRINGS = ONLY_ENUMERABLE | SKIP_SYMBOLS, |
| 46 }; |
| 47 // Enable fast comparisons of PropertyAttributes against PropertyFilters. |
| 48 STATIC_ASSERT(ALL_PROPERTIES == static_cast<PropertyFilter>(NONE)); |
| 49 STATIC_ASSERT(ONLY_ENUMERABLE == static_cast<PropertyFilter>(DONT_ENUM)); |
| 50 STATIC_ASSERT(((SKIP_STRINGS | SKIP_SYMBOLS | ONLY_ALL_CAN_READ) & |
| 51 ALL_ATTRIBUTES_MASK) == 0); |
| 52 |
41 | 53 |
42 class Smi; | 54 class Smi; |
43 template<class> class TypeImpl; | 55 template<class> class TypeImpl; |
44 struct ZoneTypeConfig; | 56 struct ZoneTypeConfig; |
45 typedef TypeImpl<ZoneTypeConfig> Type; | 57 typedef TypeImpl<ZoneTypeConfig> Type; |
46 class TypeInfo; | 58 class TypeInfo; |
47 | 59 |
48 // Type of properties. | 60 // Type of properties. |
49 // Order of kinds is significant. | 61 // Order of kinds is significant. |
50 // Must fit in the BitField PropertyDetails::KindField. | 62 // Must fit in the BitField PropertyDetails::KindField. |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 }; | 385 }; |
374 | 386 |
375 | 387 |
376 std::ostream& operator<<(std::ostream& os, | 388 std::ostream& operator<<(std::ostream& os, |
377 const PropertyAttributes& attributes); | 389 const PropertyAttributes& attributes); |
378 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details); | 390 std::ostream& operator<<(std::ostream& os, const PropertyDetails& details); |
379 } // namespace internal | 391 } // namespace internal |
380 } // namespace v8 | 392 } // namespace v8 |
381 | 393 |
382 #endif // V8_PROPERTY_DETAILS_H_ | 394 #endif // V8_PROPERTY_DETAILS_H_ |
OLD | NEW |