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 11 matching lines...) Expand all Loading... |
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
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/hashmap.h" | 32 #include "src/base/hashmap.h" |
33 #include "src/utils.h" | 33 #include "src/utils.h" |
34 | 34 |
35 // AstString, AstValue and AstValueFactory are for storing strings and values | 35 // AstString, AstValue and AstValueFactory are for storing strings and values |
36 // independent of the V8 heap and internalizing them later. During parsing, | 36 // independent of the V8 heap and internalizing them later. During parsing, |
37 // AstStrings and AstValues are created and stored outside the heap, in | 37 // AstStrings and AstValues are created and stored outside the heap, in |
38 // AstValueFactory. After parsing, the strings and values are internalized | 38 // AstValueFactory. After parsing, the strings and values are internalized |
39 // (moved into the V8 heap). | 39 // (moved into the V8 heap). |
40 namespace v8 { | 40 namespace v8 { |
41 namespace internal { | 41 namespace internal { |
42 | 42 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 345 |
346 private: | 346 private: |
347 AstRawString* GetOneByteStringInternal(Vector<const uint8_t> literal); | 347 AstRawString* GetOneByteStringInternal(Vector<const uint8_t> literal); |
348 AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal); | 348 AstRawString* GetTwoByteStringInternal(Vector<const uint16_t> literal); |
349 AstRawString* GetString(uint32_t hash, bool is_one_byte, | 349 AstRawString* GetString(uint32_t hash, bool is_one_byte, |
350 Vector<const byte> literal_bytes); | 350 Vector<const byte> literal_bytes); |
351 | 351 |
352 static bool AstRawStringCompare(void* a, void* b); | 352 static bool AstRawStringCompare(void* a, void* b); |
353 | 353 |
354 // All strings are copied here, one after another (no NULLs inbetween). | 354 // All strings are copied here, one after another (no NULLs inbetween). |
355 HashMap string_table_; | 355 base::HashMap string_table_; |
356 // For keeping track of all AstValues and AstRawStrings we've created (so that | 356 // For keeping track of all AstValues and AstRawStrings we've created (so that |
357 // they can be internalized later). | 357 // they can be internalized later). |
358 List<AstValue*> values_; | 358 List<AstValue*> values_; |
359 List<AstString*> strings_; | 359 List<AstString*> strings_; |
360 Zone* zone_; | 360 Zone* zone_; |
361 Isolate* isolate_; | 361 Isolate* isolate_; |
362 | 362 |
363 uint32_t hash_seed_; | 363 uint32_t hash_seed_; |
364 | 364 |
365 #define F(name, str) const AstRawString* name##_string_; | 365 #define F(name, str) const AstRawString* name##_string_; |
366 STRING_CONSTANTS(F) | 366 STRING_CONSTANTS(F) |
367 #undef F | 367 #undef F |
368 | 368 |
369 #define F(name) AstValue* name##_; | 369 #define F(name) AstValue* name##_; |
370 OTHER_CONSTANTS(F) | 370 OTHER_CONSTANTS(F) |
371 #undef F | 371 #undef F |
372 }; | 372 }; |
373 } // namespace internal | 373 } // namespace internal |
374 } // namespace v8 | 374 } // namespace v8 |
375 | 375 |
376 #undef STRING_CONSTANTS | 376 #undef STRING_CONSTANTS |
377 #undef OTHER_CONSTANTS | 377 #undef OTHER_CONSTANTS |
378 | 378 |
379 #endif // V8_AST_AST_VALUE_FACTORY_H_ | 379 #endif // V8_AST_AST_VALUE_FACTORY_H_ |
OLD | NEW |