| 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 #define F(name, str) name##_string_ = NULL; | 280 #define F(name, str) name##_string_ = NULL; |
| 281 STRING_CONSTANTS(F) | 281 STRING_CONSTANTS(F) |
| 282 #undef F | 282 #undef F |
| 283 #define F(name) name##_ = NULL; | 283 #define F(name) name##_ = NULL; |
| 284 OTHER_CONSTANTS(F) | 284 OTHER_CONSTANTS(F) |
| 285 #undef F | 285 #undef F |
| 286 } | 286 } |
| 287 | 287 |
| 288 Zone* zone() const { return zone_; } | 288 Zone* zone() const { return zone_; } |
| 289 | 289 |
| 290 const AstRawString* GetOneByteString(Vector<const uint8_t> literal); | 290 const AstRawString* GetOneByteString(Vector<const uint8_t> literal) { |
| 291 return GetOneByteStringInternal(literal); |
| 292 } |
| 291 const AstRawString* GetOneByteString(const char* string) { | 293 const AstRawString* GetOneByteString(const char* string) { |
| 292 return GetOneByteString(Vector<const uint8_t>( | 294 return GetOneByteString(Vector<const uint8_t>( |
| 293 reinterpret_cast<const uint8_t*>(string), StrLength(string))); | 295 reinterpret_cast<const uint8_t*>(string), StrLength(string))); |
| 294 } | 296 } |
| 295 const AstRawString* GetTwoByteString(Vector<const uint16_t> literal); | 297 const AstRawString* GetTwoByteString(Vector<const uint16_t> literal) { |
| 298 return GetTwoByteStringInternal(literal); |
| 299 } |
| 296 const AstRawString* GetString(Handle<String> literal); | 300 const AstRawString* GetString(Handle<String> literal); |
| 297 const AstConsString* NewConsString(const AstString* left, | 301 const AstConsString* NewConsString(const AstString* left, |
| 298 const AstString* right); | 302 const AstString* right); |
| 299 | 303 |
| 300 void Internalize(Isolate* isolate); | 304 void Internalize(Isolate* isolate); |
| 301 bool IsInternalized() { | 305 bool IsInternalized() { |
| 302 return isolate_ != NULL; | 306 return isolate_ != NULL; |
| 303 } | 307 } |
| 304 | 308 |
| 305 #define F(name, str) \ | 309 #define F(name, str) \ |
| (...skipping 14 matching lines...) Expand all Loading... |
| 320 const AstValue* NewSymbol(const char* name); | 324 const AstValue* NewSymbol(const char* name); |
| 321 const AstValue* NewNumber(double number); | 325 const AstValue* NewNumber(double number); |
| 322 const AstValue* NewSmi(int number); | 326 const AstValue* NewSmi(int number); |
| 323 const AstValue* NewBoolean(bool b); | 327 const AstValue* NewBoolean(bool b); |
| 324 const AstValue* NewStringList(ZoneList<const AstRawString*>* strings); | 328 const AstValue* NewStringList(ZoneList<const AstRawString*>* strings); |
| 325 const AstValue* NewNull(); | 329 const AstValue* NewNull(); |
| 326 const AstValue* NewUndefined(); | 330 const AstValue* NewUndefined(); |
| 327 const AstValue* NewTheHole(); | 331 const AstValue* NewTheHole(); |
| 328 | 332 |
| 329 private: | 333 private: |
| 330 const AstRawString* GetString(uint32_t hash, bool is_one_byte, | 334 AstRawString* GetOneByteStringInternal(Vector<const uint8_t> literal); |
| 331 Vector<const byte> literal_bytes); | 335 AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal); |
| 336 AstRawString* GetString(uint32_t hash, bool is_one_byte, |
| 337 Vector<const byte> literal_bytes); |
| 332 | 338 |
| 333 // All strings are copied here, one after another (no NULLs inbetween). | 339 // All strings are copied here, one after another (no NULLs inbetween). |
| 334 HashMap string_table_; | 340 HashMap string_table_; |
| 335 // For keeping track of all AstValues and AstRawStrings we've created (so that | 341 // For keeping track of all AstValues and AstRawStrings we've created (so that |
| 336 // they can be internalized later). | 342 // they can be internalized later). |
| 337 List<AstValue*> values_; | 343 List<AstValue*> values_; |
| 338 List<AstString*> strings_; | 344 List<AstString*> strings_; |
| 339 Zone* zone_; | 345 Zone* zone_; |
| 340 Isolate* isolate_; | 346 Isolate* isolate_; |
| 341 | 347 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 353 | 359 |
| 354 bool AstRawString::IsArguments(AstValueFactory* ast_value_factory) const { | 360 bool AstRawString::IsArguments(AstValueFactory* ast_value_factory) const { |
| 355 return ast_value_factory->arguments_string() == this; | 361 return ast_value_factory->arguments_string() == this; |
| 356 } | 362 } |
| 357 } } // namespace v8::internal | 363 } } // namespace v8::internal |
| 358 | 364 |
| 359 #undef STRING_CONSTANTS | 365 #undef STRING_CONSTANTS |
| 360 #undef OTHER_CONSTANTS | 366 #undef OTHER_CONSTANTS |
| 361 | 367 |
| 362 #endif // V8_AST_VALUE_FACTORY_H_ | 368 #endif // V8_AST_VALUE_FACTORY_H_ |
| OLD | NEW |