Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1152)

Side by Side Diff: src/factory.h

Issue 2360983002: Enable component builds for fuzzers (Closed)
Patch Set: Rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/execution.h ('k') | src/handles.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 Handle<Object> extension); 74 Handle<Object> extension);
75 75
76 // Create a pre-tenured empty AccessorPair. 76 // Create a pre-tenured empty AccessorPair.
77 Handle<AccessorPair> NewAccessorPair(); 77 Handle<AccessorPair> NewAccessorPair();
78 78
79 // Create an empty TypeFeedbackInfo. 79 // Create an empty TypeFeedbackInfo.
80 Handle<TypeFeedbackInfo> NewTypeFeedbackInfo(); 80 Handle<TypeFeedbackInfo> NewTypeFeedbackInfo();
81 81
82 // Finds the internalized copy for string in the string table. 82 // Finds the internalized copy for string in the string table.
83 // If not found, a new string is added to the table and returned. 83 // If not found, a new string is added to the table and returned.
84 Handle<String> InternalizeUtf8String(Vector<const char> str); 84 V8_EXPORT_PRIVATE Handle<String> InternalizeUtf8String(
85 Vector<const char> str);
85 Handle<String> InternalizeUtf8String(const char* str) { 86 Handle<String> InternalizeUtf8String(const char* str) {
86 return InternalizeUtf8String(CStrVector(str)); 87 return InternalizeUtf8String(CStrVector(str));
87 } 88 }
88 89
89 Handle<String> InternalizeOneByteString(Vector<const uint8_t> str); 90 Handle<String> InternalizeOneByteString(Vector<const uint8_t> str);
90 Handle<String> InternalizeOneByteString( 91 Handle<String> InternalizeOneByteString(
91 Handle<SeqOneByteString>, int from, int length); 92 Handle<SeqOneByteString>, int from, int length);
92 93
93 Handle<String> InternalizeTwoByteString(Vector<const uc16> str); 94 Handle<String> InternalizeTwoByteString(Vector<const uc16> str);
94 95
(...skipping 24 matching lines...) Expand all
119 // encoded (it does not check that the buffer is Latin1 encoded) and 120 // encoded (it does not check that the buffer is Latin1 encoded) and
120 // the result will be Latin1 encoded. 121 // the result will be Latin1 encoded.
121 // - ...FromUtf8 initializes the string from a buffer that is UTF-8 122 // - ...FromUtf8 initializes the string from a buffer that is UTF-8
122 // encoded. If the characters are all ASCII characters, the result 123 // encoded. If the characters are all ASCII characters, the result
123 // will be Latin1 encoded, otherwise it will converted to two-byte. 124 // will be Latin1 encoded, otherwise it will converted to two-byte.
124 // - ...FromTwoByte initializes the string from a buffer that is two-byte 125 // - ...FromTwoByte initializes the string from a buffer that is two-byte
125 // encoded. If the characters are all Latin1 characters, the result 126 // encoded. If the characters are all Latin1 characters, the result
126 // will be converted to Latin1, otherwise it will be left as two-byte. 127 // will be converted to Latin1, otherwise it will be left as two-byte.
127 // 128 //
128 // One-byte strings are pretenured when used as keys in the SourceCodeCache. 129 // One-byte strings are pretenured when used as keys in the SourceCodeCache.
129 MUST_USE_RESULT MaybeHandle<String> NewStringFromOneByte( 130 V8_EXPORT_PRIVATE MUST_USE_RESULT MaybeHandle<String> NewStringFromOneByte(
130 Vector<const uint8_t> str, 131 Vector<const uint8_t> str, PretenureFlag pretenure = NOT_TENURED);
131 PretenureFlag pretenure = NOT_TENURED);
132 132
133 template <size_t N> 133 template <size_t N>
134 inline Handle<String> NewStringFromStaticChars( 134 inline Handle<String> NewStringFromStaticChars(
135 const char (&str)[N], PretenureFlag pretenure = NOT_TENURED) { 135 const char (&str)[N], PretenureFlag pretenure = NOT_TENURED) {
136 DCHECK(N == StrLength(str) + 1); 136 DCHECK(N == StrLength(str) + 1);
137 return NewStringFromOneByte(STATIC_CHAR_VECTOR(str), pretenure) 137 return NewStringFromOneByte(STATIC_CHAR_VECTOR(str), pretenure)
138 .ToHandleChecked(); 138 .ToHandleChecked();
139 } 139 }
140 140
141 inline Handle<String> NewStringFromAsciiChecked( 141 inline Handle<String> NewStringFromAsciiChecked(
(...skipping 24 matching lines...) Expand all
166 Vector<const char> str, 166 Vector<const char> str,
167 PretenureFlag pretenure = NOT_TENURED) { 167 PretenureFlag pretenure = NOT_TENURED) {
168 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure); 168 return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure);
169 } 169 }
170 170
171 // UTF8 strings are pretenured when used for regexp literal patterns and 171 // UTF8 strings are pretenured when used for regexp literal patterns and
172 // flags in the parser. 172 // flags in the parser.
173 MUST_USE_RESULT V8_EXPORT_PRIVATE MaybeHandle<String> NewStringFromUtf8( 173 MUST_USE_RESULT V8_EXPORT_PRIVATE MaybeHandle<String> NewStringFromUtf8(
174 Vector<const char> str, PretenureFlag pretenure = NOT_TENURED); 174 Vector<const char> str, PretenureFlag pretenure = NOT_TENURED);
175 175
176 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( 176 V8_EXPORT_PRIVATE MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
177 Vector<const uc16> str, 177 Vector<const uc16> str, PretenureFlag pretenure = NOT_TENURED);
178 PretenureFlag pretenure = NOT_TENURED);
179 178
180 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte( 179 MUST_USE_RESULT MaybeHandle<String> NewStringFromTwoByte(
181 const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED); 180 const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED);
182 181
183 Handle<JSStringIterator> NewJSStringIterator(Handle<String> string); 182 Handle<JSStringIterator> NewJSStringIterator(Handle<String> string);
184 183
185 // Allocates an internalized string in old space based on the character 184 // Allocates an internalized string in old space based on the character
186 // stream. 185 // stream.
187 Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str, 186 Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str,
188 int chars, uint32_t hash_field); 187 int chars, uint32_t hash_field);
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 299
301 // Allocate a new struct. The struct is pretenured (allocated directly in 300 // Allocate a new struct. The struct is pretenured (allocated directly in
302 // the old generation). 301 // the old generation).
303 Handle<Struct> NewStruct(InstanceType type); 302 Handle<Struct> NewStruct(InstanceType type);
304 303
305 Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry( 304 Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
306 int aliased_context_slot); 305 int aliased_context_slot);
307 306
308 Handle<AccessorInfo> NewAccessorInfo(); 307 Handle<AccessorInfo> NewAccessorInfo();
309 308
310 Handle<Script> NewScript(Handle<String> source); 309 V8_EXPORT_PRIVATE Handle<Script> NewScript(Handle<String> source);
311 310
312 // Foreign objects are pretenured when allocated by the bootstrapper. 311 // Foreign objects are pretenured when allocated by the bootstrapper.
313 Handle<Foreign> NewForeign(Address addr, 312 Handle<Foreign> NewForeign(Address addr,
314 PretenureFlag pretenure = NOT_TENURED); 313 PretenureFlag pretenure = NOT_TENURED);
315 314
316 // Allocate a new foreign object. The foreign is pretenured (allocated 315 // Allocate a new foreign object. The foreign is pretenured (allocated
317 // directly in the old generation). 316 // directly in the old generation).
318 Handle<Foreign> NewForeign(const AccessorDescriptor* foreign); 317 Handle<Foreign> NewForeign(const AccessorDescriptor* foreign);
319 318
320 Handle<ByteArray> NewByteArray(int length, 319 Handle<ByteArray> NewByteArray(int length,
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 // runtime. 443 // runtime.
445 Handle<JSObject> NewJSObjectFromMap( 444 Handle<JSObject> NewJSObjectFromMap(
446 Handle<Map> map, 445 Handle<Map> map,
447 PretenureFlag pretenure = NOT_TENURED, 446 PretenureFlag pretenure = NOT_TENURED,
448 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null()); 447 Handle<AllocationSite> allocation_site = Handle<AllocationSite>::null());
449 448
450 // JS arrays are pretenured when allocated by the parser. 449 // JS arrays are pretenured when allocated by the parser.
451 450
452 // Create a JSArray with a specified length and elements initialized 451 // Create a JSArray with a specified length and elements initialized
453 // according to the specified mode. 452 // according to the specified mode.
454 Handle<JSArray> NewJSArray( 453 V8_EXPORT_PRIVATE Handle<JSArray> NewJSArray(
455 ElementsKind elements_kind, int length, int capacity, 454 ElementsKind elements_kind, int length, int capacity,
456 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS, 455 ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS,
457 PretenureFlag pretenure = NOT_TENURED); 456 PretenureFlag pretenure = NOT_TENURED);
458 457
459 Handle<JSArray> NewJSArray( 458 Handle<JSArray> NewJSArray(
460 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND, 459 int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
461 PretenureFlag pretenure = NOT_TENURED) { 460 PretenureFlag pretenure = NOT_TENURED) {
462 if (capacity != 0) { 461 if (capacity != 0) {
463 elements_kind = GetHoleyElementsKind(elements_kind); 462 elements_kind = GetHoleyElementsKind(elements_kind);
464 } 463 }
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
772 FunctionMode function_mode); 771 FunctionMode function_mode);
773 772
774 void SetStrictFunctionInstanceDescriptor(Handle<Map> map, 773 void SetStrictFunctionInstanceDescriptor(Handle<Map> map,
775 FunctionMode function_mode); 774 FunctionMode function_mode);
776 }; 775 };
777 776
778 } // namespace internal 777 } // namespace internal
779 } // namespace v8 778 } // namespace v8
780 779
781 #endif // V8_FACTORY_H_ 780 #endif // V8_FACTORY_H_
OLDNEW
« no previous file with comments | « src/execution.h ('k') | src/handles.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698