| 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 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 // - ...FromTwoByte initializes the string from a buffer that is two-byte | 405 // - ...FromTwoByte initializes the string from a buffer that is two-byte |
| 406 // encoded. If the characters are all single-byte characters, the | 406 // encoded. If the characters are all single-byte characters, the |
| 407 // result will be converted to ASCII, otherwise it will be left as | 407 // result will be converted to ASCII, otherwise it will be left as |
| 408 // two-byte. | 408 // two-byte. |
| 409 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 409 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 410 // failed. | 410 // failed. |
| 411 // Please note this does not perform a garbage collection. | 411 // Please note this does not perform a garbage collection. |
| 412 MUST_USE_RESULT static MaybeObject* AllocateStringFromAscii( | 412 MUST_USE_RESULT static MaybeObject* AllocateStringFromAscii( |
| 413 Vector<const char> str, | 413 Vector<const char> str, |
| 414 PretenureFlag pretenure = NOT_TENURED); | 414 PretenureFlag pretenure = NOT_TENURED); |
| 415 MUST_USE_RESULT static MaybeObject* AllocateStringFromUtf8( | 415 MUST_USE_RESULT static inline MaybeObject* AllocateStringFromUtf8( |
| 416 Vector<const char> str, |
| 417 PretenureFlag pretenure = NOT_TENURED); |
| 418 MUST_USE_RESULT static MaybeObject* AllocateStringFromUtf8Slow( |
| 416 Vector<const char> str, | 419 Vector<const char> str, |
| 417 PretenureFlag pretenure = NOT_TENURED); | 420 PretenureFlag pretenure = NOT_TENURED); |
| 418 MUST_USE_RESULT static MaybeObject* AllocateStringFromTwoByte( | 421 MUST_USE_RESULT static MaybeObject* AllocateStringFromTwoByte( |
| 419 Vector<const uc16> str, | 422 Vector<const uc16> str, |
| 420 PretenureFlag pretenure = NOT_TENURED); | 423 PretenureFlag pretenure = NOT_TENURED); |
| 421 | 424 |
| 422 // Allocates a symbol in old space based on the character stream. | 425 // Allocates a symbol in old space based on the character stream. |
| 423 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation | 426 // Returns Failure::RetryAfterGC(requested_bytes, space) if the allocation |
| 424 // failed. | 427 // failed. |
| 425 // Please note this function does not perform a garbage collection. | 428 // Please note this function does not perform a garbage collection. |
| 426 MUST_USE_RESULT static inline MaybeObject* AllocateSymbol( | 429 MUST_USE_RESULT static inline MaybeObject* AllocateSymbol( |
| 427 Vector<const char> str, | 430 Vector<const char> str, |
| 428 int chars, | 431 int chars, |
| 429 uint32_t hash_field); | 432 uint32_t hash_field); |
| 430 | 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 |
| 431 MUST_USE_RESULT static MaybeObject* AllocateInternalSymbol( | 442 MUST_USE_RESULT static MaybeObject* AllocateInternalSymbol( |
| 432 unibrow::CharacterStream* buffer, int chars, uint32_t hash_field); | 443 unibrow::CharacterStream* buffer, int chars, uint32_t hash_field); |
| 433 | 444 |
| 434 MUST_USE_RESULT static MaybeObject* AllocateExternalSymbol( | 445 MUST_USE_RESULT static MaybeObject* AllocateExternalSymbol( |
| 435 Vector<const char> str, | 446 Vector<const char> str, |
| 436 int chars); | 447 int chars); |
| 437 | 448 |
| 438 | 449 |
| 439 // Allocates and partially initializes a String. There are two String | 450 // Allocates and partially initializes a String. There are two String |
| 440 // 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... |
| 676 // the provided data as the relocation information. | 687 // the provided data as the relocation information. |
| 677 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, | 688 MUST_USE_RESULT static MaybeObject* CopyCode(Code* code, |
| 678 Vector<byte> reloc_info); | 689 Vector<byte> reloc_info); |
| 679 | 690 |
| 680 // Finds the symbol for string in the symbol table. | 691 // Finds the symbol for string in the symbol table. |
| 681 // 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. |
| 682 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation | 693 // Returns Failure::RetryAfterGC(requested_bytes, space) if allocation |
| 683 // failed. | 694 // failed. |
| 684 // Please note this function does not perform a garbage collection. | 695 // Please note this function does not perform a garbage collection. |
| 685 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); |
| 686 MUST_USE_RESULT static MaybeObject* LookupAsciiSymbol(const char* str) { | 700 MUST_USE_RESULT static MaybeObject* LookupAsciiSymbol(const char* str) { |
| 687 return LookupSymbol(CStrVector(str)); | 701 return LookupSymbol(CStrVector(str)); |
| 688 } | 702 } |
| 689 MUST_USE_RESULT static MaybeObject* LookupSymbol(String* str); | 703 MUST_USE_RESULT static MaybeObject* LookupSymbol(String* str); |
| 690 static bool LookupSymbolIfExists(String* str, String** symbol); | 704 static bool LookupSymbolIfExists(String* str, String** symbol); |
| 691 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); | 705 static bool LookupTwoCharsSymbolIfExists(String* str, String** symbol); |
| 692 | 706 |
| 693 // Compute the matching symbol map for a string if possible. | 707 // Compute the matching symbol map for a string if possible. |
| 694 // 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. |
| 695 static Map* SymbolMapForString(String* str); | 709 static Map* SymbolMapForString(String* str); |
| (...skipping 1356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2052 | 2066 |
| 2053 static Address cache_array_address() { | 2067 static Address cache_array_address() { |
| 2054 // Used to create an external reference. | 2068 // Used to create an external reference. |
| 2055 return reinterpret_cast<Address>(caches_); | 2069 return reinterpret_cast<Address>(caches_); |
| 2056 } | 2070 } |
| 2057 | 2071 |
| 2058 // Allow access to the caches_ array as an ExternalReference. | 2072 // Allow access to the caches_ array as an ExternalReference. |
| 2059 friend class ExternalReference; | 2073 friend class ExternalReference; |
| 2060 // Inline implementation of the cache. | 2074 // Inline implementation of the cache. |
| 2061 friend class TranscendentalCacheStub; | 2075 friend class TranscendentalCacheStub; |
| 2062 friend class TranscendentalCacheSSE2Stub; | |
| 2063 | 2076 |
| 2064 static TranscendentalCache* caches_[kNumberOfCaches]; | 2077 static TranscendentalCache* caches_[kNumberOfCaches]; |
| 2065 Element elements_[kCacheSize]; | 2078 Element elements_[kCacheSize]; |
| 2066 Type type_; | 2079 Type type_; |
| 2067 }; | 2080 }; |
| 2068 | 2081 |
| 2069 | 2082 |
| 2070 // External strings table is a place where all external strings are | 2083 // External strings table is a place where all external strings are |
| 2071 // registered. We need to keep track of such strings to properly | 2084 // registered. We need to keep track of such strings to properly |
| 2072 // finalize them. | 2085 // finalize them. |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2109 // 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 |
| 2110 // object has no references. Otherwise the address of the retained object | 2123 // object has no references. Otherwise the address of the retained object |
| 2111 // 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. |
| 2112 virtual Object* RetainAs(Object* object) = 0; | 2125 virtual Object* RetainAs(Object* object) = 0; |
| 2113 }; | 2126 }; |
| 2114 | 2127 |
| 2115 | 2128 |
| 2116 } } // namespace v8::internal | 2129 } } // namespace v8::internal |
| 2117 | 2130 |
| 2118 #endif // V8_HEAP_H_ | 2131 #endif // V8_HEAP_H_ |
| OLD | NEW |