| 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 10 matching lines...) Expand all Loading... |
| 21 }; | 21 }; |
| 22 | 22 |
| 23 // Interface for handle based allocation. | 23 // Interface for handle based allocation. |
| 24 class Factory final { | 24 class Factory final { |
| 25 public: | 25 public: |
| 26 Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string, | 26 Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string, |
| 27 Handle<Object> to_number, const char* type_of, | 27 Handle<Object> to_number, const char* type_of, |
| 28 byte kind); | 28 byte kind); |
| 29 | 29 |
| 30 // Allocates a fixed array initialized with undefined values. | 30 // Allocates a fixed array initialized with undefined values. |
| 31 Handle<FixedArray> NewFixedArray( | 31 V8_EXPORT_PRIVATE Handle<FixedArray> NewFixedArray( |
| 32 int size, | 32 int size, PretenureFlag pretenure = NOT_TENURED); |
| 33 PretenureFlag pretenure = NOT_TENURED); | |
| 34 | 33 |
| 35 // Allocate a new fixed array with non-existing entries (the hole). | 34 // Allocate a new fixed array with non-existing entries (the hole). |
| 36 Handle<FixedArray> NewFixedArrayWithHoles( | 35 Handle<FixedArray> NewFixedArrayWithHoles( |
| 37 int size, | 36 int size, |
| 38 PretenureFlag pretenure = NOT_TENURED); | 37 PretenureFlag pretenure = NOT_TENURED); |
| 39 | 38 |
| 40 // Allocates an uninitialized fixed array. It must be filled by the caller. | 39 // Allocates an uninitialized fixed array. It must be filled by the caller. |
| 41 Handle<FixedArray> NewUninitializedFixedArray(int size); | 40 Handle<FixedArray> NewUninitializedFixedArray(int size); |
| 42 | 41 |
| 43 // Allocate a new uninitialized fixed double array. | 42 // Allocate a new uninitialized fixed double array. |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 157 |
| 159 // TODO(dcarney): remove this function. | 158 // TODO(dcarney): remove this function. |
| 160 MUST_USE_RESULT inline MaybeHandle<String> NewStringFromAscii( | 159 MUST_USE_RESULT inline MaybeHandle<String> NewStringFromAscii( |
| 161 Vector<const char> str, | 160 Vector<const char> str, |
| 162 PretenureFlag pretenure = NOT_TENURED) { | 161 PretenureFlag pretenure = NOT_TENURED) { |
| 163 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); | 162 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); |
| 164 } | 163 } |
| 165 | 164 |
| 166 // UTF8 strings are pretenured when used for regexp literal patterns and | 165 // UTF8 strings are pretenured when used for regexp literal patterns and |
| 167 // flags in the parser. | 166 // flags in the parser. |
| 168 MUST_USE_RESULT MaybeHandle<String> NewStringFromUtf8( | 167 MUST_USE_RESULT V8_EXPORT_PRIVATE MaybeHandle<String> NewStringFromUtf8( |
| 169 Vector<const char> str, | 168 Vector<const char> str, PretenureFlag pretenure = NOT_TENURED); |
| 170 PretenureFlag pretenure = NOT_TENURED); | |
| 171 | 169 |
| 172 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( | 170 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
| 173 Vector<const uc16> str, | 171 Vector<const uc16> str, |
| 174 PretenureFlag pretenure = NOT_TENURED); | 172 PretenureFlag pretenure = NOT_TENURED); |
| 175 | 173 |
| 176 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( | 174 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( |
| 177 const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED); | 175 const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED); |
| 178 | 176 |
| 179 // Allocates an internalized string in old space based on the character | 177 // Allocates an internalized string in old space based on the character |
| 180 // stream. | 178 // stream. |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 448 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 451 PretenureFlag pretenure = NOT_TENURED) { | 449 PretenureFlag pretenure = NOT_TENURED) { |
| 452 if (capacity != 0) { | 450 if (capacity != 0) { |
| 453 elements_kind = GetHoleyElementsKind(elements_kind); | 451 elements_kind = GetHoleyElementsKind(elements_kind); |
| 454 } | 452 } |
| 455 return NewJSArray(elements_kind, 0, capacity, | 453 return NewJSArray(elements_kind, 0, capacity, |
| 456 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); | 454 INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure); |
| 457 } | 455 } |
| 458 | 456 |
| 459 // Create a JSArray with the given elements. | 457 // Create a JSArray with the given elements. |
| 460 Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements, | 458 V8_EXPORT_PRIVATE Handle<JSArray> NewJSArrayWithElements( |
| 461 ElementsKind elements_kind, int length, | 459 Handle<FixedArrayBase> elements, ElementsKind elements_kind, int length, |
| 462 PretenureFlag pretenure = NOT_TENURED); | 460 PretenureFlag pretenure = NOT_TENURED); |
| 463 | 461 |
| 464 Handle<JSArray> NewJSArrayWithElements( | 462 V8_EXPORT_PRIVATE Handle<JSArray> NewJSArrayWithElements( |
| 465 Handle<FixedArrayBase> elements, | 463 Handle<FixedArrayBase> elements, |
| 466 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, | 464 ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, |
| 467 PretenureFlag pretenure = NOT_TENURED) { | 465 PretenureFlag pretenure = NOT_TENURED) { |
| 468 return NewJSArrayWithElements(elements, elements_kind, elements->length(), | 466 return NewJSArrayWithElements(elements, elements_kind, elements->length(), |
| 469 pretenure); | 467 pretenure); |
| 470 } | 468 } |
| 471 | 469 |
| 472 void NewJSArrayStorage( | 470 void NewJSArrayStorage( |
| 473 Handle<JSArray> array, | 471 Handle<JSArray> array, |
| 474 int length, | 472 int length, |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 760 FunctionMode function_mode); | 758 FunctionMode function_mode); |
| 761 | 759 |
| 762 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, | 760 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, |
| 763 FunctionMode function_mode); | 761 FunctionMode function_mode); |
| 764 }; | 762 }; |
| 765 | 763 |
| 766 } // namespace internal | 764 } // namespace internal |
| 767 } // namespace v8 | 765 } // namespace v8 |
| 768 | 766 |
| 769 #endif // V8_FACTORY_H_ | 767 #endif // V8_FACTORY_H_ |
| OLD | NEW |