| 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 12 matching lines...) Expand all Loading... |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_AST_AST_VALUE_FACTORY_H_ | 28 #ifndef V8_AST_AST_VALUE_FACTORY_H_ |
| 29 #define V8_AST_AST_VALUE_FACTORY_H_ | 29 #define V8_AST_AST_VALUE_FACTORY_H_ |
| 30 | 30 |
| 31 #include "src/api.h" | 31 #include "src/api.h" |
| 32 #include "src/base/hashmap.h" | 32 #include "src/base/hashmap.h" |
| 33 #include "src/globals.h" |
| 33 #include "src/utils.h" | 34 #include "src/utils.h" |
| 34 | 35 |
| 35 // AstString, AstValue and AstValueFactory are for storing strings and values | 36 // AstString, AstValue and AstValueFactory are for storing strings and values |
| 36 // independent of the V8 heap and internalizing them later. During parsing, | 37 // independent of the V8 heap and internalizing them later. During parsing, |
| 37 // AstStrings and AstValues are created and stored outside the heap, in | 38 // AstStrings and AstValues are created and stored outside the heap, in |
| 38 // AstValueFactory. After parsing, the strings and values are internalized | 39 // AstValueFactory. After parsing, the strings and values are internalized |
| 39 // (moved into the V8 heap). | 40 // (moved into the V8 heap). |
| 40 namespace v8 { | 41 namespace v8 { |
| 41 namespace internal { | 42 namespace internal { |
| 42 | 43 |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 388 } | 389 } |
| 389 AstString* AddString(AstString* string) { | 390 AstString* AddString(AstString* string) { |
| 390 *strings_end_ = string; | 391 *strings_end_ = string; |
| 391 strings_end_ = string->next_location(); | 392 strings_end_ = string->next_location(); |
| 392 return string; | 393 return string; |
| 393 } | 394 } |
| 394 void ResetStrings() { | 395 void ResetStrings() { |
| 395 strings_ = nullptr; | 396 strings_ = nullptr; |
| 396 strings_end_ = &strings_; | 397 strings_end_ = &strings_; |
| 397 } | 398 } |
| 398 AstRawString* GetOneByteStringInternal(Vector<const uint8_t> literal); | 399 V8_EXPORT_PRIVATE AstRawString* GetOneByteStringInternal( |
| 400 Vector<const uint8_t> literal); |
| 399 AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal); | 401 AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal); |
| 400 AstRawString* GetString(uint32_t hash, bool is_one_byte, | 402 AstRawString* GetString(uint32_t hash, bool is_one_byte, |
| 401 Vector<const byte> literal_bytes); | 403 Vector<const byte> literal_bytes); |
| 402 | 404 |
| 403 static bool AstRawStringCompare(void* a, void* b); | 405 static bool AstRawStringCompare(void* a, void* b); |
| 404 | 406 |
| 405 // All strings are copied here, one after another (no NULLs inbetween). | 407 // All strings are copied here, one after another (no NULLs inbetween). |
| 406 base::CustomMatcherHashMap string_table_; | 408 base::CustomMatcherHashMap string_table_; |
| 407 // For keeping track of all AstValues and AstRawStrings we've created (so that | 409 // For keeping track of all AstValues and AstRawStrings we've created (so that |
| 408 // they can be internalized later). | 410 // they can be internalized later). |
| (...skipping 14 matching lines...) Expand all Loading... |
| 423 OTHER_CONSTANTS(F) | 425 OTHER_CONSTANTS(F) |
| 424 #undef F | 426 #undef F |
| 425 }; | 427 }; |
| 426 } // namespace internal | 428 } // namespace internal |
| 427 } // namespace v8 | 429 } // namespace v8 |
| 428 | 430 |
| 429 #undef STRING_CONSTANTS | 431 #undef STRING_CONSTANTS |
| 430 #undef OTHER_CONSTANTS | 432 #undef OTHER_CONSTANTS |
| 431 | 433 |
| 432 #endif // V8_AST_AST_VALUE_FACTORY_H_ | 434 #endif // V8_AST_AST_VALUE_FACTORY_H_ |
| OLD | NEW |