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 | |
7125 DECL_INT_ACCESSORS(flags) | 7121 DECL_INT_ACCESSORS(flags) |
7126 | 7122 |
7127 // [is_private]: Whether this is a private symbol. Private symbols can only | 7123 // [is_private]: Whether this is a private symbol. Private symbols can only |
7128 // be used to designate own properties of objects. | 7124 // be used to designate own properties of objects. |
7129 DECL_BOOLEAN_ACCESSORS(is_private) | 7125 DECL_BOOLEAN_ACCESSORS(is_private) |
7130 | 7126 |
7131 // [is_well_known_symbol]: Whether this is a spec-defined well-known symbol, | 7127 // [is_well_known_symbol]: Whether this is a spec-defined well-known symbol, |
7132 // or not. Well-known symbols do not throw when an access check fails during | 7128 // or not. Well-known symbols do not throw when an access check fails during |
7133 // a load. | 7129 // a load. |
7134 DECL_BOOLEAN_ACCESSORS(is_well_known_symbol) | 7130 DECL_BOOLEAN_ACCESSORS(is_well_known_symbol) |
7135 | 7131 |
7136 // [is_public]: Whether this is a symbol created by Symbol.for. Calling | 7132 // [is_public]: Whether this is a symbol created by Symbol.for. Calling |
7137 // Symbol.keyFor on such a symbol simply needs to return the attached name. | 7133 // Symbol.keyFor on such a symbol simply needs to return the attached name. |
7138 DECL_BOOLEAN_ACCESSORS(is_public) | 7134 DECL_BOOLEAN_ACCESSORS(is_public) |
7139 | 7135 |
7140 DECLARE_CAST(Symbol) | 7136 DECLARE_CAST(Symbol) |
7141 | 7137 |
7142 // Dispatched behavior. | 7138 // Dispatched behavior. |
7143 DECLARE_PRINTER(Symbol) | 7139 DECLARE_PRINTER(Symbol) |
7144 DECLARE_VERIFIER(Symbol) | 7140 DECLARE_VERIFIER(Symbol) |
7145 | 7141 |
7146 // Layout description. | 7142 // Layout description. |
7147 static const int kNameOffset = Name::kSize; | 7143 static const int kNameOffset = Name::kSize; |
7148 static const int kDescriptiveStringOffset = kNameOffset + kPointerSize; | 7144 static const int kFlagsOffset = kNameOffset + kPointerSize; |
7149 static const int kFlagsOffset = kDescriptiveStringOffset + kPointerSize; | |
7150 static const int kSize = kFlagsOffset + kPointerSize; | 7145 static const int kSize = kFlagsOffset + kPointerSize; |
7151 | 7146 |
7152 // Flags layout. | 7147 // Flags layout. |
7153 static const int kPrivateBit = 0; | 7148 static const int kPrivateBit = 0; |
7154 static const int kWellKnownSymbolBit = 1; | 7149 static const int kWellKnownSymbolBit = 1; |
7155 static const int kPublicBit = 2; | 7150 static const int kPublicBit = 2; |
7156 | 7151 |
7157 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; | 7152 typedef FixedBodyDescriptor<kNameOffset, kFlagsOffset, kSize> BodyDescriptor; |
7158 | 7153 |
7159 void SymbolShortPrint(std::ostream& os); | 7154 void SymbolShortPrint(std::ostream& os); |
(...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
9448 } | 9443 } |
9449 }; | 9444 }; |
9450 | 9445 |
9451 | 9446 |
9452 } // NOLINT, false-positive due to second-order macros. | 9447 } // NOLINT, false-positive due to second-order macros. |
9453 } // NOLINT, false-positive due to second-order macros. | 9448 } // NOLINT, false-positive due to second-order macros. |
9454 | 9449 |
9455 #include "src/objects/object-macros-undef.h" | 9450 #include "src/objects/object-macros-undef.h" |
9456 | 9451 |
9457 #endif // V8_OBJECTS_H_ | 9452 #endif // V8_OBJECTS_H_ |
OLD | NEW |