| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 } | 57 } |
| 58 | 58 |
| 59 protected: | 59 protected: |
| 60 // This is null until the string is internalized. | 60 // This is null until the string is internalized. |
| 61 Handle<String> string_; | 61 Handle<String> string_; |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 | 64 |
| 65 class AstRawString : public AstString { | 65 class AstRawString : public AstString { |
| 66 public: | 66 public: |
| 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) const; |
| 78 | 78 |
| 79 // The string is not null-terminated, use length() to find out the length. | 79 // The string is not null-terminated, use length() to find out the length. |
| 80 const unsigned char* raw_data() const { | 80 const unsigned char* raw_data() const { |
| 81 return literal_bytes_.start(); | 81 return literal_bytes_.start(); |
| 82 } | 82 } |
| 83 bool is_one_byte() const { return is_one_byte_; } | 83 bool is_one_byte() const { return is_one_byte_; } |
| 84 bool IsOneByteEqualTo(const char* data) const; | 84 bool IsOneByteEqualTo(const char* data) const; |
| 85 uint16_t FirstCharacter() const { | 85 uint16_t FirstCharacter() const { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 114 uint32_t hash_; | 114 uint32_t hash_; |
| 115 }; | 115 }; |
| 116 | 116 |
| 117 | 117 |
| 118 class AstConsString : public AstString { | 118 class AstConsString : public AstString { |
| 119 public: | 119 public: |
| 120 AstConsString(const AstString* left, const AstString* right) | 120 AstConsString(const AstString* left, const AstString* right) |
| 121 : left_(left), | 121 : left_(left), |
| 122 right_(right) {} | 122 right_(right) {} |
| 123 | 123 |
| 124 int length() const OVERRIDE { return left_->length() + right_->length(); } | 124 int length() const override { return left_->length() + right_->length(); } |
| 125 | 125 |
| 126 void Internalize(Isolate* isolate) OVERRIDE; | 126 void Internalize(Isolate* isolate) override; |
| 127 | 127 |
| 128 private: | 128 private: |
| 129 friend class AstValueFactory; | 129 friend class AstValueFactory; |
| 130 | 130 |
| 131 const AstString* left_; | 131 const AstString* left_; |
| 132 const AstString* right_; | 132 const AstString* right_; |
| 133 }; | 133 }; |
| 134 | 134 |
| 135 | 135 |
| 136 // AstValue is either a string, a number, a string array, a boolean, or a | 136 // AstValue is either a string, a number, a string array, a boolean, or a |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 #define F(name) AstValue* name##_; | 364 #define F(name) AstValue* name##_; |
| 365 OTHER_CONSTANTS(F) | 365 OTHER_CONSTANTS(F) |
| 366 #undef F | 366 #undef F |
| 367 }; | 367 }; |
| 368 } } // namespace v8::internal | 368 } } // namespace v8::internal |
| 369 | 369 |
| 370 #undef STRING_CONSTANTS | 370 #undef STRING_CONSTANTS |
| 371 #undef OTHER_CONSTANTS | 371 #undef OTHER_CONSTANTS |
| 372 | 372 |
| 373 #endif // V8_AST_VALUE_FACTORY_H_ | 373 #endif // V8_AST_VALUE_FACTORY_H_ |
| OLD | NEW |