| 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 virtual int length() const V8_OVERRIDE { | 67 virtual 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 virtual void Internalize(Isolate* isolate) V8_OVERRIDE; | 73 virtual void Internalize(Isolate* isolate) OVERRIDE; |
| 74 | 74 |
| 75 bool AsArrayIndex(uint32_t* index) const; | 75 bool AsArrayIndex(uint32_t* index) const; |
| 76 | 76 |
| 77 // The string is not null-terminated, use length() to find out the length. | 77 // The string is not null-terminated, use length() to find out the length. |
| 78 const unsigned char* raw_data() const { | 78 const unsigned char* raw_data() const { |
| 79 return literal_bytes_.start(); | 79 return literal_bytes_.start(); |
| 80 } | 80 } |
| 81 bool is_one_byte() const { return is_one_byte_; } | 81 bool is_one_byte() const { return is_one_byte_; } |
| 82 bool IsOneByteEqualTo(const char* data) const; | 82 bool IsOneByteEqualTo(const char* data) const; |
| 83 uint16_t FirstCharacter() const { | 83 uint16_t FirstCharacter() const { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 113 uint32_t hash_; | 113 uint32_t hash_; |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 | 116 |
| 117 class AstConsString : public AstString { | 117 class AstConsString : public AstString { |
| 118 public: | 118 public: |
| 119 AstConsString(const AstString* left, const AstString* right) | 119 AstConsString(const AstString* left, const AstString* right) |
| 120 : left_(left), | 120 : left_(left), |
| 121 right_(right) {} | 121 right_(right) {} |
| 122 | 122 |
| 123 virtual int length() const V8_OVERRIDE { | 123 virtual int length() const OVERRIDE { |
| 124 return left_->length() + right_->length(); | 124 return left_->length() + right_->length(); |
| 125 } | 125 } |
| 126 | 126 |
| 127 virtual void Internalize(Isolate* isolate) V8_OVERRIDE; | 127 virtual void Internalize(Isolate* isolate) OVERRIDE; |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 friend class AstValueFactory; | 130 friend class AstValueFactory; |
| 131 | 131 |
| 132 const AstString* left_; | 132 const AstString* left_; |
| 133 const AstString* right_; | 133 const AstString* right_; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 | 136 |
| 137 // AstValue is either a string, a number, a string array, a boolean, or a | 137 // AstValue is either a string, a number, a string array, a boolean, or a |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 335 const AstRawString* name##_string_; | 335 const AstRawString* name##_string_; |
| 336 STRING_CONSTANTS(F) | 336 STRING_CONSTANTS(F) |
| 337 #undef F | 337 #undef F |
| 338 }; | 338 }; |
| 339 | 339 |
| 340 } } // namespace v8::internal | 340 } } // namespace v8::internal |
| 341 | 341 |
| 342 #undef STRING_CONSTANTS | 342 #undef STRING_CONSTANTS |
| 343 | 343 |
| 344 #endif // V8_AST_VALUE_FACTORY_H_ | 344 #endif // V8_AST_VALUE_FACTORY_H_ |
| OLD | NEW |