| OLD | NEW |
| 1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef V8_FACTORY_H_ | 5 #ifndef V8_FACTORY_H_ |
| 6 #define V8_FACTORY_H_ | 6 #define V8_FACTORY_H_ |
| 7 | 7 |
| 8 #include "src/isolate.h" | 8 #include "src/isolate.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/type-feedback-vector.h" | 10 #include "src/type-feedback-vector.h" |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // UTF8 strings are pretenured when used for regexp literal patterns and | 156 // UTF8 strings are pretenured when used for regexp literal patterns and |
| 157 // flags in the parser. | 157 // flags in the parser. |
| 158 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( | 158 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( |
| 159 Vector<const char> str, | 159 Vector<const char> str, |
| 160 PretenureFlag pretenure = NOT_TENURED); | 160 PretenureFlag pretenure = NOT_TENURED); |
| 161 | 161 |
| 162 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( | 162 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
| 163 Vector<const uc16> str, | 163 Vector<const uc16> str, |
| 164 PretenureFlag pretenure = NOT_TENURED); | 164 PretenureFlag pretenure = NOT_TENURED); |
| 165 | 165 |
| 166 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
| 167 const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED); |
| 168 |
| 166 // Allocates an internalized string in old space based on the character | 169 // Allocates an internalized string in old space based on the character |
| 167 // stream. | 170 // stream. |
| 168 Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str, | 171 Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str, |
| 169 int chars, uint32_t hash_field); | 172 int chars, uint32_t hash_field); |
| 170 | 173 |
| 171 Handle<String> NewOneByteInternalizedString(Vector<const uint8_t> str, | 174 Handle<String> NewOneByteInternalizedString(Vector<const uint8_t> str, |
| 172 uint32_t hash_field); | 175 uint32_t hash_field); |
| 173 | 176 |
| 174 Handle<String> NewOneByteInternalizedSubString( | 177 Handle<String> NewOneByteInternalizedSubString( |
| 175 Handle<SeqOneByteString> string, int offset, int length, | 178 Handle<SeqOneByteString> string, int offset, int length, |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 // not initialized by New<>() functions. It's the responsibility of the caller | 696 // not initialized by New<>() functions. It's the responsibility of the caller |
| 694 // to do that. | 697 // to do that. |
| 695 template<typename T> | 698 template<typename T> |
| 696 Handle<T> New(Handle<Map> map, AllocationSpace space); | 699 Handle<T> New(Handle<Map> map, AllocationSpace space); |
| 697 | 700 |
| 698 template<typename T> | 701 template<typename T> |
| 699 Handle<T> New(Handle<Map> map, | 702 Handle<T> New(Handle<Map> map, |
| 700 AllocationSpace space, | 703 AllocationSpace space, |
| 701 Handle<AllocationSite> allocation_site); | 704 Handle<AllocationSite> allocation_site); |
| 702 | 705 |
| 706 MaybeHandle<String> NewStringFromTwoByte(const uc16* string, int length, |
| 707 PretenureFlag pretenure); |
| 708 |
| 703 // Creates a code object that is not yet fully initialized yet. | 709 // Creates a code object that is not yet fully initialized yet. |
| 704 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); | 710 inline Handle<Code> NewCodeRaw(int object_size, bool immovable); |
| 705 | 711 |
| 706 // Attempt to find the number in a small cache. If we finds it, return | 712 // Attempt to find the number in a small cache. If we finds it, return |
| 707 // the string representation of the number. Otherwise return undefined. | 713 // the string representation of the number. Otherwise return undefined. |
| 708 Handle<Object> GetNumberStringCache(Handle<Object> number); | 714 Handle<Object> GetNumberStringCache(Handle<Object> number); |
| 709 | 715 |
| 710 // Update the cache with a new number-string pair. | 716 // Update the cache with a new number-string pair. |
| 711 void SetNumberStringCache(Handle<Object> number, Handle<String> string); | 717 void SetNumberStringCache(Handle<Object> number, Handle<String> string); |
| 712 | 718 |
| 713 // Creates a function initialized with a shared part. | 719 // Creates a function initialized with a shared part. |
| 714 Handle<JSFunction> NewFunction(Handle<Map> map, | 720 Handle<JSFunction> NewFunction(Handle<Map> map, |
| 715 Handle<SharedFunctionInfo> info, | 721 Handle<SharedFunctionInfo> info, |
| 716 Handle<Context> context, | 722 Handle<Context> context, |
| 717 PretenureFlag pretenure = TENURED); | 723 PretenureFlag pretenure = TENURED); |
| 718 | 724 |
| 719 // Create a JSArray with no elements and no length. | 725 // Create a JSArray with no elements and no length. |
| 720 Handle<JSArray> NewJSArray(ElementsKind elements_kind, | 726 Handle<JSArray> NewJSArray(ElementsKind elements_kind, |
| 721 PretenureFlag pretenure = NOT_TENURED); | 727 PretenureFlag pretenure = NOT_TENURED); |
| 722 }; | 728 }; |
| 723 | 729 |
| 724 } // namespace internal | 730 } // namespace internal |
| 725 } // namespace v8 | 731 } // namespace v8 |
| 726 | 732 |
| 727 #endif // V8_FACTORY_H_ | 733 #endif // V8_FACTORY_H_ |
| OLD | NEW |