OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 | 424 |
425 // Allocates a symbol in old space based on the character stream. | 425 // Allocates a symbol in old space based on the character stream. |
426 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 426 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
427 // failed. | 427 // failed. |
428 // Please note this function does not perform a garbage collection. | 428 // Please note this function does not perform a garbage collection. |
429 MUST_USE_RESULT static inline MaybeObject* AllocateSymbol( | 429 MUST_USE_RESULT static inline MaybeObject* AllocateSymbol( |
430 Vector<const char> str, | 430 Vector<const char> str, |
431 int chars, | 431 int chars, |
432 uint32_t hash_field); | 432 uint32_t hash_field); |
433 | 433 |
| 434 MUST_USE_RESULT static inline MaybeObject* AllocateAsciiSymbol( |
| 435 Vector<const char> str, |
| 436 uint32_t hash_field); |
| 437 |
| 438 MUST_USE_RESULT static inline MaybeObject* AllocateTwoByteSymbol( |
| 439 Vector<const uc16> str, |
| 440 uint32_t hash_field); |
| 441 |
434 MUST_USE_RESULT static MaybeObject* AllocateInternalSymbol( | 442 MUST_USE_RESULT static MaybeObject* AllocateInternalSymbol( |
435 unibrow::CharacterStream* buffer, int chars, uint32_t hash_field); | 443 unibrow::CharacterStream* buffer, int chars, uint32_t hash_field); |
436 | 444 |
437 MUST_USE_RESULT static MaybeObject* AllocateExternalSymbol( | 445 MUST_USE_RESULT static MaybeObject* AllocateExternalSymbol( |
438 Vector<const char> str, | 446 Vector<const char> str, |
439 int chars); | 447 int chars); |
440 | 448 |
441 | 449 |
442 // Allocates and partially initializes a String. There are two String | 450 // Allocates and partially initializes a String. There are two String |
443 // encodings: ASCII and two byte. These functions allocate a string of the | 451 // encodings: ASCII and two byte. These functions allocate a string of the |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 // the provided data as the relocation information. | 687 // the provided data as the relocation information. |
680 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, | 688 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, |
681 Vector<byte> reloc_info); | 689 Vector<byte> reloc_info); |
682 | 690 |
683 // Finds the symbol for string in the symbol table. | 691 // Finds the symbol for string in the symbol table. |
684 // If not found, a new symbol is added to the table and returned. | 692 // If not found, a new symbol is added to the table and returned. |
685 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 693 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
686 // failed. | 694 // failed. |
687 // Please note this function does not perform a garbage collection. | 695 // Please note this function does not perform a garbage collection. |
688 MUST_USE_RESULT static MaybeObject* LookupSymbol(Vector<const char> str); | 696 MUST_USE_RESULT static MaybeObject* LookupSymbol(Vector<const char> str); |
| 697 MUST_USE_RESULT static MaybeObject* LookupAsciiSymbol(Vector<const char> str); |
| 698 MUST_USE_RESULT static MaybeObject* LookupTwoByteSymbol( |
| 699 Vector<const uc16> str); |
689 MUST_USE_RESULT static MaybeObject* LookupAsciiSymbol(const char* str) { | 700 MUST_USE_RESULT static MaybeObject* LookupAsciiSymbol(const char* str) { |
690 return LookupSymbol(CStrVector(str)); | 701 return LookupSymbol(CStrVector(str)); |
691 } | 702 } |
692 MUST_USE_RESULT static MaybeObject* LookupSymbol(String* str); | 703 MUST_USE_RESULT static MaybeObject* LookupSymbol(String* str); |
693 static bool LookupSymbolIfExists(String* str, String** symbol); | 704 static bool LookupSymbolIfExists(String* str, String** symbol); |
694 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); | 705 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); |
695 | 706 |
696 // Compute the matching symbol map for a string if possible. | 707 // Compute the matching symbol map for a string if possible. |
697 // NULL is returned if string is in new space or not flattened. | 708 // NULL is returned if string is in new space or not flattened. |
698 static Map* SymbolMapForString(String* str); | 709 static Map* SymbolMapForString(String* str); |
(...skipping 1412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2111 // Return whether this object should be retained. If NULL is returned the | 2122 // Return whether this object should be retained. If NULL is returned the |
2112 // object has no references. Otherwise the address of the retained object | 2123 // object has no references. Otherwise the address of the retained object |
2113 // should be returned as in some GC situations the object has been moved. | 2124 // should be returned as in some GC situations the object has been moved. |
2114 virtual Object* RetainAs(Object* object) = 0; | 2125 virtual Object* RetainAs(Object* object) = 0; |
2115 }; | 2126 }; |
2116 | 2127 |
2117 | 2128 |
2118 } } // namespace v8::internal | 2129 } } // namespace v8::internal |
2119 | 2130 |
2120 #endif // V8_HEAP_H_ | 2131 #endif // V8_HEAP_H_ |
OLD | NEW |