OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 public: | 73 public: |
74 int length() const { | 74 int length() const { |
75 if (is_one_byte()) return literal_bytes_.length(); | 75 if (is_one_byte()) return literal_bytes_.length(); |
76 return literal_bytes_.length() / 2; | 76 return literal_bytes_.length() / 2; |
77 } | 77 } |
78 | 78 |
79 int byte_length() const { return literal_bytes_.length(); } | 79 int byte_length() const { return literal_bytes_.length(); } |
80 | 80 |
81 void Internalize(Isolate* isolate); | 81 void Internalize(Isolate* isolate); |
82 | 82 |
83 bool AsArrayIndex(uint32_t* index) const; | 83 bool AsArrayIndex(uint32_t* index, HandleDereferenceMode deref_mode = |
| 84 HandleDereferenceMode::kAllowed) const; |
84 | 85 |
85 // The string is not null-terminated, use length() to find out the length. | 86 // The string is not null-terminated, use length() to find out the length. |
86 const unsigned char* raw_data() const { | 87 const unsigned char* raw_data() const { |
87 return literal_bytes_.start(); | 88 return literal_bytes_.start(); |
88 } | 89 } |
89 | 90 |
90 bool is_one_byte() const { return IsOneByteBits::decode(bit_field_); } | 91 bool is_one_byte() const { return IsOneByteBits::decode(bit_field_); } |
91 | 92 |
92 bool IsOneByteEqualTo(const char* data) const; | 93 bool IsOneByteEqualTo(const char* data) const; |
93 uint16_t FirstCharacter() const { | 94 uint16_t FirstCharacter() const { |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 | 174 |
174 Smi* AsSmi() const { | 175 Smi* AsSmi() const { |
175 CHECK_EQ(SMI, type_); | 176 CHECK_EQ(SMI, type_); |
176 return Smi::FromInt(smi_); | 177 return Smi::FromInt(smi_); |
177 } | 178 } |
178 | 179 |
179 bool EqualsString(const AstRawString* string) const { | 180 bool EqualsString(const AstRawString* string) const { |
180 return type_ == STRING && string_ == string; | 181 return type_ == STRING && string_ == string; |
181 } | 182 } |
182 | 183 |
183 bool IsPropertyName() const; | 184 bool IsPropertyName( |
| 185 HandleDereferenceMode deref_mode = HandleDereferenceMode::kAllowed) const; |
184 | 186 |
185 bool BooleanValue() const; | 187 bool BooleanValue() const; |
186 | 188 |
187 bool IsSmi() const { return type_ == SMI; } | 189 bool IsSmi() const { return type_ == SMI; } |
188 bool IsFalse() const { return type_ == BOOLEAN && !bool_; } | 190 bool IsFalse() const { return type_ == BOOLEAN && !bool_; } |
189 bool IsTrue() const { return type_ == BOOLEAN && bool_; } | 191 bool IsTrue() const { return type_ == BOOLEAN && bool_; } |
190 bool IsUndefined() const { return type_ == UNDEFINED; } | 192 bool IsUndefined() const { return type_ == UNDEFINED; } |
191 bool IsTheHole() const { return type_ == THE_HOLE; } | 193 bool IsTheHole() const { return type_ == THE_HOLE; } |
192 bool IsNull() const { return type_ == NULL_TYPE; } | 194 bool IsNull() const { return type_ == NULL_TYPE; } |
193 | 195 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
397 OTHER_CONSTANTS(F) | 399 OTHER_CONSTANTS(F) |
398 #undef F | 400 #undef F |
399 }; | 401 }; |
400 } // namespace internal | 402 } // namespace internal |
401 } // namespace v8 | 403 } // namespace v8 |
402 | 404 |
403 #undef STRING_CONSTANTS | 405 #undef STRING_CONSTANTS |
404 #undef OTHER_CONSTANTS | 406 #undef OTHER_CONSTANTS |
405 | 407 |
406 #endif // V8_AST_AST_VALUE_FACTORY_H_ | 408 #endif // V8_AST_AST_VALUE_FACTORY_H_ |
OLD | NEW |