OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_OBJECTS_H_ | 5 #ifndef V8_OBJECTS_H_ |
6 #define V8_OBJECTS_H_ | 6 #define V8_OBJECTS_H_ |
7 | 7 |
8 #include <iosfwd> | 8 #include <iosfwd> |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 7100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7111 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); | 7111 DISALLOW_IMPLICIT_CONSTRUCTORS(Name); |
7112 }; | 7112 }; |
7113 | 7113 |
7114 | 7114 |
7115 // ES6 symbols. | 7115 // ES6 symbols. |
7116 class Symbol: public Name { | 7116 class Symbol: public Name { |
7117 public: | 7117 public: |
7118 // [name]: The print name of a symbol, or undefined if none. | 7118 // [name]: The print name of a symbol, or undefined if none. |
7119 DECL_ACCESSORS(name, Object) | 7119 DECL_ACCESSORS(name, Object) |
7120 | 7120 |
| 7121 // [descriptive_string]: The descriptive string of a symbol. This is the |
| 7122 // value returned from the Symbol.prototype.toString method. |
| 7123 DECL_ACCESSORS(descriptive_string, String) |
| 7124 |
7121 DECL_INT_ACCESSORS(flags) | 7125 DECL_INT_ACCESSORS(flags) |
7122 | 7126 |
7123 // [is_private]: Whether this is a private symbol. Private symbols can only | 7127 // [is_private]: Whether this is a private symbol. Private symbols can only |
7124 // be used to designate own properties of objects. | 7128 // be used to designate own properties of objects. |
7125 DECL_BOOLEAN_ACCESSORS(is_private) | 7129 DECL_BOOLEAN_ACCESSORS(is_private) |
7126 | 7130 |
7127 // [is_well_known_symbol]: Whether this is a spec-defined well-known symbol, | 7131 // [is_well_known_symbol]: Whether this is a spec-defined well-known symbol, |
7128 // or not. Well-known symbols do not throw when an access check fails during | 7132 // or not. Well-known symbols do not throw when an access check fails during |
7129 // a load. | 7133 // a load. |
7130 DECL_BOOLEAN_ACCESSORS(is_well_known_symbol) | 7134 DECL_BOOLEAN_ACCESSORS(is_well_known_symbol) |
7131 | 7135 |
7132 // [is_public]: Whether this is a symbol created by Symbol.for. Calling | 7136 // [is_public]: Whether this is a symbol created by Symbol.for. Calling |
7133 // Symbol.keyFor on such a symbol simply needs to return the attached name. | 7137 // Symbol.keyFor on such a symbol simply needs to return the attached name. |
7134 DECL_BOOLEAN_ACCESSORS(is_public) | 7138 DECL_BOOLEAN_ACCESSORS(is_public) |
7135 | 7139 |
7136 DECLARE_CAST(Symbol) | 7140 DECLARE_CAST(Symbol) |
7137 | 7141 |
7138 // Dispatched behavior. | 7142 // Dispatched behavior. |
7139 DECLARE_PRINTER(Symbol) | 7143 DECLARE_PRINTER(Symbol) |
7140 DECLARE_VERIFIER(Symbol) | 7144 DECLARE_VERIFIER(Symbol) |
7141 | 7145 |
7142 // Layout description. | 7146 // Layout description. |
7143 static const int kNameOffset = Name::kSize; | 7147 static const int kNameOffset = Name::kSize; |
7144 static const int kFlagsOffset = kNameOffset + kPointerSize; | 7148 static const int kDescriptiveStringOffset = kNameOffset + kPointerSize; |
| 7149 static const int kFlagsOffset = kDescriptiveStringOffset + kPointerSize; |
7145 static const int kSize = kFlagsOffset + kPointerSize; | 7150 static const int kSize = kFlagsOffset + kPointerSize; |
7146 | 7151 |
7147 // Flags layout. | 7152 // Flags layout. |
7148 static const int kPrivateBit = 0; | 7153 static const int kPrivateBit = 0; |
7149 static const int kWellKnownSymbolBit = 1; | 7154 static const int kWellKnownSymbolBit = 1; |
7150 static const int kPublicBit = 2; | 7155 static const int kPublicBit = 2; |
7151 | 7156 |
7152 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; | 7157 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; |
7153 | 7158 |
7154 void SymbolShortPrint(std::ostream& os); | 7159 void SymbolShortPrint(std::ostream& os); |
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9443 } | 9448 } |
9444 }; | 9449 }; |
9445 | 9450 |
9446 | 9451 |
9447 } // NOLINT, false-positive due to second-order macros. | 9452 } // NOLINT, false-positive due to second-order macros. |
9448 } // NOLINT, false-positive due to second-order macros. | 9453 } // NOLINT, false-positive due to second-order macros. |
9449 | 9454 |
9450 #include "src/objects/object-macros-undef.h" | 9455 #include "src/objects/object-macros-undef.h" |
9451 | 9456 |
9452 #endif // V8_OBJECTS_H_ | 9457 #endif // V8_OBJECTS_H_ |
OLD | NEW |