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