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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 int length() const override { | 67 int length() const override { |
68 if (is_one_byte_) | 68 if (is_one_byte_) |
69 return literal_bytes_.length(); | 69 return literal_bytes_.length(); |
70 return literal_bytes_.length() / 2; | 70 return literal_bytes_.length() / 2; |
71 } | 71 } |
72 | 72 |
73 int byte_length() const { return literal_bytes_.length(); } | 73 int byte_length() const { return literal_bytes_.length(); } |
74 | 74 |
75 void Internalize(Isolate* isolate) override; | 75 void Internalize(Isolate* isolate) override; |
76 | 76 |
77 bool AsArrayIndex(uint32_t* index) const; | 77 bool AsArrayIndex(uint32_t* index, |
| 78 HandleDereferenceMode deref_mode = |
| 79 HandleDereferenceMode::kHandleDereferenceAllowed) const; |
78 | 80 |
79 // The string is not null-terminated, use length() to find out the length. | 81 // The string is not null-terminated, use length() to find out the length. |
80 const unsigned char* raw_data() const { | 82 const unsigned char* raw_data() const { |
81 return literal_bytes_.start(); | 83 return literal_bytes_.start(); |
82 } | 84 } |
83 bool is_one_byte() const { return is_one_byte_; } | 85 bool is_one_byte() const { return is_one_byte_; } |
84 bool IsOneByteEqualTo(const char* data) const; | 86 bool IsOneByteEqualTo(const char* data) const; |
85 uint16_t FirstCharacter() const { | 87 uint16_t FirstCharacter() const { |
86 if (is_one_byte_) | 88 if (is_one_byte_) |
87 return literal_bytes_[0]; | 89 return literal_bytes_[0]; |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 | 163 |
162 Smi* AsSmi() const { | 164 Smi* AsSmi() const { |
163 CHECK_EQ(SMI, type_); | 165 CHECK_EQ(SMI, type_); |
164 return Smi::FromInt(smi_); | 166 return Smi::FromInt(smi_); |
165 } | 167 } |
166 | 168 |
167 bool EqualsString(const AstRawString* string) const { | 169 bool EqualsString(const AstRawString* string) const { |
168 return type_ == STRING && string_ == string; | 170 return type_ == STRING && string_ == string; |
169 } | 171 } |
170 | 172 |
171 bool IsPropertyName() const; | 173 bool IsPropertyName( |
| 174 HandleDereferenceMode deref_mode = |
| 175 HandleDereferenceMode::kHandleDereferenceAllowed) const; |
172 | 176 |
173 bool BooleanValue() const; | 177 bool BooleanValue() const; |
174 | 178 |
175 bool IsSmi() const { return type_ == SMI; } | 179 bool IsSmi() const { return type_ == SMI; } |
176 bool IsFalse() const { return type_ == BOOLEAN && !bool_; } | 180 bool IsFalse() const { return type_ == BOOLEAN && !bool_; } |
177 bool IsTrue() const { return type_ == BOOLEAN && bool_; } | 181 bool IsTrue() const { return type_ == BOOLEAN && bool_; } |
178 bool IsUndefined() const { return type_ == UNDEFINED; } | 182 bool IsUndefined() const { return type_ == UNDEFINED; } |
179 bool IsTheHole() const { return type_ == THE_HOLE; } | 183 bool IsTheHole() const { return type_ == THE_HOLE; } |
180 bool IsNull() const { return type_ == NULL_TYPE; } | 184 bool IsNull() const { return type_ == NULL_TYPE; } |
181 | 185 |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 OTHER_CONSTANTS(F) | 389 OTHER_CONSTANTS(F) |
386 #undef F | 390 #undef F |
387 }; | 391 }; |
388 } // namespace internal | 392 } // namespace internal |
389 } // namespace v8 | 393 } // namespace v8 |
390 | 394 |
391 #undef STRING_CONSTANTS | 395 #undef STRING_CONSTANTS |
392 #undef OTHER_CONSTANTS | 396 #undef OTHER_CONSTANTS |
393 | 397 |
394 #endif // V8_AST_AST_VALUE_FACTORY_H_ | 398 #endif // V8_AST_AST_VALUE_FACTORY_H_ |
OLD | NEW |