V8 API Reference, 7.2.502.16 (for Deno 0.2.4)
factory.h
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
3 // found in the LICENSE file.
4 
5 #ifndef V8_HEAP_FACTORY_H_
6 #define V8_HEAP_FACTORY_H_
7 
8 // Clients of this interface shouldn't depend on lots of heap internals.
9 // Do not include anything from src/heap here!
10 #include "src/builtins/builtins.h"
11 #include "src/globals.h"
12 #include "src/handles.h"
13 #include "src/heap/heap.h"
14 #include "src/maybe-handles.h"
15 #include "src/messages.h"
16 #include "src/objects/code.h"
17 #include "src/objects/dictionary.h"
18 #include "src/objects/hash-table.h"
19 #include "src/objects/js-array-buffer.h"
20 #include "src/objects/js-array.h"
21 #include "src/objects/js-regexp.h"
22 #include "src/objects/ordered-hash-table.h"
23 #include "src/objects/string.h"
24 
25 namespace v8 {
26 namespace internal {
27 
28 // Forward declarations.
29 class AliasedArgumentsEntry;
30 class ObjectBoilerplateDescription;
31 class BreakPoint;
32 class BreakPointInfo;
33 class CallableTask;
34 class CallbackTask;
35 class CallHandlerInfo;
36 class Expression;
37 class EmbedderDataArray;
38 class ArrayBoilerplateDescription;
39 class CoverageInfo;
40 class DebugInfo;
41 class EnumCache;
42 class FreshlyAllocatedBigInt;
43 class Isolate;
44 class JSGeneratorObject;
45 class JSMap;
46 class JSMapIterator;
47 class JSModuleNamespace;
48 class JSPromise;
49 class JSProxy;
50 class JSSet;
51 class JSSetIterator;
52 class JSWeakMap;
53 class LoadHandler;
54 class ModuleInfo;
55 class NativeContext;
56 class NewFunctionArgs;
57 class PreParsedScopeData;
58 class PromiseResolveThenableJobTask;
59 class RegExpMatchInfo;
60 class ScriptContextTable;
61 class StackFrameInfo;
62 class StoreHandler;
63 class TemplateObjectDescription;
64 class UncompiledDataWithoutPreParsedScope;
65 class UncompiledDataWithPreParsedScope;
66 class WasmExportedFunctionData;
67 class WeakFactoryCleanupJobTask;
68 struct SourceRange;
69 template <typename T>
70 class ZoneVector;
71 
72 enum FunctionMode {
73  kWithNameBit = 1 << 0,
74  kWithHomeObjectBit = 1 << 1,
75  kWithWritablePrototypeBit = 1 << 2,
76  kWithReadonlyPrototypeBit = 1 << 3,
77  kWithPrototypeBits = kWithWritablePrototypeBit | kWithReadonlyPrototypeBit,
78 
79  // Without prototype.
80  FUNCTION_WITHOUT_PROTOTYPE = 0,
81  METHOD_WITH_NAME = kWithNameBit,
82  METHOD_WITH_HOME_OBJECT = kWithHomeObjectBit,
83  METHOD_WITH_NAME_AND_HOME_OBJECT = kWithNameBit | kWithHomeObjectBit,
84 
85  // With writable prototype.
86  FUNCTION_WITH_WRITEABLE_PROTOTYPE = kWithWritablePrototypeBit,
87  FUNCTION_WITH_NAME_AND_WRITEABLE_PROTOTYPE =
88  kWithWritablePrototypeBit | kWithNameBit,
89  FUNCTION_WITH_HOME_OBJECT_AND_WRITEABLE_PROTOTYPE =
90  kWithWritablePrototypeBit | kWithHomeObjectBit,
91  FUNCTION_WITH_NAME_AND_HOME_OBJECT_AND_WRITEABLE_PROTOTYPE =
92  kWithWritablePrototypeBit | kWithNameBit | kWithHomeObjectBit,
93 
94  // With readonly prototype.
95  FUNCTION_WITH_READONLY_PROTOTYPE = kWithReadonlyPrototypeBit,
96  FUNCTION_WITH_NAME_AND_READONLY_PROTOTYPE =
97  kWithReadonlyPrototypeBit | kWithNameBit,
98 };
99 
100 // Interface for handle based allocation.
101 class V8_EXPORT_PRIVATE Factory {
102  public:
103  Handle<Oddball> NewOddball(Handle<Map> map, const char* to_string,
104  Handle<Object> to_number, const char* type_of,
105  byte kind,
106  PretenureFlag pretenure = TENURED_READ_ONLY);
107 
108  // Marks self references within code generation.
109  Handle<Oddball> NewSelfReferenceMarker(PretenureFlag pretenure = TENURED);
110 
111  // Allocates a fixed array-like object with given map and initialized with
112  // undefined values.
113  template <typename T = FixedArray>
114  Handle<T> NewFixedArrayWithMap(RootIndex map_root_index, int length,
115  PretenureFlag pretenure = NOT_TENURED);
116 
117  // Allocates a weak fixed array-like object with given map and initialized
118  // with undefined values.
119  template <typename T = WeakFixedArray>
120  Handle<T> NewWeakFixedArrayWithMap(RootIndex map_root_index, int length,
121  PretenureFlag pretenure = NOT_TENURED);
122 
123  // Allocates a fixed array initialized with undefined values.
124  Handle<FixedArray> NewFixedArray(int length,
125  PretenureFlag pretenure = NOT_TENURED);
126 
127  // Allocates a fixed array which may contain in-place weak references. The
128  // array is initialized with undefined values
129  Handle<WeakFixedArray> NewWeakFixedArray(
130  int length, PretenureFlag pretenure = NOT_TENURED);
131 
132  // Allocates a property array initialized with undefined values.
133  Handle<PropertyArray> NewPropertyArray(int length,
134  PretenureFlag pretenure = NOT_TENURED);
135  // Tries allocating a fixed array initialized with undefined values.
136  // In case of an allocation failure (OOM) an empty handle is returned.
137  // The caller has to manually signal an
138  // v8::internal::Heap::FatalProcessOutOfMemory typically by calling
139  // NewFixedArray as a fallback.
140  V8_WARN_UNUSED_RESULT
141  MaybeHandle<FixedArray> TryNewFixedArray(
142  int length, PretenureFlag pretenure = NOT_TENURED);
143 
144  // Allocate a new fixed array with non-existing entries (the hole).
145  Handle<FixedArray> NewFixedArrayWithHoles(
146  int length, PretenureFlag pretenure = NOT_TENURED);
147 
148  // Allocates an uninitialized fixed array. It must be filled by the caller.
149  Handle<FixedArray> NewUninitializedFixedArray(
150  int length, PretenureFlag pretenure = NOT_TENURED);
151 
152  // Allocates a feedback vector whose slots are initialized with undefined
153  // values.
154  Handle<FeedbackVector> NewFeedbackVector(
155  Handle<SharedFunctionInfo> shared, PretenureFlag pretenure = NOT_TENURED);
156 
157  // Allocates a clean embedder data array with given capacity.
158  Handle<EmbedderDataArray> NewEmbedderDataArray(
159  int length, PretenureFlag pretenure = NOT_TENURED);
160 
161  // Allocates a fixed array for name-value pairs of boilerplate properties and
162  // calculates the number of properties we need to store in the backing store.
163  Handle<ObjectBoilerplateDescription> NewObjectBoilerplateDescription(
164  int boilerplate, int all_properties, int index_keys, bool has_seen_proto);
165 
166  // Allocate a new uninitialized fixed double array.
167  // The function returns a pre-allocated empty fixed array for length = 0,
168  // so the return type must be the general fixed array class.
169  Handle<FixedArrayBase> NewFixedDoubleArray(
170  int length, PretenureFlag pretenure = NOT_TENURED);
171 
172  // Allocate a new fixed double array with hole values.
173  Handle<FixedArrayBase> NewFixedDoubleArrayWithHoles(
174  int size, PretenureFlag pretenure = NOT_TENURED);
175 
176  // Allocates a FeedbackMedata object and zeroes the data section.
177  Handle<FeedbackMetadata> NewFeedbackMetadata(int slot_count,
178  PretenureFlag tenure = TENURED);
179 
180  Handle<FrameArray> NewFrameArray(int number_of_frames,
181  PretenureFlag pretenure = NOT_TENURED);
182 
183  Handle<OrderedHashSet> NewOrderedHashSet();
184  Handle<OrderedHashMap> NewOrderedHashMap();
185  Handle<OrderedNameDictionary> NewOrderedNameDictionary();
186 
187  Handle<SmallOrderedHashSet> NewSmallOrderedHashSet(
188  int capacity = SmallOrderedHashSet::kMinCapacity,
189  PretenureFlag pretenure = NOT_TENURED);
190  Handle<SmallOrderedHashMap> NewSmallOrderedHashMap(
191  int capacity = SmallOrderedHashMap::kMinCapacity,
192  PretenureFlag pretenure = NOT_TENURED);
193  Handle<SmallOrderedNameDictionary> NewSmallOrderedNameDictionary(
194  int capacity = SmallOrderedHashMap::kMinCapacity,
195  PretenureFlag pretenure = NOT_TENURED);
196 
197  // Create a new PrototypeInfo struct.
198  Handle<PrototypeInfo> NewPrototypeInfo();
199 
200  // Create a new EnumCache struct.
201  Handle<EnumCache> NewEnumCache(Handle<FixedArray> keys,
202  Handle<FixedArray> indices);
203 
204  // Create a new Tuple2 struct.
205  Handle<Tuple2> NewTuple2(Handle<Object> value1, Handle<Object> value2,
206  PretenureFlag pretenure);
207 
208  // Create a new Tuple3 struct.
209  Handle<Tuple3> NewTuple3(Handle<Object> value1, Handle<Object> value2,
210  Handle<Object> value3, PretenureFlag pretenure);
211 
212  // Create a new ArrayBoilerplateDescription struct.
213  Handle<ArrayBoilerplateDescription> NewArrayBoilerplateDescription(
214  ElementsKind elements_kind, Handle<FixedArrayBase> constant_values);
215 
216  // Create a new TemplateObjectDescription struct.
217  Handle<TemplateObjectDescription> NewTemplateObjectDescription(
218  Handle<FixedArray> raw_strings, Handle<FixedArray> cooked_strings);
219 
220  // Create a pre-tenured empty AccessorPair.
221  Handle<AccessorPair> NewAccessorPair();
222 
223  // Finds the internalized copy for string in the string table.
224  // If not found, a new string is added to the table and returned.
225  Handle<String> InternalizeUtf8String(Vector<const char> str);
226  Handle<String> InternalizeUtf8String(const char* str) {
227  return InternalizeUtf8String(CStrVector(str));
228  }
229 
230  Handle<String> InternalizeOneByteString(Vector<const uint8_t> str);
231  Handle<String> InternalizeOneByteString(Handle<SeqOneByteString>, int from,
232  int length);
233 
234  Handle<String> InternalizeTwoByteString(Vector<const uc16> str);
235 
236  template <class StringTableKey>
237  Handle<String> InternalizeStringWithKey(StringTableKey* key);
238 
239  // Internalized strings are created in the old generation (data space).
240  inline Handle<String> InternalizeString(Handle<String> string);
241 
242  inline Handle<Name> InternalizeName(Handle<Name> name);
243 
244  // String creation functions. Most of the string creation functions take
245  // a Heap::PretenureFlag argument to optionally request that they be
246  // allocated in the old generation. The pretenure flag defaults to
247  // DONT_TENURE.
248  //
249  // Creates a new String object. There are two String encodings: one-byte and
250  // two-byte. One should choose between the three string factory functions
251  // based on the encoding of the string buffer that the string is
252  // initialized from.
253  // - ...FromOneByte initializes the string from a buffer that is Latin1
254  // encoded (it does not check that the buffer is Latin1 encoded) and
255  // the result will be Latin1 encoded.
256  // - ...FromUtf8 initializes the string from a buffer that is UTF-8
257  // encoded. If the characters are all ASCII characters, the result
258  // will be Latin1 encoded, otherwise it will converted to two-byte.
259  // - ...FromTwoByte initializes the string from a buffer that is two-byte
260  // encoded. If the characters are all Latin1 characters, the result
261  // will be converted to Latin1, otherwise it will be left as two-byte.
262  //
263  // One-byte strings are pretenured when used as keys in the SourceCodeCache.
264  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewStringFromOneByte(
265  Vector<const uint8_t> str, PretenureFlag pretenure = NOT_TENURED);
266 
267  template <size_t N>
268  inline Handle<String> NewStringFromStaticChars(
269  const char (&str)[N], PretenureFlag pretenure = NOT_TENURED) {
270  DCHECK(N == StrLength(str) + 1);
271  return NewStringFromOneByte(STATIC_CHAR_VECTOR(str), pretenure)
272  .ToHandleChecked();
273  }
274 
275  inline Handle<String> NewStringFromAsciiChecked(
276  const char* str, PretenureFlag pretenure = NOT_TENURED) {
277  return NewStringFromOneByte(OneByteVector(str), pretenure)
278  .ToHandleChecked();
279  }
280 
281  // UTF8 strings are pretenured when used for regexp literal patterns and
282  // flags in the parser.
283  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewStringFromUtf8(
284  Vector<const char> str, PretenureFlag pretenure = NOT_TENURED);
285 
286  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewStringFromUtf8SubString(
287  Handle<SeqOneByteString> str, int begin, int end,
288  PretenureFlag pretenure = NOT_TENURED);
289 
290  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewStringFromTwoByte(
291  Vector<const uc16> str, PretenureFlag pretenure = NOT_TENURED);
292 
293  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewStringFromTwoByte(
294  const ZoneVector<uc16>* str, PretenureFlag pretenure = NOT_TENURED);
295 
296  Handle<JSStringIterator> NewJSStringIterator(Handle<String> string);
297 
298  // Allocates an internalized string in old space based on the character
299  // stream.
300  Handle<String> NewInternalizedStringFromUtf8(Vector<const char> str,
301  int chars, uint32_t hash_field);
302 
303  Handle<String> NewOneByteInternalizedString(Vector<const uint8_t> str,
304  uint32_t hash_field);
305 
306  Handle<String> NewOneByteInternalizedSubString(
307  Handle<SeqOneByteString> string, int offset, int length,
308  uint32_t hash_field);
309 
310  Handle<String> NewTwoByteInternalizedString(Vector<const uc16> str,
311  uint32_t hash_field);
312 
313  Handle<String> NewInternalizedStringImpl(Handle<String> string, int chars,
314  uint32_t hash_field);
315 
316  // Compute the matching internalized string map for a string if possible.
317  // Empty handle is returned if string is in new space or not flattened.
318  V8_WARN_UNUSED_RESULT MaybeHandle<Map> InternalizedStringMapForString(
319  Handle<String> string);
320 
321  // Creates an internalized copy of an external string. |string| must be
322  // of type StringClass.
323  template <class StringClass>
324  Handle<StringClass> InternalizeExternalString(Handle<String> string);
325 
326  // Allocates and partially initializes an one-byte or two-byte String. The
327  // characters of the string are uninitialized. Currently used in regexp code
328  // only, where they are pretenured.
329  V8_WARN_UNUSED_RESULT MaybeHandle<SeqOneByteString> NewRawOneByteString(
330  int length, PretenureFlag pretenure = NOT_TENURED);
331  V8_WARN_UNUSED_RESULT MaybeHandle<SeqTwoByteString> NewRawTwoByteString(
332  int length, PretenureFlag pretenure = NOT_TENURED);
333 
334  // Creates a single character string where the character has given code.
335  // A cache is used for Latin1 codes.
336  Handle<String> LookupSingleCharacterStringFromCode(uint32_t code);
337 
338  // Create a new cons string object which consists of a pair of strings.
339  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewConsString(Handle<String> left,
340  Handle<String> right);
341 
342  V8_WARN_UNUSED_RESULT Handle<String> NewConsString(Handle<String> left,
343  Handle<String> right,
344  int length, bool one_byte);
345 
346  // Create or lookup a single characters tring made up of a utf16 surrogate
347  // pair.
348  Handle<String> NewSurrogatePairString(uint16_t lead, uint16_t trail);
349 
350  // Create a new string object which holds a proper substring of a string.
351  Handle<String> NewProperSubString(Handle<String> str, int begin, int end);
352 
353  // Create a new string object which holds a substring of a string.
354  inline Handle<String> NewSubString(Handle<String> str, int begin, int end);
355 
356  // Creates a new external String object. There are two String encodings
357  // in the system: one-byte and two-byte. Unlike other String types, it does
358  // not make sense to have a UTF-8 factory function for external strings,
359  // because we cannot change the underlying buffer. Note that these strings
360  // are backed by a string resource that resides outside the V8 heap.
361  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewExternalStringFromOneByte(
362  const ExternalOneByteString::Resource* resource);
363  V8_WARN_UNUSED_RESULT MaybeHandle<String> NewExternalStringFromTwoByte(
364  const ExternalTwoByteString::Resource* resource);
365  // Create a new external string object for one-byte encoded native script.
366  // It does not cache the resource data pointer.
367  Handle<ExternalOneByteString> NewNativeSourceString(
368  const ExternalOneByteString::Resource* resource);
369 
370  // Create a symbol in old or read-only space.
371  Handle<Symbol> NewSymbol(PretenureFlag pretenure = TENURED);
372  Handle<Symbol> NewPrivateSymbol(PretenureFlag pretenure = TENURED);
373  Handle<Symbol> NewPrivateNameSymbol();
374 
375  // Create a global (but otherwise uninitialized) context.
376  Handle<NativeContext> NewNativeContext();
377 
378  // Create a script context.
379  Handle<Context> NewScriptContext(Handle<NativeContext> outer,
380  Handle<ScopeInfo> scope_info);
381 
382  // Create an empty script context table.
383  Handle<ScriptContextTable> NewScriptContextTable();
384 
385  // Create a module context.
386  Handle<Context> NewModuleContext(Handle<Module> module,
387  Handle<NativeContext> outer,
388  Handle<ScopeInfo> scope_info);
389 
390  // Create a function or eval context.
391  Handle<Context> NewFunctionContext(Handle<Context> outer,
392  Handle<ScopeInfo> scope_info);
393 
394  // Create a catch context.
395  Handle<Context> NewCatchContext(Handle<Context> previous,
396  Handle<ScopeInfo> scope_info,
397  Handle<Object> thrown_object);
398 
399  // Create a 'with' context.
400  Handle<Context> NewWithContext(Handle<Context> previous,
401  Handle<ScopeInfo> scope_info,
402  Handle<JSReceiver> extension);
403 
404  Handle<Context> NewDebugEvaluateContext(Handle<Context> previous,
405  Handle<ScopeInfo> scope_info,
406  Handle<JSReceiver> extension,
407  Handle<Context> wrapped,
408  Handle<StringSet> whitelist);
409 
410  // Create a block context.
411  Handle<Context> NewBlockContext(Handle<Context> previous,
412  Handle<ScopeInfo> scope_info);
413 
414  // Create a context that's used by builtin functions.
415  //
416  // These are similar to function context but don't have a previous
417  // context or any scope info. These are used to store spec defined
418  // context values.
419  Handle<Context> NewBuiltinContext(Handle<NativeContext> native_context,
420  int length);
421 
422  Handle<Struct> NewStruct(InstanceType type,
423  PretenureFlag pretenure = NOT_TENURED);
424 
425  Handle<AliasedArgumentsEntry> NewAliasedArgumentsEntry(
426  int aliased_context_slot);
427 
428  Handle<AccessorInfo> NewAccessorInfo();
429 
430  Handle<Script> NewScript(Handle<String> source,
431  PretenureFlag tenure = TENURED);
432  Handle<Script> NewScriptWithId(Handle<String> source, int script_id,
433  PretenureFlag tenure = TENURED);
434  Handle<Script> CloneScript(Handle<Script> script);
435 
436  Handle<BreakPointInfo> NewBreakPointInfo(int source_position);
437  Handle<BreakPoint> NewBreakPoint(int id, Handle<String> condition);
438  Handle<StackFrameInfo> NewStackFrameInfo();
440  NewSourcePositionTableWithFrameCache(
441  Handle<ByteArray> source_position_table,
442  Handle<SimpleNumberDictionary> stack_frame_cache);
443 
444  // Allocate various microtasks.
445  Handle<CallableTask> NewCallableTask(Handle<JSReceiver> callable,
446  Handle<Context> context);
447  Handle<CallbackTask> NewCallbackTask(Handle<Foreign> callback,
448  Handle<Foreign> data);
449  Handle<PromiseResolveThenableJobTask> NewPromiseResolveThenableJobTask(
450  Handle<JSPromise> promise_to_resolve, Handle<JSReceiver> then,
451  Handle<JSReceiver> thenable, Handle<Context> context);
452  Handle<WeakFactoryCleanupJobTask> NewWeakFactoryCleanupJobTask(
453  Handle<JSWeakFactory> weak_factory);
454 
455  // Foreign objects are pretenured when allocated by the bootstrapper.
456  Handle<Foreign> NewForeign(Address addr,
457  PretenureFlag pretenure = NOT_TENURED);
458 
459  Handle<ByteArray> NewByteArray(int length,
460  PretenureFlag pretenure = NOT_TENURED);
461 
462  Handle<BytecodeArray> NewBytecodeArray(int length, const byte* raw_bytecodes,
463  int frame_size, int parameter_count,
464  Handle<FixedArray> constant_pool);
465 
466  Handle<FixedTypedArrayBase> NewFixedTypedArrayWithExternalPointer(
467  int length, ExternalArrayType array_type, void* external_pointer,
468  PretenureFlag pretenure = NOT_TENURED);
469 
470  Handle<FixedTypedArrayBase> NewFixedTypedArray(
471  size_t length, size_t byte_length, ExternalArrayType array_type,
472  bool initialize, PretenureFlag pretenure = NOT_TENURED);
473 
474  Handle<Cell> NewCell(Handle<Object> value);
475 
476  Handle<PropertyCell> NewPropertyCell(Handle<Name> name,
477  PretenureFlag pretenure = TENURED);
478 
479  Handle<FeedbackCell> NewNoClosuresCell(Handle<HeapObject> value);
480  Handle<FeedbackCell> NewOneClosureCell(Handle<HeapObject> value);
481  Handle<FeedbackCell> NewManyClosuresCell(Handle<HeapObject> value);
482  Handle<FeedbackCell> NewNoFeedbackCell();
483 
484  Handle<DescriptorArray> NewDescriptorArray(int number_of_entries,
485  int slack = 0);
486  Handle<TransitionArray> NewTransitionArray(int number_of_transitions,
487  int slack = 0);
488 
489  // Allocate a tenured AllocationSite. Its payload is null.
490  Handle<AllocationSite> NewAllocationSite(bool with_weak_next);
491 
492  // Allocates and initializes a new Map.
493  Handle<Map> NewMap(InstanceType type, int instance_size,
494  ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
495  int inobject_properties = 0);
496  // Initializes the fields of a newly created Map. Exposed for tests and
497  // heap setup; other code should just call NewMap which takes care of it.
498  Map InitializeMap(Map map, InstanceType type, int instance_size,
499  ElementsKind elements_kind, int inobject_properties);
500 
501  // Allocate a block of memory in the given space (filled with a filler).
502  // Used as a fall-back for generated code when the space is full.
503  Handle<HeapObject> NewFillerObject(int size, bool double_align,
504  AllocationSpace space);
505 
506  Handle<JSObject> NewFunctionPrototype(Handle<JSFunction> function);
507 
508  // Returns a deep copy of the JavaScript object.
509  // Properties and elements are copied too.
510  Handle<JSObject> CopyJSObject(Handle<JSObject> object);
511  // Same as above, but also takes an AllocationSite to be appended in an
512  // AllocationMemento.
513  Handle<JSObject> CopyJSObjectWithAllocationSite(Handle<JSObject> object,
515 
516  Handle<FixedArray> CopyFixedArrayWithMap(Handle<FixedArray> array,
517  Handle<Map> map);
518 
519  Handle<FixedArray> CopyFixedArrayAndGrow(
520  Handle<FixedArray> array, int grow_by,
521  PretenureFlag pretenure = NOT_TENURED);
522 
523  Handle<WeakFixedArray> CopyWeakFixedArrayAndGrow(
524  Handle<WeakFixedArray> array, int grow_by,
525  PretenureFlag pretenure = NOT_TENURED);
526 
527  Handle<WeakArrayList> CopyWeakArrayListAndGrow(
528  Handle<WeakArrayList> array, int grow_by,
529  PretenureFlag pretenure = NOT_TENURED);
530 
531  Handle<PropertyArray> CopyPropertyArrayAndGrow(
532  Handle<PropertyArray> array, int grow_by,
533  PretenureFlag pretenure = NOT_TENURED);
534 
535  Handle<FixedArray> CopyFixedArrayUpTo(Handle<FixedArray> array, int new_len,
536  PretenureFlag pretenure = NOT_TENURED);
537 
538  Handle<FixedArray> CopyFixedArray(Handle<FixedArray> array);
539 
540  // This method expects a COW array in new space, and creates a copy
541  // of it in old space.
542  Handle<FixedArray> CopyAndTenureFixedCOWArray(Handle<FixedArray> array);
543 
544  Handle<FixedDoubleArray> CopyFixedDoubleArray(Handle<FixedDoubleArray> array);
545 
546  Handle<FeedbackVector> CopyFeedbackVector(Handle<FeedbackVector> array);
547 
548  // Numbers (e.g. literals) are pretenured by the parser.
549  // The return value may be a smi or a heap number.
550  Handle<Object> NewNumber(double value, PretenureFlag pretenure = NOT_TENURED);
551 
552  Handle<Object> NewNumberFromInt(int32_t value,
553  PretenureFlag pretenure = NOT_TENURED);
554  Handle<Object> NewNumberFromUint(uint32_t value,
555  PretenureFlag pretenure = NOT_TENURED);
556  inline Handle<Object> NewNumberFromSize(
557  size_t value, PretenureFlag pretenure = NOT_TENURED);
558  inline Handle<Object> NewNumberFromInt64(
559  int64_t value, PretenureFlag pretenure = NOT_TENURED);
560  inline Handle<HeapNumber> NewHeapNumber(
561  double value, PretenureFlag pretenure = NOT_TENURED);
562  inline Handle<HeapNumber> NewHeapNumberFromBits(
563  uint64_t bits, PretenureFlag pretenure = NOT_TENURED);
564 
565  // Creates heap number object with not yet set value field.
566  Handle<HeapNumber> NewHeapNumber(PretenureFlag pretenure = NOT_TENURED);
567 
568  Handle<MutableHeapNumber> NewMutableHeapNumber(
569  PretenureFlag pretenure = NOT_TENURED);
570  inline Handle<MutableHeapNumber> NewMutableHeapNumber(
571  double value, PretenureFlag pretenure = NOT_TENURED);
572  inline Handle<MutableHeapNumber> NewMutableHeapNumberFromBits(
573  uint64_t bits, PretenureFlag pretenure = NOT_TENURED);
574  inline Handle<MutableHeapNumber> NewMutableHeapNumberWithHoleNaN(
575  PretenureFlag pretenure = NOT_TENURED);
576 
577  // Allocates a new BigInt with {length} digits. Only to be used by
578  // MutableBigInt::New*.
580  int length, PretenureFlag pretenure = NOT_TENURED);
581 
582  Handle<JSObject> NewArgumentsObject(Handle<JSFunction> callee, int length);
583 
584  // Allocates and initializes a new JavaScript object based on a
585  // constructor.
586  // JS objects are pretenured when allocated by the bootstrapper and
587  // runtime.
588  Handle<JSObject> NewJSObject(Handle<JSFunction> constructor,
589  PretenureFlag pretenure = NOT_TENURED);
590  // JSObject without a prototype.
591  Handle<JSObject> NewJSObjectWithNullProto(
592  PretenureFlag pretenure = NOT_TENURED);
593 
594  // Global objects are pretenured and initialized based on a constructor.
595  Handle<JSGlobalObject> NewJSGlobalObject(Handle<JSFunction> constructor);
596 
597  // Allocates and initializes a new JavaScript object based on a map.
598  // Passing an allocation site means that a memento will be created that
599  // points to the site.
600  // JS objects are pretenured when allocated by the bootstrapper and
601  // runtime.
602  Handle<JSObject> NewJSObjectFromMap(
603  Handle<Map> map, PretenureFlag pretenure = NOT_TENURED,
605  Handle<JSObject> NewSlowJSObjectFromMap(
606  Handle<Map> map,
607  int number_of_slow_properties = NameDictionary::kInitialCapacity,
608  PretenureFlag pretenure = NOT_TENURED);
609  // Allocates and initializes a new JavaScript object with the given
610  // {prototype} and {properties}. The newly created object will be
611  // in dictionary properties mode. The {elements} can either be the
612  // empty fixed array, in which case the resulting object will have
613  // fast elements, or a NumberDictionary, in which case the resulting
614  // object will have dictionary elements.
615  Handle<JSObject> NewSlowJSObjectWithPropertiesAndElements(
616  Handle<Object> prototype, Handle<NameDictionary> properties,
617  Handle<FixedArrayBase> elements, PretenureFlag pretenure = NOT_TENURED);
618 
619  // JS arrays are pretenured when allocated by the parser.
620 
621  // Create a JSArray with a specified length and elements initialized
622  // according to the specified mode.
623  Handle<JSArray> NewJSArray(
624  ElementsKind elements_kind, int length, int capacity,
625  ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS,
626  PretenureFlag pretenure = NOT_TENURED);
627 
628  Handle<JSArray> NewJSArray(
629  int capacity, ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
630  PretenureFlag pretenure = NOT_TENURED) {
631  if (capacity != 0) {
632  elements_kind = GetHoleyElementsKind(elements_kind);
633  }
634  return NewJSArray(elements_kind, 0, capacity,
635  INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, pretenure);
636  }
637 
638  // Create a JSArray with the given elements.
639  Handle<JSArray> NewJSArrayWithElements(Handle<FixedArrayBase> elements,
640  ElementsKind elements_kind, int length,
641  PretenureFlag pretenure = NOT_TENURED);
642 
643  inline Handle<JSArray> NewJSArrayWithElements(
644  Handle<FixedArrayBase> elements,
645  ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND,
646  PretenureFlag pretenure = NOT_TENURED);
647 
648  void NewJSArrayStorage(
649  Handle<JSArray> array, int length, int capacity,
650  ArrayStorageAllocationMode mode = DONT_INITIALIZE_ARRAY_ELEMENTS);
651 
652  Handle<JSWeakMap> NewJSWeakMap();
653 
654  Handle<JSGeneratorObject> NewJSGeneratorObject(Handle<JSFunction> function);
655 
656  Handle<JSModuleNamespace> NewJSModuleNamespace();
657 
659 
660  Handle<JSArrayBuffer> NewJSArrayBuffer(
661  SharedFlag shared = SharedFlag::kNotShared,
662  PretenureFlag pretenure = NOT_TENURED);
663 
664  static void TypeAndSizeForElementsKind(ElementsKind kind,
665  ExternalArrayType* array_type,
666  size_t* element_size);
667 
668  Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type,
669  PretenureFlag pretenure = NOT_TENURED);
670 
671  Handle<JSTypedArray> NewJSTypedArray(ElementsKind elements_kind,
672  PretenureFlag pretenure = NOT_TENURED);
673 
674  // Creates a new JSTypedArray with the specified buffer.
675  Handle<JSTypedArray> NewJSTypedArray(ExternalArrayType type,
676  Handle<JSArrayBuffer> buffer,
677  size_t byte_offset, size_t length,
678  PretenureFlag pretenure = NOT_TENURED);
679 
680  // Creates a new on-heap JSTypedArray.
681  Handle<JSTypedArray> NewJSTypedArray(ElementsKind elements_kind,
682  size_t number_of_elements,
683  PretenureFlag pretenure = NOT_TENURED);
684 
685  Handle<JSDataView> NewJSDataView(Handle<JSArrayBuffer> buffer,
686  size_t byte_offset, size_t byte_length);
687 
688  Handle<JSIteratorResult> NewJSIteratorResult(Handle<Object> value, bool done);
689  Handle<JSAsyncFromSyncIterator> NewJSAsyncFromSyncIterator(
690  Handle<JSReceiver> sync_iterator, Handle<Object> next);
691 
692  Handle<JSMap> NewJSMap();
693  Handle<JSSet> NewJSSet();
694 
695  // Allocates a bound function.
696  MaybeHandle<JSBoundFunction> NewJSBoundFunction(
697  Handle<JSReceiver> target_function, Handle<Object> bound_this,
698  Vector<Handle<Object>> bound_args);
699 
700  // Allocates a Harmony proxy.
701  Handle<JSProxy> NewJSProxy(Handle<JSReceiver> target,
702  Handle<JSReceiver> handler);
703 
704  // Reinitialize an JSGlobalProxy based on a constructor. The object
705  // must have the same size as objects allocated using the
706  // constructor. The object is reinitialized and behaves as an
707  // object that has been freshly allocated using the constructor.
708  void ReinitializeJSGlobalProxy(Handle<JSGlobalProxy> global,
709  Handle<JSFunction> constructor);
710 
711  Handle<JSGlobalProxy> NewUninitializedJSGlobalProxy(int size);
712 
713  // Creates a new JSFunction according to the given args. This is the function
714  // you'll probably want to use when creating a JSFunction from the runtime.
715  Handle<JSFunction> NewFunction(const NewFunctionArgs& args);
716 
717  // For testing only. Creates a sloppy function without code.
718  Handle<JSFunction> NewFunctionForTest(Handle<String> name);
719 
720  // Function creation from SharedFunctionInfo.
721 
722  Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
723  Handle<Map> initial_map, Handle<SharedFunctionInfo> function_info,
724  Handle<Context> context, Handle<FeedbackCell> feedback_cell,
725  PretenureFlag pretenure = TENURED);
726 
727  Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
728  Handle<SharedFunctionInfo> function_info, Handle<Context> context,
729  Handle<FeedbackCell> feedback_cell, PretenureFlag pretenure = TENURED);
730 
731  Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
732  Handle<Map> initial_map, Handle<SharedFunctionInfo> function_info,
733  Handle<Context> context, PretenureFlag pretenure = TENURED);
734 
735  Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
736  Handle<SharedFunctionInfo> function_info, Handle<Context> context,
737  PretenureFlag pretenure = TENURED);
738 
739  // The choke-point for JSFunction creation. Handles allocation and
740  // initialization. All other utility methods call into this.
741  Handle<JSFunction> NewFunction(Handle<Map> map,
743  Handle<Context> context,
744  PretenureFlag pretenure = TENURED);
745 
746  // Create a serialized scope info.
747  Handle<ScopeInfo> NewScopeInfo(int length);
748 
749  Handle<ModuleInfo> NewModuleInfo();
750 
751  Handle<PreParsedScopeData> NewPreParsedScopeData(int length);
752 
754  NewUncompiledDataWithoutPreParsedScope(Handle<String> inferred_name,
755  int32_t start_position,
756  int32_t end_position,
757  int32_t function_literal_id);
758 
759  Handle<UncompiledDataWithPreParsedScope> NewUncompiledDataWithPreParsedScope(
760  Handle<String> inferred_name, int32_t start_position,
761  int32_t end_position, int32_t function_literal_id,
763 
764  // Create an External object for V8's external API.
765  Handle<JSObject> NewExternal(void* value);
766 
767  // Creates a new CodeDataContainer for a Code object.
768  Handle<CodeDataContainer> NewCodeDataContainer(int flags);
769 
770  // Allocates a new code object (fully initialized). All header fields of the
771  // returned object are immutable and the code object is write protected.
772  // The reference to the Code object is stored in self_reference.
773  // This allows generated code to reference its own Code object
774  // by containing this handle.
775  Handle<Code> NewCode(const CodeDesc& desc, Code::Kind kind,
776  Handle<Object> self_reference,
777  int32_t builtin_index = Builtins::kNoBuiltinId,
778  MaybeHandle<ByteArray> maybe_source_position_table =
780  MaybeHandle<DeoptimizationData> maybe_deopt_data =
782  Movability movability = kMovable, uint32_t stub_key = 0,
783  bool is_turbofanned = false, int stack_slots = 0,
784  int safepoint_table_offset = 0,
785  int handler_table_offset = 0);
786 
787  // Like NewCode, this function allocates a new code object (fully
788  // initialized). It may return an empty handle if the allocation does not
789  // succeed.
790  V8_WARN_UNUSED_RESULT MaybeHandle<Code> TryNewCode(
791  const CodeDesc& desc, Code::Kind kind, Handle<Object> self_reference,
792  int32_t builtin_index = Builtins::kNoBuiltinId,
793  MaybeHandle<ByteArray> maybe_source_position_table =
795  MaybeHandle<DeoptimizationData> maybe_deopt_data =
797  Movability movability = kMovable, uint32_t stub_key = 0,
798  bool is_turbofanned = false, int stack_slots = 0,
799  int safepoint_table_offset = 0, int handler_table_offset = 0);
800 
801  // Allocates a new code object and initializes it as the trampoline to the
802  // given off-heap entry point.
803  Handle<Code> NewOffHeapTrampolineFor(Handle<Code> code,
804  Address off_heap_entry);
805 
806  Handle<Code> CopyCode(Handle<Code> code);
807 
808  Handle<BytecodeArray> CopyBytecodeArray(Handle<BytecodeArray>);
809 
810  // Interface for creating error objects.
811  Handle<Object> NewError(Handle<JSFunction> constructor,
812  Handle<String> message);
813 
814  Handle<Object> NewInvalidStringLengthError();
815 
816  inline Handle<Object> NewURIError();
817 
818  Handle<Object> NewError(Handle<JSFunction> constructor,
819  MessageTemplate template_index,
822  Handle<Object> arg2 = Handle<Object>());
823 
824 #define DECLARE_ERROR(NAME) \
825  Handle<Object> New##NAME(MessageTemplate template_index, \
826  Handle<Object> arg0 = Handle<Object>(), \
827  Handle<Object> arg1 = Handle<Object>(), \
828  Handle<Object> arg2 = Handle<Object>());
829  DECLARE_ERROR(Error)
830  DECLARE_ERROR(EvalError)
831  DECLARE_ERROR(RangeError)
832  DECLARE_ERROR(ReferenceError)
833  DECLARE_ERROR(SyntaxError)
834  DECLARE_ERROR(TypeError)
835  DECLARE_ERROR(WasmCompileError)
836  DECLARE_ERROR(WasmLinkError)
837  DECLARE_ERROR(WasmRuntimeError)
838 #undef DECLARE_ERROR
839 
840  Handle<String> NumberToString(Handle<Object> number, bool check_cache = true);
841  Handle<String> NumberToString(Smi number, bool check_cache = true);
842 
843  inline Handle<String> Uint32ToString(uint32_t value, bool check_cache = true);
844 
845 // TODO(jkummerow): Drop std::remove_pointer after the migration to ObjectPtr.
846 #define ROOT_ACCESSOR(Type, name, CamelName) \
847  inline Handle<std::remove_pointer<Type>::type> name();
848  ROOT_LIST(ROOT_ACCESSOR)
849 #undef ROOT_ACCESSOR
850 
851  // Allocates a new SharedFunctionInfo object.
852  Handle<SharedFunctionInfo> NewSharedFunctionInfoForApiFunction(
853  MaybeHandle<String> maybe_name,
854  Handle<FunctionTemplateInfo> function_template_info, FunctionKind kind);
855 
856  Handle<SharedFunctionInfo> NewSharedFunctionInfoForBuiltin(
857  MaybeHandle<String> name, int builtin_index,
858  FunctionKind kind = kNormalFunction);
859 
860  Handle<SharedFunctionInfo> NewSharedFunctionInfoForLiteral(
861  FunctionLiteral* literal, Handle<Script> script, bool is_toplevel);
862 
863  static bool IsFunctionModeWithPrototype(FunctionMode function_mode) {
864  return (function_mode & kWithPrototypeBits) != 0;
865  }
866 
867  static bool IsFunctionModeWithWritablePrototype(FunctionMode function_mode) {
868  return (function_mode & kWithWritablePrototypeBit) != 0;
869  }
870 
871  static bool IsFunctionModeWithName(FunctionMode function_mode) {
872  return (function_mode & kWithNameBit) != 0;
873  }
874 
875  static bool IsFunctionModeWithHomeObject(FunctionMode function_mode) {
876  return (function_mode & kWithHomeObjectBit) != 0;
877  }
878 
879  Handle<Map> CreateSloppyFunctionMap(
880  FunctionMode function_mode, MaybeHandle<JSFunction> maybe_empty_function);
881 
882  Handle<Map> CreateStrictFunctionMap(FunctionMode function_mode,
883  Handle<JSFunction> empty_function);
884 
885  Handle<Map> CreateClassFunctionMap(Handle<JSFunction> empty_function);
886 
887  // Allocates a new JSMessageObject object.
888  Handle<JSMessageObject> NewJSMessageObject(
889  MessageTemplate message, Handle<Object> argument, int start_position,
890  int end_position, Handle<Script> script, Handle<Object> stack_frames);
891 
892  Handle<DebugInfo> NewDebugInfo(Handle<SharedFunctionInfo> shared);
893 
894  Handle<CoverageInfo> NewCoverageInfo(const ZoneVector<SourceRange>& slots);
895 
896  // Return a map for given number of properties using the map cache in the
897  // native context.
898  Handle<Map> ObjectLiteralMapFromCache(Handle<NativeContext> native_context,
899  int number_of_properties);
900 
901  Handle<LoadHandler> NewLoadHandler(int data_count);
902  Handle<StoreHandler> NewStoreHandler(int data_count);
903 
904  Handle<RegExpMatchInfo> NewRegExpMatchInfo();
905 
906  // Creates a new FixedArray that holds the data associated with the
907  // atom regexp and stores it in the regexp.
908  void SetRegExpAtomData(Handle<JSRegExp> regexp, JSRegExp::Type type,
909  Handle<String> source, JSRegExp::Flags flags,
910  Handle<Object> match_pattern);
911 
912  // Creates a new FixedArray that holds the data associated with the
913  // irregexp regexp and stores it in the regexp.
914  void SetRegExpIrregexpData(Handle<JSRegExp> regexp, JSRegExp::Type type,
915  Handle<String> source, JSRegExp::Flags flags,
916  int capture_count);
917 
918  // Returns the value for a known global constant (a property of the global
919  // object which is neither configurable nor writable) like 'undefined'.
920  // Returns a null handle when the given name is unknown.
921  Handle<Object> GlobalConstantFor(Handle<Name> name);
922 
923  // Converts the given boolean condition to JavaScript boolean value.
924  Handle<Object> ToBoolean(bool value);
925 
926  // Converts the given ToPrimitive hint to it's string representation.
927  Handle<String> ToPrimitiveHintString(ToPrimitiveHint hint);
928 
929  Handle<JSPromise> NewJSPromiseWithoutHook(
930  PretenureFlag pretenure = NOT_TENURED);
931  Handle<JSPromise> NewJSPromise(PretenureFlag pretenure = NOT_TENURED);
932 
933  Handle<CallHandlerInfo> NewCallHandlerInfo(bool has_no_side_effect = false);
934 
935  HeapObject* NewForTest(Handle<Map> map, PretenureFlag pretenure) {
936  return New(map, pretenure);
937  }
938 
939  private:
940  Isolate* isolate() {
941  // Downcast to the privately inherited sub-class using c-style casts to
942  // avoid undefined behavior (as static_cast cannot cast across private
943  // bases).
944  // NOLINTNEXTLINE (google-readability-casting)
945  return (Isolate*)this; // NOLINT(readability/casting)
946  }
947 
948  HeapObject* AllocateRawWithImmortalMap(
949  int size, PretenureFlag pretenure, Map map,
950  AllocationAlignment alignment = kWordAligned);
951  HeapObject* AllocateRawWithAllocationSite(
952  Handle<Map> map, PretenureFlag pretenure,
953  Handle<AllocationSite> allocation_site);
954 
955  // Allocate memory for an uninitialized array (e.g., a FixedArray or similar).
956  HeapObject* AllocateRawArray(int size, PretenureFlag pretenure);
957  HeapObject* AllocateRawFixedArray(int length, PretenureFlag pretenure);
958  HeapObject* AllocateRawWeakArrayList(int length, PretenureFlag pretenure);
959  Handle<FixedArray> NewFixedArrayWithFiller(RootIndex map_root_index,
960  int length, Object* filler,
961  PretenureFlag pretenure);
962 
963  // Allocates new context with given map, sets length and initializes the
964  // after-header part with uninitialized values and leaves the context header
965  // uninitialized.
966  Handle<Context> NewContext(RootIndex map_root_index, int size,
967  int variadic_part_length, PretenureFlag pretenure);
968 
969  template <typename T>
970  Handle<T> AllocateSmallOrderedHashTable(Handle<Map> map, int capacity,
971  PretenureFlag pretenure);
972 
973  // Creates a heap object based on the map. The fields of the heap object are
974  // not initialized, it's the responsibility of the caller to do that.
975  HeapObject* New(Handle<Map> map, PretenureFlag pretenure);
976 
977  template <typename T>
978  Handle<T> CopyArrayWithMap(Handle<T> src, Handle<Map> map);
979  template <typename T>
980  Handle<T> CopyArrayAndGrow(Handle<T> src, int grow_by,
981  PretenureFlag pretenure);
982 
983  template <bool is_one_byte, typename T>
984  Handle<String> AllocateInternalizedStringImpl(T t, int chars,
985  uint32_t hash_field);
986 
987  Handle<SeqOneByteString> AllocateRawOneByteInternalizedString(
988  int length, uint32_t hash_field);
989 
990  Handle<String> AllocateTwoByteInternalizedString(Vector<const uc16> str,
991  uint32_t hash_field);
992 
993  MaybeHandle<String> NewStringFromTwoByte(const uc16* string, int length,
994  PretenureFlag pretenure);
995 
996  // Attempt to find the number in a small cache. If we finds it, return
997  // the string representation of the number. Otherwise return undefined.
998  Handle<Object> NumberToStringCacheGet(Object* number, int hash);
999 
1000  // Update the cache with a new number-string pair.
1001  Handle<String> NumberToStringCacheSet(Handle<Object> number, int hash,
1002  const char* string, bool check_cache);
1003 
1004  // Create a JSArray with no elements and no length.
1005  Handle<JSArray> NewJSArray(ElementsKind elements_kind,
1006  PretenureFlag pretenure = NOT_TENURED);
1007 
1008  Handle<SharedFunctionInfo> NewSharedFunctionInfo(
1009  MaybeHandle<String> name, MaybeHandle<HeapObject> maybe_function_data,
1010  int maybe_builtin_index, FunctionKind kind = kNormalFunction);
1011 
1012  void InitializeAllocationMemento(AllocationMemento* memento,
1013  AllocationSite* allocation_site);
1014 
1015  // Initializes a JSObject based on its map.
1016  void InitializeJSObjectFromMap(Handle<JSObject> obj,
1017  Handle<Object> properties, Handle<Map> map);
1018  // Initializes JSObject body starting at given offset.
1019  void InitializeJSObjectBody(Handle<JSObject> obj, Handle<Map> map,
1020  int start_offset);
1021 };
1022 
1023 // Utility class to simplify argument handling around JSFunction creation.
1024 class NewFunctionArgs final {
1025  public:
1026  static NewFunctionArgs ForWasm(
1027  Handle<String> name,
1028  Handle<WasmExportedFunctionData> exported_function_data, Handle<Map> map);
1029  static NewFunctionArgs ForBuiltin(Handle<String> name, Handle<Map> map,
1030  int builtin_id);
1031  static NewFunctionArgs ForFunctionWithoutCode(Handle<String> name,
1032  Handle<Map> map,
1033  LanguageMode language_mode);
1034  static NewFunctionArgs ForBuiltinWithPrototype(
1035  Handle<String> name, Handle<Object> prototype, InstanceType type,
1036  int instance_size, int inobject_properties, int builtin_id,
1037  MutableMode prototype_mutability);
1038  static NewFunctionArgs ForBuiltinWithoutPrototype(Handle<String> name,
1039  int builtin_id,
1040  LanguageMode language_mode);
1041 
1042  Handle<Map> GetMap(Isolate* isolate) const;
1043 
1044  private:
1045  NewFunctionArgs() = default; // Use the static factory constructors.
1046 
1047  void SetShouldCreateAndSetInitialMap();
1048  void SetShouldSetPrototype();
1049  void SetShouldSetLanguageMode();
1050 
1051  // Sentinel value.
1052  static const int kUninitialized = -1;
1053 
1054  Handle<String> name_;
1055  MaybeHandle<Map> maybe_map_;
1056  MaybeHandle<WasmExportedFunctionData> maybe_exported_function_data_;
1057 
1058  bool should_create_and_set_initial_map_ = false;
1059  InstanceType type_;
1060  int instance_size_ = kUninitialized;
1061  int inobject_properties_ = kUninitialized;
1062 
1063  bool should_set_prototype_ = false;
1064  MaybeHandle<Object> maybe_prototype_;
1065 
1066  bool should_set_language_mode_ = false;
1067  LanguageMode language_mode_;
1068 
1069  int maybe_builtin_id_ = kUninitialized;
1070 
1071  MutableMode prototype_mutability_;
1072 
1073  friend class Factory;
1074 };
1075 
1076 } // namespace internal
1077 } // namespace v8
1078 
1079 #endif // V8_HEAP_FACTORY_H_
Definition: libplatform.h:13