V8 Project
factory.h
Go to the documentation of this file.
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_FACTORY_H_
6 #define V8_FACTORY_H_
7 
8 #include "src/isolate.h"
9 
10 namespace v8 {
11 namespace internal {
12 
13 // Interface for handle based allocation.
14 
15 class Factory FINAL {
16  public:
18  const char* to_string,
19  Handle<Object> to_number,
20  byte kind);
21 
22  // Allocates a fixed array initialized with undefined values.
24  int size,
25  PretenureFlag pretenure = NOT_TENURED);
26 
27  // Allocate a new fixed array with non-existing entries (the hole).
29  int size,
30  PretenureFlag pretenure = NOT_TENURED);
31 
32  // Allocates an uninitialized fixed array. It must be filled by the caller.
34 
35  // Allocate a new uninitialized fixed double array.
36  // The function returns a pre-allocated empty fixed array for capacity = 0,
37  // so the return type must be the general fixed array class.
39  int size,
40  PretenureFlag pretenure = NOT_TENURED);
41 
42  // Allocate a new fixed double array with hole values.
44  int size,
45  PretenureFlag pretenure = NOT_TENURED);
46 
48  const ConstantPoolArray::NumberOfEntries& small);
49 
51  const ConstantPoolArray::NumberOfEntries& small,
52  const ConstantPoolArray::NumberOfEntries& extended);
53 
56 
57  // Create a new boxed value.
59 
60  // Create a pre-tenured empty AccessorPair.
62 
63  // Create an empty TypeFeedbackInfo.
65 
66  // Finds the internalized copy for string in the string table.
67  // If not found, a new string is added to the table and returned.
70  return InternalizeUtf8String(CStrVector(str));
71  }
75  Handle<SeqOneByteString>, int from, int length);
76 
78 
79  template<class StringTableKey>
81 
82 
83  // String creation functions. Most of the string creation functions take
84  // a Heap::PretenureFlag argument to optionally request that they be
85  // allocated in the old generation. The pretenure flag defaults to
86  // DONT_TENURE.
87  //
88  // Creates a new String object. There are two String encodings: one-byte and
89  // two-byte. One should choose between the three string factory functions
90  // based on the encoding of the string buffer that the string is
91  // initialized from.
92  // - ...FromOneByte initializes the string from a buffer that is Latin1
93  // encoded (it does not check that the buffer is Latin1 encoded) and
94  // the result will be Latin1 encoded.
95  // - ...FromUtf8 initializes the string from a buffer that is UTF-8
96  // encoded. If the characters are all ASCII characters, the result
97  // will be Latin1 encoded, otherwise it will converted to two-byte.
98  // - ...FromTwoByte initializes the string from a buffer that is two-byte
99  // encoded. If the characters are all Latin1 characters, the result
100  // will be converted to Latin1, otherwise it will be left as two-byte.
101  //
102  // One-byte strings are pretenured when used as keys in the SourceCodeCache.
105  PretenureFlag pretenure = NOT_TENURED);
106 
107  template <size_t N>
109  const char (&str)[N], PretenureFlag pretenure = NOT_TENURED) {
110  DCHECK(N == StrLength(str) + 1);
111  return NewStringFromOneByte(STATIC_CHAR_VECTOR(str), pretenure)
112  .ToHandleChecked();
113  }
114 
116  const char* str,
117  PretenureFlag pretenure = NOT_TENURED) {
118  return NewStringFromOneByte(
119  OneByteVector(str), pretenure).ToHandleChecked();
120  }
121 
122 
123  // Allocates and fully initializes a String. There are two String encodings:
124  // one-byte and two-byte. One should choose between the threestring
125  // allocation functions based on the encoding of the string buffer used to
126  // initialized the string.
127  // - ...FromOneByte initializes the string from a buffer that is Latin1
128  // encoded (it does not check that the buffer is Latin1 encoded) and the
129  // result will be Latin1 encoded.
130  // - ...FromUTF8 initializes the string from a buffer that is UTF-8
131  // encoded. If the characters are all ASCII characters, the result
132  // will be Latin1 encoded, otherwise it will converted to two-byte.
133  // - ...FromTwoByte initializes the string from a buffer that is two-byte
134  // encoded. If the characters are all Latin1 characters, the
135  // result will be converted to Latin1, otherwise it will be left as
136  // two-byte.
137 
138  // TODO(dcarney): remove this function.
140  Vector<const char> str,
141  PretenureFlag pretenure = NOT_TENURED) {
142  return NewStringFromOneByte(Vector<const uint8_t>::cast(str), pretenure);
143  }
144 
145  // UTF8 strings are pretenured when used for regexp literal patterns and
146  // flags in the parser.
148  Vector<const char> str,
149  PretenureFlag pretenure = NOT_TENURED);
150 
152  Vector<const uc16> str,
153  PretenureFlag pretenure = NOT_TENURED);
154 
155  // Allocates an internalized string in old space based on the character
156  // stream.
158  Vector<const char> str,
159  int chars,
160  uint32_t hash_field);
161 
163  Vector<const uint8_t> str, uint32_t hash_field);
164 
166  Handle<SeqOneByteString> string, int offset, int length,
167  uint32_t hash_field);
168 
170  Vector<const uc16> str,
171  uint32_t hash_field);
172 
174  Handle<String> string, int chars, uint32_t hash_field);
175 
176  // Compute the matching internalized string map for a string if possible.
177  // Empty handle is returned if string is in new space or not flattened.
179  Handle<String> string);
180 
181  // Allocates and partially initializes an one-byte or two-byte String. The
182  // characters of the string are uninitialized. Currently used in regexp code
183  // only, where they are pretenured.
185  int length,
186  PretenureFlag pretenure = NOT_TENURED);
188  int length,
189  PretenureFlag pretenure = NOT_TENURED);
190 
191  // Creates a single character string where the character has given code.
192  // A cache is used for Latin1 codes.
194 
195  // Create a new cons string object which consists of a pair of strings.
197  Handle<String> right);
198 
199  // Create a new string object which holds a proper substring of a string.
201  int begin,
202  int end);
203 
204  // Create a new string object which holds a substring of a string.
205  Handle<String> NewSubString(Handle<String> str, int begin, int end) {
206  if (begin == 0 && end == str->length()) return str;
207  return NewProperSubString(str, begin, end);
208  }
209 
210  // Creates a new external String object. There are two String encodings
211  // in the system: one-byte and two-byte. Unlike other String types, it does
212  // not make sense to have a UTF-8 factory function for external strings,
213  // because we cannot change the underlying buffer. Note that these strings
214  // are backed by a string resource that resides outside the V8 heap.
216  const ExternalOneByteString::Resource* resource);
218  const ExternalTwoByteString::Resource* resource);
219 
220  // Create a symbol.
224 
225  // Create a global (but otherwise uninitialized) context.
227 
228  // Create a global context.
230  Handle<ScopeInfo> scope_info);
231 
232  // Create a module context.
234 
235  // Create a function context.
237 
238  // Create a catch context.
240  Handle<Context> previous,
242  Handle<Object> thrown_object);
243 
244  // Create a 'with' context.
246  Handle<Context> previous,
247  Handle<JSReceiver> extension);
248 
249  // Create a block context.
251  Handle<Context> previous,
252  Handle<ScopeInfo> scope_info);
253 
254  // Allocate a new struct. The struct is pretenured (allocated directly in
255  // the old generation).
257 
259 
261  int aliased_context_slot);
262 
264 
266 
268 
270 
271  // Foreign objects are pretenured when allocated by the bootstrapper.
273  PretenureFlag pretenure = NOT_TENURED);
274 
275  // Allocate a new foreign object. The foreign is pretenured (allocated
276  // directly in the old generation).
278 
280  PretenureFlag pretenure = NOT_TENURED);
281 
283  int length,
284  ExternalArrayType array_type,
285  void* external_pointer,
286  PretenureFlag pretenure = NOT_TENURED);
287 
289  int length,
290  ExternalArrayType array_type,
291  PretenureFlag pretenure = NOT_TENURED);
292 
294 
296 
298 
299  // Allocate a tenured AllocationSite. It's payload is null.
301 
303  InstanceType type,
304  int instance_size,
305  ElementsKind elements_kind = TERMINAL_FAST_ELEMENTS_KIND);
306 
308  bool double_align,
310 
312 
314 
317 
319  Handle<Map> map);
320 
322 
323  // This method expects a COW array in new space, and creates a copy
324  // of it in old space.
326 
329 
332 
333  // Numbers (e.g. literals) are pretenured by the parser.
334  // The return value may be a smi or a heap number.
335  Handle<Object> NewNumber(double value,
336  PretenureFlag pretenure = NOT_TENURED);
337 
339  PretenureFlag pretenure = NOT_TENURED);
341  PretenureFlag pretenure = NOT_TENURED);
343  PretenureFlag pretenure = NOT_TENURED) {
344  if (Smi::IsValid(static_cast<intptr_t>(value))) {
345  return Handle<Object>(Smi::FromIntptr(static_cast<intptr_t>(value)),
346  isolate());
347  }
348  return NewNumber(static_cast<double>(value), pretenure);
349  }
352  PretenureFlag pretenure = NOT_TENURED);
353 
354  // These objects are used by the api to create env-independent data
355  // structures in the heap.
357  return NewJSObjectFromMap(neander_map());
358  }
359 
361 
362  // JS objects are pretenured when allocated by the bootstrapper and
363  // runtime.
365  PretenureFlag pretenure = NOT_TENURED);
366  // JSObject that should have a memento pointing to the allocation site.
369 
370  // Global objects are pretenured and initialized based on a constructor.
372 
373  // JS objects are pretenured when allocated by the bootstrapper and
374  // runtime.
377  PretenureFlag pretenure = NOT_TENURED,
378  bool allocate_properties = true,
380 
381  // JS modules are pretenured.
383  Handle<ScopeInfo> scope_info);
384 
385  // JS arrays are pretenured when allocated by the parser.
386 
387  // Create a JSArray with no elements.
389  ElementsKind elements_kind,
390  PretenureFlag pretenure = NOT_TENURED);
391 
392  // Create a JSArray with a specified length and elements initialized
393  // according to the specified mode.
395  ElementsKind elements_kind, int length, int capacity,
397  PretenureFlag pretenure = NOT_TENURED);
398 
400  int capacity,
402  PretenureFlag pretenure = NOT_TENURED) {
403  if (capacity != 0) {
404  elements_kind = GetHoleyElementsKind(elements_kind);
405  }
406  return NewJSArray(elements_kind, 0, capacity,
408  }
409 
410  // Create a JSArray with the given elements.
412  Handle<FixedArrayBase> elements,
413  ElementsKind elements_kind,
414  int length,
415  PretenureFlag pretenure = NOT_TENURED);
416 
418  Handle<FixedArrayBase> elements,
420  PretenureFlag pretenure = NOT_TENURED) {
421  return NewJSArrayWithElements(
422  elements, elements_kind, elements->length(), pretenure);
423  }
424 
426  Handle<JSArray> array,
427  int length,
428  int capacity,
430 
432 
434 
436 
438 
439  // Allocates a Harmony proxy.
441 
442  // Allocates a Harmony function proxy.
444  Handle<Object> call_trap,
445  Handle<Object> construct_trap,
446  Handle<Object> prototype);
447 
448  // Reinitialize an JSGlobalProxy based on a constructor. The object
449  // must have the same size as objects allocated using the
450  // constructor. The object is reinitialized and behaves as an
451  // object that has been freshly allocated using the constructor.
453  Handle<JSFunction> constructor);
454 
455  // Change the type of the argument into a JS object/function and reinitialize.
458 
460  Handle<Code> code,
461  Handle<Object> prototype,
462  bool read_only_prototype = false);
465  Handle<Code> code);
466 
468  Handle<SharedFunctionInfo> function_info,
469  Handle<Context> context,
470  PretenureFlag pretenure = TENURED);
471 
473  Handle<Code> code,
474  Handle<Object> prototype,
475  InstanceType type,
476  int instance_size,
477  bool read_only_prototype = false);
479  Handle<Code> code,
480  InstanceType type,
481  int instance_size);
482 
483  // Create a serialized scope info.
485 
486  // Create an External object for V8's external API.
488 
489  // The reference to the Code object is stored in self_reference.
490  // This allows generated code to reference its own Code object
491  // by containing this handle.
494  Handle<Object> self_reference,
495  bool immovable = false,
496  bool crankshafted = false,
497  int prologue_offset = Code::kPrologueOffsetNotSet,
498  bool is_debug = false);
499 
501 
503 
504  // Interface for creating error objects.
505 
506  MaybeHandle<Object> NewError(const char* maker, const char* message,
507  Handle<JSArray> args);
509  MaybeHandle<Object> NewError(const char* maker, const char* message,
510  Vector<Handle<Object> > args);
511  MaybeHandle<Object> NewError(const char* message,
512  Vector<Handle<Object> > args);
514  MaybeHandle<Object> NewError(const char* constructor, Handle<String> message);
515 
516  MaybeHandle<Object> NewTypeError(const char* message,
517  Vector<Handle<Object> > args);
519 
520  MaybeHandle<Object> NewRangeError(const char* message,
521  Vector<Handle<Object> > args);
523 
525  return NewRangeError("invalid_string_length",
526  HandleVector<Object>(NULL, 0));
527  }
528 
531 
533  Vector<Handle<Object> > args);
535  Handle<JSArray> args);
537 
538  MaybeHandle<Object> NewEvalError(const char* message,
539  Vector<Handle<Object> > args);
540 
542  bool check_number_string_cache = true);
543 
545  return NumberToString(NewNumberFromUint(value));
546  }
547 
551  GlobalProxyType
552  };
553 
556  Handle<Object> prototype,
557  ApiInstanceType type = JavaScriptObjectType);
558 
560 
561  // Installs interceptors on the instance. 'desc' is a function template,
562  // and instance is an object instance created by the function of this
563  // function template.
566 
567 #define ROOT_ACCESSOR(type, name, camel_name) \
568  inline Handle<type> name() { \
569  return Handle<type>(bit_cast<type**>( \
570  &isolate()->heap()->roots_[Heap::k##camel_name##RootIndex])); \
571  }
573 #undef ROOT_ACCESSOR
574 
575 #define STRUCT_MAP_ACCESSOR(NAME, Name, name) \
576  inline Handle<Map> name##_map() { \
577  return Handle<Map>(bit_cast<Map**>( \
578  &isolate()->heap()->roots_[Heap::k##Name##MapRootIndex])); \
579  }
581 #undef STRUCT_MAP_ACCESSOR
582 
583 #define STRING_ACCESSOR(name, str) \
584  inline Handle<String> name() { \
585  return Handle<String>(bit_cast<String**>( \
586  &isolate()->heap()->roots_[Heap::k##name##RootIndex])); \
587  }
589 #undef STRING_ACCESSOR
590 
592  isolate()->heap()->set_string_table(*table);
593  }
594 
596  return Handle<String>(&isolate()->heap()->hidden_string_);
597  }
598 
599  // Allocates a new SharedFunctionInfo object.
601  Handle<String> name, int number_of_literals, FunctionKind kind,
602  Handle<Code> code, Handle<ScopeInfo> scope_info,
605  MaybeHandle<Code> code);
606 
607  // Allocate a new type feedback vector
609 
610  // Allocates a new JSMessageObject object.
612  Handle<String> type,
613  Handle<JSArray> arguments,
614  int start_position,
615  int end_position,
616  Handle<Object> script,
617  Handle<Object> stack_frames);
618 
620 
621  // Return a map using the map cache in the native context.
622  // The key the an ordered set of property names.
625 
626  // Creates a new FixedArray that holds the data associated with the
627  // atom regexp and stores it in the regexp.
629  JSRegExp::Type type,
630  Handle<String> source,
632  Handle<Object> match_pattern);
633 
634  // Creates a new FixedArray that holds the data associated with the
635  // irregexp regexp and stores it in the regexp.
637  JSRegExp::Type type,
638  Handle<String> source,
640  int capture_count);
641 
642  // Returns the value for a known global constant (a property of the global
643  // object which is neither configurable nor writable) like 'undefined'.
644  // Returns a null handle when the given name is unknown.
646 
647  // Converts the given boolean condition to JavaScript boolean value.
649 
650  private:
651  Isolate* isolate() { return reinterpret_cast<Isolate*>(this); }
652 
653  // Creates a heap object based on the map. The fields of the heap object are
654  // not initialized by New<>() functions. It's the responsibility of the caller
655  // to do that.
656  template<typename T>
658 
659  template<typename T>
662  Handle<AllocationSite> allocation_site);
663 
664  // Creates a code object that is not yet fully initialized yet.
665  inline Handle<Code> NewCodeRaw(int object_size, bool immovable);
666 
667  // Create a new map cache.
668  Handle<MapCache> NewMapCache(int at_least_space_for);
669 
670  // Update the map cache in the native context with (keys, map)
673  Handle<Map> map);
674 
675  // Attempt to find the number in a small cache. If we finds it, return
676  // the string representation of the number. Otherwise return undefined.
678 
679  // Update the cache with a new number-string pair.
681 
682  // Initializes a function with a shared part and prototype.
683  // Note: this code was factored out of NewFunction such that other parts of
684  // the VM could use it. Specifically, a function that creates instances of
685  // type JS_FUNCTION_TYPE benefit from the use of this function.
688  Handle<Context> context);
689 
690  // Creates a function initialized with a shared part.
693  Handle<Context> context,
694  PretenureFlag pretenure = TENURED);
695 
698  MaybeHandle<Code> maybe_code);
699 
700  // Reinitialize a JSProxy into an (empty) JS object of respective type and
701  // size, but keeping the original prototype. The receiver must have at least
702  // the size of the new object. The object is reinitialized and behaves as an
703  // object that has been freshly allocated.
705 };
706 
707 } } // namespace v8::internal
708 
709 #endif // V8_FACTORY_H_
An ExternalOneByteStringResource is a wrapper around an one-byte string buffer that resides outside V...
Definition: v8.h:1918
An ExternalStringResource is a wrapper around a two-byte string buffer that resides outside V8's heap...
Definition: v8.h:1885
static const int kPrologueOffsetNotSet
Definition: objects.h:4973
MUST_USE_RESULT MaybeHandle< String > NewExternalStringFromOneByte(const ExternalOneByteString::Resource *resource)
MaybeHandle< Object > NewRangeError(Handle< String > message)
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind, int length, PretenureFlag pretenure=NOT_TENURED)
Handle< JSObject > NewArgumentsObject(Handle< JSFunction > callee, int length)
MUST_USE_RESULT Handle< String > NewTwoByteInternalizedString(Vector< const uc16 > str, uint32_t hash_field)
Handle< String > InternalizeOneByteString(Handle< SeqOneByteString >, int from, int length)
MaybeHandle< Object > NewError(const char *maker, const char *message, Handle< JSArray > args)
Handle< String > NumberToString(Handle< Object > number, bool check_number_string_cache=true)
MUST_USE_RESULT MaybeHandle< SeqTwoByteString > NewRawTwoByteString(int length, PretenureFlag pretenure=NOT_TENURED)
Handle< Script > NewScript(Handle< String > source)
Handle< JSFunction > NewFunction(Handle< String > name, Handle< Code > code, Handle< Object > prototype, InstanceType type, int instance_size, bool read_only_prototype=false)
Handle< Symbol > NewSymbol()
void SetRegExpAtomData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, Handle< Object > match_pattern)
Handle< JSFunction > CreateApiFunction(Handle< FunctionTemplateInfo > data, Handle< Object > prototype, ApiInstanceType type=JavaScriptObjectType)
Handle< Context > NewGlobalContext(Handle< JSFunction > function, Handle< ScopeInfo > scope_info)
Handle< JSTypedArray > NewJSTypedArray(ExternalArrayType type)
Handle< Object > GlobalConstantFor(Handle< String > name)
void ReinitializeJSProxy(Handle< JSProxy > proxy, InstanceType type, int size)
MUST_USE_RESULT MaybeHandle< String > NewStringFromAscii(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:139
Handle< PropertyCell > NewPropertyCellWithHole()
Handle< FixedArray > NewFixedArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
Handle< String > NewProperSubString(Handle< String > str, int begin, int end)
Handle< Context > NewCatchContext(Handle< JSFunction > function, Handle< Context > previous, Handle< String > name, Handle< Object > thrown_object)
Handle< GlobalObject > NewGlobalObject(Handle< JSFunction > constructor)
Handle< FixedTypedArrayBase > NewFixedTypedArray(int length, ExternalArrayType array_type, PretenureFlag pretenure=NOT_TENURED)
MaybeHandle< Object > NewTypeError(const char *message, Vector< Handle< Object > > args)
Handle< JSFunction > InstallMembers(Handle< JSFunction > function)
Handle< PropertyCell > NewPropertyCell(Handle< Object > value)
Handle< String > InternalizeUtf8String(const char *str)
Definition: factory.h:69
Handle< Context > NewFunctionContext(int length, Handle< JSFunction > function)
Handle< JSFunction > NewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Context > context, PretenureFlag pretenure=TENURED)
Handle< TypeFeedbackVector > NewTypeFeedbackVector(int slot_count)
MUST_USE_RESULT MaybeHandle< FunctionTemplateInfo > ConfigureInstance(Handle< FunctionTemplateInfo > desc, Handle< JSObject > instance)
MUST_USE_RESULT MaybeHandle< Map > InternalizedStringMapForString(Handle< String > string)
Handle< OrderedHashSet > NewOrderedHashSet()
Isolate * isolate()
Definition: factory.h:651
Handle< String > InternalizeStringWithKey(StringTableKey *key)
Handle< Context > NewModuleContext(Handle< ScopeInfo > scope_info)
Handle< JSDataView > NewJSDataView()
MaybeHandle< Object > NewError(const char *maker, const char *message, Vector< Handle< Object > > args)
MaybeHandle< Object > NewReferenceError(Handle< String > message)
Handle< Code > NewCodeRaw(int object_size, bool immovable)
Handle< FixedDoubleArray > CopyFixedDoubleArray(Handle< FixedDoubleArray > array)
MUST_USE_RESULT Handle< String > NewOneByteInternalizedSubString(Handle< SeqOneByteString > string, int offset, int length, uint32_t hash_field)
MUST_USE_RESULT Handle< String > NewInternalizedStringFromUtf8(Vector< const char > str, int chars, uint32_t hash_field)
Handle< FixedArray > CopyFixedArrayWithMap(Handle< FixedArray > array, Handle< Map > map)
Handle< String > Uint32ToString(uint32_t value)
Definition: factory.h:544
Handle< DeclaredAccessorInfo > NewDeclaredAccessorInfo()
Handle< Struct > NewStruct(InstanceType type)
Handle< Map > NewMap(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
Handle< String > InternalizeUtf8String(Vector< const char > str)
Handle< Context > NewBlockContext(Handle< JSFunction > function, Handle< Context > previous, Handle< ScopeInfo > scope_info)
Handle< String > EmergencyNewError(const char *message, Handle< JSArray > args)
Handle< AccessorPair > NewAccessorPair()
Handle< FixedArray > NewUninitializedFixedArray(int size)
void BecomeJSObject(Handle< JSProxy > object)
Handle< JSFunction > NewFunction(Handle< String > name, Handle< Code > code, InstanceType type, int instance_size)
Handle< HeapObject > NewFillerObject(int size, bool double_align, AllocationSpace space)
Handle< SharedFunctionInfo > NewSharedFunctionInfo(Handle< String > name, MaybeHandle< Code > code)
Handle< AllocationSite > NewAllocationSite()
MUST_USE_RESULT MaybeHandle< String > NewStringFromOneByte(Vector< const uint8_t > str, PretenureFlag pretenure=NOT_TENURED)
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
Handle< Object > GetNumberStringCache(Handle< Object > number)
Handle< Object > NewNumberFromUint(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
void SetRegExpIrregexpData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, int capture_count)
Handle< Context > NewWithContext(Handle< JSFunction > function, Handle< Context > previous, Handle< JSReceiver > extension)
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:417
Handle< JSArrayBuffer > NewJSArrayBuffer()
Handle< Code > CopyCode(Handle< Code > code, Vector< byte > reloc_info)
Handle< String > NewStringFromAsciiChecked(const char *str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:115
Handle< DebugInfo > NewDebugInfo(Handle< SharedFunctionInfo > shared)
void ReinitializeJSGlobalProxy(Handle< JSGlobalProxy > global, Handle< JSFunction > constructor)
Handle< FixedArray > CopyAndTenureFixedCOWArray(Handle< FixedArray > array)
MaybeHandle< Object > NewReferenceError(const char *message, Handle< JSArray > args)
Handle< JSFunction > NewFunction(Handle< String > name)
Handle< T > New(Handle< Map > map, AllocationSpace space, Handle< AllocationSite > allocation_site)
Handle< ByteArray > NewByteArray(int length, PretenureFlag pretenure=NOT_TENURED)
Handle< JSObject > CopyJSObject(Handle< JSObject > object)
Handle< String > hidden_string()
Definition: factory.h:595
Handle< ConstantPoolArray > NewExtendedConstantPoolArray(const ConstantPoolArray::NumberOfEntries &small, const ConstantPoolArray::NumberOfEntries &extended)
Handle< JSObject > NewExternal(void *value)
Handle< FixedArrayBase > NewFixedDoubleArray(int size, PretenureFlag pretenure=NOT_TENURED)
Handle< String > LookupSingleCharacterStringFromCode(uint32_t code)
Handle< SharedFunctionInfo > NewSharedFunctionInfo(Handle< String > name, int number_of_literals, FunctionKind kind, Handle< Code > code, Handle< ScopeInfo > scope_info, Handle< TypeFeedbackVector > feedback_vector)
Handle< JSObject > NewJSObjectWithMemento(Handle< JSFunction > constructor, Handle< AllocationSite > site)
Handle< JSObject > NewJSObjectFromMap(Handle< Map > map, PretenureFlag pretenure=NOT_TENURED, bool allocate_properties=true, Handle< AllocationSite > allocation_site=Handle< AllocationSite >::null())
Handle< JSModule > NewJSModule(Handle< Context > context, Handle< ScopeInfo > scope_info)
void InitializeFunction(Handle< JSFunction > function, Handle< SharedFunctionInfo > info, Handle< Context > context)
Handle< Object > NewNumberFromInt(int32_t value, PretenureFlag pretenure=NOT_TENURED)
void set_string_table(Handle< StringTable > table)
Definition: factory.h:591
Handle< String > InternalizeTwoByteString(Vector< const uc16 > str)
Handle< Map > ObjectLiteralMapFromCache(Handle< Context > context, Handle< FixedArray > keys)
Handle< ConstantPoolArray > CopyConstantPoolArray(Handle< ConstantPoolArray > array)
Handle< MapCache > NewMapCache(int at_least_space_for)
Handle< Oddball > NewOddball(Handle< Map > map, const char *to_string, Handle< Object > to_number, byte kind)
Handle< Object > ToBoolean(bool value)
Handle< JSFunction > NewFunction(Handle< Map > map, Handle< String > name, MaybeHandle< Code > maybe_code)
MaybeHandle< Object > NewReferenceError(const char *message, Vector< Handle< Object > > args)
Handle< ConstantPoolArray > NewConstantPoolArray(const ConstantPoolArray::NumberOfEntries &small)
MUST_USE_RESULT MaybeHandle< String > NewConsString(Handle< String > left, Handle< String > right)
MUST_USE_RESULT MaybeHandle< SeqOneByteString > NewRawOneByteString(int length, PretenureFlag pretenure=NOT_TENURED)
Handle< Code > CopyCode(Handle< Code > code)
Handle< OrderedHashMap > NewOrderedHashMap()
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
Handle< JSProxy > NewJSProxy(Handle< Object > handler, Handle< Object > prototype)
void BecomeJSFunction(Handle< JSProxy > object)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=DONT_INITIALIZE_ARRAY_ELEMENTS, PretenureFlag pretenure=NOT_TENURED)
Handle< JSObject > NewNeanderObject()
Definition: factory.h:356
Handle< String > InternalizeString(Handle< String > str)
Handle< TypeFeedbackInfo > NewTypeFeedbackInfo()
Handle< Object > NewNumberFromSize(size_t value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:342
Handle< T > New(Handle< Map > map, AllocationSpace space)
Handle< ExecutableAccessorInfo > NewExecutableAccessorInfo()
Handle< ExternalArray > NewExternalArray(int length, ExternalArrayType array_type, void *external_pointer, PretenureFlag pretenure=NOT_TENURED)
MaybeHandle< Object > NewError(const char *constructor, Handle< String > message)
void SetNumberStringCache(Handle< Object > number, Handle< String > string)
MaybeHandle< Object > NewSyntaxError(Handle< String > message)
Handle< JSFunction > NewFunctionWithoutPrototype(Handle< String > name, Handle< Code > code)
Handle< String > InternalizeOneByteString(Vector< const uint8_t > str)
Handle< Object > NewNumber(double value, PretenureFlag pretenure=NOT_TENURED)
Handle< JSArray > NewJSArray(ElementsKind elements_kind, PretenureFlag pretenure=NOT_TENURED)
MUST_USE_RESULT Handle< String > NewInternalizedStringImpl(Handle< String > string, int chars, uint32_t hash_field)
Handle< JSObject > CopyJSObjectWithAllocationSite(Handle< JSObject > object, Handle< AllocationSite > site)
Handle< String > NewSubString(Handle< String > str, int begin, int end)
Definition: factory.h:205
Handle< JSArray > NewJSArray(int capacity, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:399
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
MaybeHandle< Object > NewTypeError(Handle< String > message)
Handle< String > NewStringFromStaticChars(const char(&str)[N], PretenureFlag pretenure=NOT_TENURED)
Definition: factory.h:108
Handle< Foreign > NewForeign(const AccessorDescriptor *foreign)
Handle< JSProxy > NewJSFunctionProxy(Handle< Object > handler, Handle< Object > call_trap, Handle< Object > construct_trap, Handle< Object > prototype)
MUST_USE_RESULT MaybeHandle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
Handle< HeapNumber > NewHeapNumber(double value, MutableMode mode=IMMUTABLE, PretenureFlag pretenure=NOT_TENURED)
Handle< Symbol > NewPrivateSymbol()
MaybeHandle< Object > NewSyntaxError(const char *message, Handle< JSArray > args)
Handle< ScopeInfo > NewScopeInfo(int length)
MUST_USE_RESULT Handle< String > NewOneByteInternalizedString(Vector< const uint8_t > str, uint32_t hash_field)
Handle< Code > NewCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false, bool crankshafted=false, int prologue_offset=Code::kPrologueOffsetNotSet, bool is_debug=false)
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
Handle< JSObject > NewFunctionPrototype(Handle< JSFunction > function)
MaybeHandle< Object > NewError(const char *message, Vector< Handle< Object > > args)
Handle< CodeCache > NewCodeCache()
MaybeHandle< Object > NewRangeError(const char *message, Vector< Handle< Object > > args)
Handle< JSFunction > NewFunction(Handle< Map > map, Handle< SharedFunctionInfo > info, Handle< Context > context, PretenureFlag pretenure=TENURED)
Handle< JSMessageObject > NewJSMessageObject(Handle< String > type, Handle< JSArray > arguments, int start_position, int end_position, Handle< Object > script, Handle< Object > stack_frames)
MaybeHandle< Object > NewEvalError(const char *message, Vector< Handle< Object > > args)
void NewJSArrayStorage(Handle< JSArray > array, int length, int capacity, ArrayStorageAllocationMode mode=DONT_INITIALIZE_ARRAY_ELEMENTS)
Handle< Box > NewBox(Handle< Object > value)
Handle< MapCache > AddToMapCache(Handle< Context > context, Handle< FixedArray > keys, Handle< Map > map)
Handle< Context > NewNativeContext()
MUST_USE_RESULT MaybeHandle< String > NewStringFromTwoByte(Vector< const uc16 > str, PretenureFlag pretenure=NOT_TENURED)
MaybeHandle< Object > NewInvalidStringLengthError()
Definition: factory.h:524
Handle< Symbol > NewPrivateOwnSymbol()
MUST_USE_RESULT MaybeHandle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
MaybeHandle< Object > NewError(Handle< String > message)
Handle< DeclaredAccessorDescriptor > NewDeclaredAccessorDescriptor()
Handle< JSFunction > NewFunction(Handle< String > name, Handle< Code > code, Handle< Object > prototype, bool read_only_prototype=false)
Handle< Cell > NewCell(Handle< Object > value)
Handle< AliasedArgumentsEntry > NewAliasedArgumentsEntry(int aliased_context_slot)
Handle< FixedArrayBase > NewFixedDoubleArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
Handle< JSGeneratorObject > NewJSGeneratorObject(Handle< JSFunction > function)
static Smi * FromIntptr(intptr_t value)
Definition: objects-inl.h:1327
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1334
#define FINAL
#define STRUCT_MAP_ACCESSOR(NAME, Name, name)
Definition: factory.h:575
#define STRING_ACCESSOR(name, str)
Definition: factory.h:583
#define ROOT_ACCESSOR(type, name, camel_name)
Definition: factory.h:567
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map
enable harmony numeric enable harmony object literal extensions Optimize object size
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_BOOL(profile_deserialization
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi space(in MBytes)
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL
#define ROOT_LIST(V)
Definition: heap.h:206
#define INTERNALIZED_STRING_LIST(V)
Definition: heap.h:262
#define DCHECK(condition)
Definition: logging.h:205
#define MUST_USE_RESULT
Definition: macros.h:266
int int32_t
Definition: unicode.cc:24
Vector< const char > CStrVector(const char *data)
Definition: vector.h:158
@ TERMINAL_FAST_ELEMENTS_KIND
Definition: elements-kind.h:63
kFeedbackVectorOffset kHiddenPrototypeBit read_only_prototype
Definition: objects-inl.h:5423
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
byte * Address
Definition: globals.h:101
Vector< const uint8_t > OneByteVector(const char *data, int length)
Definition: vector.h:162
int StrLength(const char *string)
Definition: vector.h:147
ArrayStorageAllocationMode
Definition: heap.h:511
@ INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE
Definition: heap.h:513
@ DONT_INITIALIZE_ARRAY_ELEMENTS
Definition: heap.h:512
Debugger support for the V8 JavaScript engine.
Definition: accessors.cc:20
ExternalArrayType
Definition: v8.h:2217
#define STRUCT_LIST(V)
Definition: objects.h:515
#define STATIC_CHAR_VECTOR(x)
Definition: vector.h:154