| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 virtual void Internalize(Isolate* isolate) OVERRIDE; | 131 virtual void Internalize(Isolate* isolate) OVERRIDE; |
| 132 | 132 |
| 133 private: | 133 private: |
| 134 friend class AstValueFactory; | 134 friend class AstValueFactory; |
| 135 | 135 |
| 136 const AstString* left_; | 136 const AstString* left_; |
| 137 const AstString* right_; | 137 const AstString* right_; |
| 138 }; | 138 }; |
| 139 | 139 |
| 140 | 140 |
| 141 class AstTemplateSpan { |
| 142 public: |
| 143 AstTemplateSpan(const AstString* value, const AstString* rawValue) |
| 144 : tv_(value), trv_(rawValue) {} |
| 145 |
| 146 Handle<String> value() const { return tv_->string(); } |
| 147 |
| 148 Handle<String> rawValue() const { return trv_->string(); } |
| 149 |
| 150 private: |
| 151 friend class AstValueFactory; |
| 152 |
| 153 const AstString* tv_; |
| 154 const AstString* trv_; |
| 155 }; |
| 156 |
| 157 |
| 141 // AstValue is either a string, a number, a string array, a boolean, or a | 158 // AstValue is either a string, a number, a string array, a boolean, or a |
| 142 // special value (null, undefined, the hole). | 159 // special value (null, undefined, the hole). |
| 143 class AstValue : public ZoneObject { | 160 class AstValue : public ZoneObject { |
| 144 public: | 161 public: |
| 145 bool IsString() const { | 162 bool IsString() const { |
| 146 return type_ == STRING; | 163 return type_ == STRING; |
| 147 } | 164 } |
| 148 | 165 |
| 149 bool IsNumber() const { | 166 bool IsNumber() const { |
| 150 return type_ == NUMBER || type_ == SMI; | 167 return type_ == NUMBER || type_ == SMI; |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 311 |
| 295 const AstRawString* GetOneByteString(Vector<const uint8_t> literal); | 312 const AstRawString* GetOneByteString(Vector<const uint8_t> literal); |
| 296 const AstRawString* GetOneByteString(const char* string) { | 313 const AstRawString* GetOneByteString(const char* string) { |
| 297 return GetOneByteString(Vector<const uint8_t>( | 314 return GetOneByteString(Vector<const uint8_t>( |
| 298 reinterpret_cast<const uint8_t*>(string), StrLength(string))); | 315 reinterpret_cast<const uint8_t*>(string), StrLength(string))); |
| 299 } | 316 } |
| 300 const AstRawString* GetTwoByteString(Vector<const uint16_t> literal); | 317 const AstRawString* GetTwoByteString(Vector<const uint16_t> literal); |
| 301 const AstRawString* GetString(Handle<String> literal); | 318 const AstRawString* GetString(Handle<String> literal); |
| 302 const AstConsString* NewConsString(const AstString* left, | 319 const AstConsString* NewConsString(const AstString* left, |
| 303 const AstString* right); | 320 const AstString* right); |
| 304 | 321 const AstTemplateSpan* NewTemplateSpan(const AstString* value, |
| 322 const AstString* rawValue); |
| 305 void Internalize(Isolate* isolate); | 323 void Internalize(Isolate* isolate); |
| 306 bool IsInternalized() { | 324 bool IsInternalized() { |
| 307 return isolate_ != NULL; | 325 return isolate_ != NULL; |
| 308 } | 326 } |
| 309 | 327 |
| 310 #define F(name, str) \ | 328 #define F(name, str) \ |
| 311 const AstRawString* name##_string() { \ | 329 const AstRawString* name##_string() { \ |
| 312 if (name##_string_ == NULL) { \ | 330 if (name##_string_ == NULL) { \ |
| 313 const char* data = str; \ | 331 const char* data = str; \ |
| 314 name##_string_ = GetOneByteString( \ | 332 name##_string_ = GetOneByteString( \ |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 | 376 |
| 359 bool AstRawString::IsArguments(AstValueFactory* ast_value_factory) const { | 377 bool AstRawString::IsArguments(AstValueFactory* ast_value_factory) const { |
| 360 return ast_value_factory->arguments_string() == this; | 378 return ast_value_factory->arguments_string() == this; |
| 361 } | 379 } |
| 362 } } // namespace v8::internal | 380 } } // namespace v8::internal |
| 363 | 381 |
| 364 #undef STRING_CONSTANTS | 382 #undef STRING_CONSTANTS |
| 365 #undef OTHER_CONSTANTS | 383 #undef OTHER_CONSTANTS |
| 366 | 384 |
| 367 #endif // V8_AST_VALUE_FACTORY_H_ | 385 #endif // V8_AST_VALUE_FACTORY_H_ |
| OLD | NEW |