v8  3.25.30(node0.11.13)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
factory.cc
Go to the documentation of this file.
1 // Copyright 2013 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are
4 // met:
5 //
6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided
11 // with the distribution.
12 // * Neither the name of Google Inc. nor the names of its
13 // contributors may be used to endorse or promote products derived
14 // from this software without specific prior written permission.
15 //
16 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 
28 #include "v8.h"
29 
30 #include "api.h"
31 #include "debug.h"
32 #include "execution.h"
33 #include "factory.h"
34 #include "isolate-inl.h"
35 #include "macro-assembler.h"
36 #include "objects.h"
37 #include "objects-visiting.h"
38 #include "platform.h"
39 #include "scopeinfo.h"
40 
41 namespace v8 {
42 namespace internal {
43 
44 
47  isolate(),
48  isolate()->heap()->AllocateBox(*value, pretenure),
49  Box);
50 }
51 
52 
54  ASSERT(0 <= size);
56  isolate(),
57  isolate()->heap()->AllocateFixedArray(size, pretenure),
58  FixedArray);
59 }
60 
61 
63  PretenureFlag pretenure) {
64  ASSERT(0 <= size);
66  isolate(),
67  isolate()->heap()->AllocateFixedArrayWithHoles(size, pretenure),
68  FixedArray);
69 }
70 
71 
74  isolate(),
75  isolate()->heap()->AllocateUninitializedFixedArray(size),
76  FixedArray);
77 }
78 
79 
81  PretenureFlag pretenure) {
82  ASSERT(0 <= size);
84  isolate(),
85  isolate()->heap()->AllocateUninitializedFixedDoubleArray(size, pretenure),
87 }
88 
89 
91  int number_of_int64_entries,
92  int number_of_code_ptr_entries,
93  int number_of_heap_ptr_entries,
94  int number_of_int32_entries) {
95  ASSERT(number_of_int64_entries > 0 || number_of_code_ptr_entries > 0 ||
96  number_of_heap_ptr_entries > 0 || number_of_int32_entries > 0);
98  isolate(),
99  isolate()->heap()->AllocateConstantPoolArray(number_of_int64_entries,
100  number_of_code_ptr_entries,
101  number_of_heap_ptr_entries,
102  number_of_int32_entries),
104 }
105 
106 
108  ASSERT(0 <= at_least_space_for);
109  CALL_HEAP_FUNCTION(isolate(),
110  NameDictionary::Allocate(isolate()->heap(),
111  at_least_space_for),
113 }
114 
115 
117  int at_least_space_for) {
118  ASSERT(0 <= at_least_space_for);
119  CALL_HEAP_FUNCTION(isolate(),
120  SeededNumberDictionary::Allocate(isolate()->heap(),
121  at_least_space_for),
123 }
124 
125 
127  int at_least_space_for) {
128  ASSERT(0 <= at_least_space_for);
129  CALL_HEAP_FUNCTION(isolate(),
130  UnseededNumberDictionary::Allocate(isolate()->heap(),
131  at_least_space_for),
133 }
134 
135 
137  ASSERT(0 <= at_least_space_for);
138  CALL_HEAP_FUNCTION(isolate(),
139  ObjectHashSet::Allocate(isolate()->heap(),
140  at_least_space_for),
141  ObjectHashSet);
142 }
143 
144 
146  int at_least_space_for,
147  MinimumCapacity capacity_option) {
148  ASSERT(0 <= at_least_space_for);
149  CALL_HEAP_FUNCTION(isolate(),
150  ObjectHashTable::Allocate(isolate()->heap(),
151  at_least_space_for,
152  capacity_option),
154 }
155 
156 
158  ASSERT(0 <= at_least_space_for);
160  isolate(),
161  WeakHashTable::Allocate(isolate()->heap(),
162  at_least_space_for,
164  TENURED),
165  WeakHashTable);
166 }
167 
168 
170  int slack) {
171  ASSERT(0 <= number_of_descriptors);
172  CALL_HEAP_FUNCTION(isolate(),
174  isolate(), number_of_descriptors, slack),
176 }
177 
178 
180  int deopt_entry_count,
181  PretenureFlag pretenure) {
182  ASSERT(deopt_entry_count > 0);
183  CALL_HEAP_FUNCTION(isolate(),
185  deopt_entry_count,
186  pretenure),
188 }
189 
190 
192  int deopt_entry_count,
193  PretenureFlag pretenure) {
194  ASSERT(deopt_entry_count > 0);
195  CALL_HEAP_FUNCTION(isolate(),
197  deopt_entry_count,
198  pretenure),
200 }
201 
202 
204  CALL_HEAP_FUNCTION(isolate(),
205  isolate()->heap()->AllocateAccessorPair(),
206  AccessorPair);
207 }
208 
209 
211  CALL_HEAP_FUNCTION(isolate(),
212  isolate()->heap()->AllocateTypeFeedbackInfo(),
214 }
215 
216 
217 // Internalized strings are created in the old generation (data space).
219  Utf8StringKey key(string, isolate()->heap()->HashSeed());
220  return InternalizeStringWithKey(&key);
221 }
222 
223 
224 // Internalized strings are created in the old generation (data space).
226  CALL_HEAP_FUNCTION(isolate(),
227  isolate()->heap()->InternalizeString(*string),
228  String);
229 }
230 
231 
233  OneByteStringKey key(string, isolate()->heap()->HashSeed());
234  return InternalizeStringWithKey(&key);
235 }
236 
237 
239  Handle<SeqOneByteString> string, int from, int length) {
240  SubStringKey<uint8_t> key(string, from, length);
241  return InternalizeStringWithKey(&key);
242 }
243 
244 
246  TwoByteStringKey key(string, isolate()->heap()->HashSeed());
247  return InternalizeStringWithKey(&key);
248 }
249 
250 
251 template<class StringTableKey>
253  CALL_HEAP_FUNCTION(isolate(),
254  isolate()->heap()->InternalizeStringWithKey(key),
255  String);
256 }
257 
258 
263 
264 
266  PretenureFlag pretenure) {
268  isolate(),
269  isolate()->heap()->AllocateStringFromOneByte(string, pretenure),
270  String);
271 }
272 
274  PretenureFlag pretenure) {
276  isolate(),
277  isolate()->heap()->AllocateStringFromUtf8(string, pretenure),
278  String);
279 }
280 
281 
283  PretenureFlag pretenure) {
285  isolate(),
286  isolate()->heap()->AllocateStringFromTwoByte(string, pretenure),
287  String);
288 }
289 
290 
292  PretenureFlag pretenure) {
294  isolate(),
295  isolate()->heap()->AllocateRawOneByteString(length, pretenure),
297 }
298 
299 
301  PretenureFlag pretenure) {
303  isolate(),
304  isolate()->heap()->AllocateRawTwoByteString(length, pretenure),
306 }
307 
308 
309 // Returns true for a character in a range. Both limits are inclusive.
310 static inline bool Between(uint32_t character, uint32_t from, uint32_t to) {
311  // This makes uses of the the unsigned wraparound.
312  return character - from <= to - from;
313 }
314 
315 
316 static inline Handle<String> MakeOrFindTwoCharacterString(Isolate* isolate,
317  uint16_t c1,
318  uint16_t c2) {
319  // Numeric strings have a different hash algorithm not known by
320  // LookupTwoCharsStringIfExists, so we skip this step for such strings.
321  if (!Between(c1, '0', '9') || !Between(c2, '0', '9')) {
322  String* result;
323  StringTable* table = isolate->heap()->string_table();
324  if (table->LookupTwoCharsStringIfExists(c1, c2, &result)) {
325  return handle(result);
326  }
327  }
328 
329  // Now we know the length is 2, we might as well make use of that fact
330  // when building the new string.
331  if (static_cast<unsigned>(c1 | c2) <= String::kMaxOneByteCharCodeU) {
332  // We can do this.
333  ASSERT(IsPowerOf2(String::kMaxOneByteCharCodeU + 1)); // because of this.
334  Handle<SeqOneByteString> str = isolate->factory()->NewRawOneByteString(2);
335  uint8_t* dest = str->GetChars();
336  dest[0] = static_cast<uint8_t>(c1);
337  dest[1] = static_cast<uint8_t>(c2);
338  return str;
339  } else {
340  Handle<SeqTwoByteString> str = isolate->factory()->NewRawTwoByteString(2);
341  uc16* dest = str->GetChars();
342  dest[0] = c1;
343  dest[1] = c2;
344  return str;
345  }
346 }
347 
348 
349 template<typename SinkChar, typename StringType>
351  Handle<String> first,
352  Handle<String> second) {
353  DisallowHeapAllocation pointer_stays_valid;
354  SinkChar* sink = result->GetChars();
355  String::WriteToFlat(*first, sink, 0, first->length());
356  String::WriteToFlat(*second, sink + first->length(), 0, second->length());
357  return result;
358 }
359 
360 
363  ? cons_ascii_string_map() : cons_string_map();
364  CALL_HEAP_FUNCTION(isolate(),
365  isolate()->heap()->Allocate(*map, NEW_SPACE),
366  ConsString);
367 }
368 
369 
371  Handle<String> right) {
372  int left_length = left->length();
373  if (left_length == 0) return right;
374  int right_length = right->length();
375  if (right_length == 0) return left;
376 
377  int length = left_length + right_length;
378 
379  if (length == 2) {
380  uint16_t c1 = left->Get(0);
381  uint16_t c2 = right->Get(0);
382  return MakeOrFindTwoCharacterString(isolate(), c1, c2);
383  }
384 
385  // Make sure that an out of memory exception is thrown if the length
386  // of the new cons string is too large.
387  if (length > String::kMaxLength || length < 0) {
388  isolate()->ThrowInvalidStringLength();
389  return Handle<String>::null();
390  }
391 
392  bool left_is_one_byte = left->IsOneByteRepresentation();
393  bool right_is_one_byte = right->IsOneByteRepresentation();
394  bool is_one_byte = left_is_one_byte && right_is_one_byte;
395  bool is_one_byte_data_in_two_byte_string = false;
396  if (!is_one_byte) {
397  // At least one of the strings uses two-byte representation so we
398  // can't use the fast case code for short ASCII strings below, but
399  // we can try to save memory if all chars actually fit in ASCII.
400  is_one_byte_data_in_two_byte_string =
401  left->HasOnlyOneByteChars() && right->HasOnlyOneByteChars();
402  if (is_one_byte_data_in_two_byte_string) {
403  isolate()->counters()->string_add_runtime_ext_to_ascii()->Increment();
404  }
405  }
406 
407  // If the resulting string is small make a flat string.
408  if (length < ConsString::kMinLength) {
409  // Note that neither of the two inputs can be a slice because:
411  ASSERT(left->IsFlat());
412  ASSERT(right->IsFlat());
413 
415  if (is_one_byte) {
418  uint8_t* dest = result->GetChars();
419  // Copy left part.
420  const uint8_t* src = left->IsExternalString()
421  ? Handle<ExternalAsciiString>::cast(left)->GetChars()
422  : Handle<SeqOneByteString>::cast(left)->GetChars();
423  for (int i = 0; i < left_length; i++) *dest++ = src[i];
424  // Copy right part.
425  src = right->IsExternalString()
426  ? Handle<ExternalAsciiString>::cast(right)->GetChars()
427  : Handle<SeqOneByteString>::cast(right)->GetChars();
428  for (int i = 0; i < right_length; i++) *dest++ = src[i];
429  return result;
430  }
431 
432  return (is_one_byte_data_in_two_byte_string)
433  ? ConcatStringContent<uint8_t>(NewRawOneByteString(length), left, right)
434  : ConcatStringContent<uc16>(NewRawTwoByteString(length), left, right);
435  }
436 
438  (is_one_byte || is_one_byte_data_in_two_byte_string)
441 
443  WriteBarrierMode mode = result->GetWriteBarrierMode(no_gc);
444 
445  result->set_hash_field(String::kEmptyHashField);
446  result->set_length(length);
447  result->set_first(*left, mode);
448  result->set_second(*right, mode);
449  return result;
450 }
451 
452 
454  Handle<String> second) {
455  int total_length = first->length() + second->length();
456  if (first->IsOneByteRepresentation() && second->IsOneByteRepresentation()) {
457  return ConcatStringContent<uint8_t>(
458  NewRawOneByteString(total_length), first, second);
459  } else {
460  return ConcatStringContent<uc16>(
461  NewRawTwoByteString(total_length), first, second);
462  }
463 }
464 
465 
468  ? sliced_ascii_string_map() : sliced_string_map();
469  CALL_HEAP_FUNCTION(isolate(),
470  isolate()->heap()->Allocate(*map, NEW_SPACE),
471  SlicedString);
472 }
473 
474 
476  int begin,
477  int end) {
478 #if VERIFY_HEAP
479  if (FLAG_verify_heap) str->StringVerify();
480 #endif
481  ASSERT(begin > 0 || end < str->length());
482 
483  int length = end - begin;
484  if (length <= 0) return empty_string();
485  if (length == 1) {
486  return LookupSingleCharacterStringFromCode(isolate(), str->Get(begin));
487  }
488  if (length == 2) {
489  // Optimization for 2-byte strings often used as keys in a decompression
490  // dictionary. Check whether we already have the string in the string
491  // table to prevent creation of many unnecessary strings.
492  uint16_t c1 = str->Get(begin);
493  uint16_t c2 = str->Get(begin + 1);
494  return MakeOrFindTwoCharacterString(isolate(), c1, c2);
495  }
496 
497  if (!FLAG_string_slices || length < SlicedString::kMinLength) {
498  if (str->IsOneByteRepresentation()) {
500  ASSERT(!result.is_null());
501  uint8_t* dest = result->GetChars();
503  String::WriteToFlat(*str, dest, begin, end);
504  return result;
505  } else {
507  ASSERT(!result.is_null());
508  uc16* dest = result->GetChars();
510  String::WriteToFlat(*str, dest, begin, end);
511  return result;
512  }
513  }
514 
515  int offset = begin;
516 
517  while (str->IsConsString()) {
519  int split = cons->first()->length();
520  if (split <= offset) {
521  // Slice is fully contained in the second part.
522  str = Handle<String>(cons->second(), isolate());
523  offset -= split; // Adjust for offset.
524  continue;
525  } else if (offset + length <= split) {
526  // Slice is fully contained in the first part.
527  str = Handle<String>(cons->first(), isolate());
528  continue;
529  }
530  break;
531  }
532 
533  if (str->IsSlicedString()) {
535  str = Handle<String>(slice->parent(), isolate());
536  offset += slice->offset();
537  } else {
538  str = FlattenGetString(str);
539  }
540 
541  ASSERT(str->IsSeqString() || str->IsExternalString());
543  str->IsOneByteRepresentation() ? String::ONE_BYTE_ENCODING
545 
546  slice->set_hash_field(String::kEmptyHashField);
547  slice->set_length(length);
548  slice->set_parent(*str);
549  slice->set_offset(offset);
550  return slice;
551 }
552 
553 
555  const ExternalAsciiString::Resource* resource) {
557  isolate(),
558  isolate()->heap()->AllocateExternalStringFromAscii(resource),
559  String);
560 }
561 
562 
564  const ExternalTwoByteString::Resource* resource) {
566  isolate(),
567  isolate()->heap()->AllocateExternalStringFromTwoByte(resource),
568  String);
569 }
570 
571 
574  isolate(),
575  isolate()->heap()->AllocateSymbol(),
576  Symbol);
577 }
578 
579 
582  isolate(),
583  isolate()->heap()->AllocatePrivateSymbol(),
584  Symbol);
585 }
586 
587 
590  isolate(),
591  isolate()->heap()->AllocateNativeContext(),
592  Context);
593 }
594 
595 
597  Handle<ScopeInfo> scope_info) {
599  isolate(),
600  isolate()->heap()->AllocateGlobalContext(*function, *scope_info),
601  Context);
602 }
603 
604 
607  isolate(),
608  isolate()->heap()->AllocateModuleContext(*scope_info),
609  Context);
610 }
611 
612 
614  Handle<JSFunction> function) {
616  isolate(),
617  isolate()->heap()->AllocateFunctionContext(length, *function),
618  Context);
619 }
620 
621 
623  Handle<Context> previous,
625  Handle<Object> thrown_object) {
627  isolate(),
628  isolate()->heap()->AllocateCatchContext(*function,
629  *previous,
630  *name,
631  *thrown_object),
632  Context);
633 }
634 
635 
637  Handle<Context> previous,
638  Handle<JSObject> extension) {
640  isolate(),
641  isolate()->heap()->AllocateWithContext(*function, *previous, *extension),
642  Context);
643 }
644 
645 
647  Handle<Context> previous,
648  Handle<ScopeInfo> scope_info) {
650  isolate(),
651  isolate()->heap()->AllocateBlockContext(*function,
652  *previous,
653  *scope_info),
654  Context);
655 }
656 
657 
660  isolate(),
661  isolate()->heap()->AllocateStruct(type),
662  Struct);
663 }
664 
665 
667  int aliased_context_slot) {
670  entry->set_aliased_context_slot(aliased_context_slot);
671  return entry;
672 }
673 
674 
678 }
679 
680 
685  info->set_flag(0); // Must clear the flag, it was initialized as undefined.
686  return info;
687 }
688 
689 
694  info->set_flag(0); // Must clear the flag, it was initialized as undefined.
695  return info;
696 }
697 
698 
700  // Generate id for this script.
701  Heap* heap = isolate()->heap();
702  int id = heap->last_script_id()->value() + 1;
703  if (!Smi::IsValid(id) || id < 0) id = 1;
704  heap->set_last_script_id(Smi::FromInt(id));
705 
706  // Create and initialize script object.
707  Handle<Foreign> wrapper = NewForeign(0, TENURED);
709  script->set_source(*source);
710  script->set_name(heap->undefined_value());
711  script->set_id(Smi::FromInt(id));
712  script->set_line_offset(Smi::FromInt(0));
713  script->set_column_offset(Smi::FromInt(0));
714  script->set_context_data(heap->undefined_value());
715  script->set_type(Smi::FromInt(Script::TYPE_NORMAL));
716  script->set_wrapper(*wrapper);
717  script->set_line_ends(heap->undefined_value());
718  script->set_eval_from_shared(heap->undefined_value());
719  script->set_eval_from_instructions_offset(Smi::FromInt(0));
720  script->set_flags(Smi::FromInt(0));
721 
722  return script;
723 }
724 
725 
727  CALL_HEAP_FUNCTION(isolate(),
728  isolate()->heap()->AllocateForeign(addr, pretenure),
729  Foreign);
730 }
731 
732 
734  return NewForeign((Address) desc, TENURED);
735 }
736 
737 
739  ASSERT(0 <= length);
741  isolate(),
742  isolate()->heap()->AllocateByteArray(length, pretenure),
743  ByteArray);
744 }
745 
746 
748  ExternalArrayType array_type,
749  void* external_pointer,
750  PretenureFlag pretenure) {
751  ASSERT(0 <= length && length <= Smi::kMaxValue);
753  isolate(),
754  isolate()->heap()->AllocateExternalArray(length,
755  array_type,
756  external_pointer,
757  pretenure),
758  ExternalArray);
759 }
760 
761 
763  int length,
764  ExternalArrayType array_type,
765  PretenureFlag pretenure) {
766  ASSERT(0 <= length && length <= Smi::kMaxValue);
768  isolate(),
769  isolate()->heap()->AllocateFixedTypedArray(length,
770  array_type,
771  pretenure),
773 }
774 
775 
777  AllowDeferredHandleDereference convert_to_cell;
779  isolate(),
780  isolate()->heap()->AllocateCell(*value),
781  Cell);
782 }
783 
784 
787  isolate(),
788  isolate()->heap()->AllocatePropertyCell(),
789  PropertyCell);
790 }
791 
792 
794  AllowDeferredHandleDereference convert_to_cell;
796  PropertyCell::SetValueInferType(cell, value);
797  return cell;
798 }
799 
800 
803  isolate(),
804  isolate()->heap()->AllocateAllocationSite(),
806 }
807 
808 
810  int instance_size,
811  ElementsKind elements_kind) {
813  isolate(),
814  isolate()->heap()->AllocateMap(type, instance_size, elements_kind),
815  Map);
816 }
817 
818 
820  // Make sure to use globals from the function's context, since the function
821  // can be from a different context.
822  Handle<Context> native_context(function->context()->native_context());
823  Handle<Map> new_map;
824  if (function->shared()->is_generator()) {
825  // Generator prototypes can share maps since they don't have "constructor"
826  // properties.
827  new_map = handle(native_context->generator_object_prototype_map());
828  } else {
829  // Each function prototype gets a fresh map to avoid unwanted sharing of
830  // maps between prototypes of different constructors.
831  Handle<JSFunction> object_function(native_context->object_function());
832  ASSERT(object_function->has_initial_map());
833  new_map = Map::Copy(handle(object_function->initial_map()));
834  }
835 
836  Handle<JSObject> prototype = NewJSObjectFromMap(new_map);
837 
838  if (!function->shared()->is_generator()) {
840  constructor_string(),
841  function,
842  DONT_ENUM);
843  }
844 
845  return prototype;
846 }
847 
848 
851  isolate(), src->CopyWithPreallocatedFieldDescriptors(), Map);
852 }
853 
854 
856  int extra_inobject_properties) {
858  // Check that we do not overflow the instance size when adding the
859  // extra inobject properties.
860  int instance_size_delta = extra_inobject_properties * kPointerSize;
861  int max_instance_size_delta =
862  JSObject::kMaxInstanceSize - copy->instance_size();
863  int max_extra_properties = max_instance_size_delta >> kPointerSizeLog2;
864  if (extra_inobject_properties > max_extra_properties) {
865  // If the instance size overflows, we allocate as many properties
866  // as we can as inobject properties.
867  instance_size_delta = max_instance_size_delta;
868  extra_inobject_properties = max_extra_properties;
869  }
870  // Adjust the map with the extra inobject properties.
871  int inobject_properties =
872  copy->inobject_properties() + extra_inobject_properties;
873  copy->set_inobject_properties(inobject_properties);
874  copy->set_unused_property_fields(inobject_properties);
875  copy->set_instance_size(copy->instance_size() + instance_size_delta);
876  copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
877  return copy;
878 }
879 
880 
882  CALL_HEAP_FUNCTION(isolate(), src->Copy(), Map);
883 }
884 
885 
887  CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray);
888 }
889 
890 
892  Handle<FixedArray> array) {
893  ASSERT(isolate()->heap()->InNewSpace(*array));
894  CALL_HEAP_FUNCTION(isolate(),
895  isolate()->heap()->CopyAndTenureFixedCOWArray(*array),
896  FixedArray);
897 }
898 
899 
901  int new_length,
902  PretenureFlag pretenure) {
903  CALL_HEAP_FUNCTION(isolate(),
904  array->CopySize(new_length, pretenure),
905  FixedArray);
906 }
907 
908 
910  Handle<FixedDoubleArray> array) {
911  CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedDoubleArray);
912 }
913 
914 
917  CALL_HEAP_FUNCTION(isolate(), array->Copy(), ConstantPoolArray);
918 }
919 
920 
922  Handle<SharedFunctionInfo> function_info,
923  Handle<Map> function_map,
924  PretenureFlag pretenure) {
926  isolate(),
927  isolate()->heap()->AllocateFunction(*function_map,
928  *function_info,
929  isolate()->heap()->the_hole_value(),
930  pretenure),
931  JSFunction);
932 }
933 
934 
935 static Handle<Map> MapForNewFunction(Isolate *isolate,
936  Handle<SharedFunctionInfo> function_info) {
937  Context *context = isolate->context()->native_context();
938  int map_index = Context::FunctionMapIndex(function_info->strict_mode(),
939  function_info->is_generator());
940  return Handle<Map>(Map::cast(context->get(map_index)));
941 }
942 
943 
945  Handle<SharedFunctionInfo> function_info,
946  Handle<Context> context,
947  PretenureFlag pretenure) {
949  function_info,
950  MapForNewFunction(isolate(), function_info),
951  pretenure);
952 
953  if (function_info->ic_age() != isolate()->heap()->global_ic_age()) {
954  function_info->ResetForNewContext(isolate()->heap()->global_ic_age());
955  }
956 
957  result->set_context(*context);
958 
959  int index = function_info->SearchOptimizedCodeMap(context->native_context(),
960  BailoutId::None());
961  if (!function_info->bound() && index < 0) {
962  int number_of_literals = function_info->num_literals();
963  Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
964  if (number_of_literals > 0) {
965  // Store the native context in the literals array prefix. This
966  // context will be used when creating object, regexp and array
967  // literals in this function.
969  context->native_context());
970  }
971  result->set_literals(*literals);
972  }
973 
974  if (index > 0) {
975  // Caching of optimized code enabled and optimized code found.
977  function_info->GetLiteralsFromOptimizedCodeMap(index);
978  if (literals != NULL) result->set_literals(literals);
979  Code* code = function_info->GetCodeFromOptimizedCodeMap(index);
981  result->ReplaceCode(code);
982  return result;
983  }
984 
985  if (isolate()->use_crankshaft() &&
986  FLAG_always_opt &&
987  result->is_compiled() &&
988  !function_info->is_toplevel() &&
989  function_info->allows_lazy_compilation() &&
990  !function_info->optimization_disabled() &&
991  !isolate()->DebuggerHasBreakPoints()) {
992  result->MarkForOptimization();
993  }
994  return result;
995 }
996 
997 
999  PretenureFlag pretenure) {
1001  isolate(),
1002  isolate()->heap()->NumberFromDouble(value, pretenure), Object);
1003 }
1004 
1005 
1007  PretenureFlag pretenure) {
1009  isolate(),
1010  isolate()->heap()->NumberFromInt32(value, pretenure), Object);
1011 }
1012 
1013 
1015  PretenureFlag pretenure) {
1017  isolate(),
1018  isolate()->heap()->NumberFromUint32(value, pretenure), Object);
1019 }
1020 
1021 
1023  PretenureFlag pretenure) {
1025  isolate(),
1026  isolate()->heap()->AllocateHeapNumber(value, pretenure), HeapNumber);
1027 }
1028 
1029 
1032  isolate(),
1033  isolate()->heap()->AllocateJSObjectFromMap(
1034  isolate()->heap()->neander_map()),
1035  JSObject);
1036 }
1037 
1038 
1040  Vector< Handle<Object> > args) {
1041  return NewError("MakeTypeError", message, args);
1042 }
1043 
1044 
1046  return NewError("$TypeError", message);
1047 }
1048 
1049 
1051  Vector< Handle<Object> > args) {
1052  return NewError("MakeRangeError", message, args);
1053 }
1054 
1055 
1057  return NewError("$RangeError", message);
1058 }
1059 
1060 
1062  Handle<JSArray> args) {
1063  return NewError("MakeSyntaxError", message, args);
1064 }
1065 
1066 
1068  return NewError("$SyntaxError", message);
1069 }
1070 
1071 
1073  Vector< Handle<Object> > args) {
1074  return NewError("MakeReferenceError", message, args);
1075 }
1076 
1077 
1079  Handle<JSArray> args) {
1080  return NewError("MakeReferenceError", message, args);
1081 }
1082 
1083 
1085  return NewError("$ReferenceError", message);
1086 }
1087 
1088 
1090  const char* message,
1091  Vector< Handle<Object> > args) {
1092  // Instantiate a closeable HandleScope for EscapeFrom.
1093  v8::EscapableHandleScope scope(reinterpret_cast<v8::Isolate*>(isolate()));
1094  Handle<FixedArray> array = NewFixedArray(args.length());
1095  for (int i = 0; i < args.length(); i++) {
1096  array->set(i, *args[i]);
1097  }
1098  Handle<JSArray> object = NewJSArrayWithElements(array);
1099  Handle<Object> result = NewError(maker, message, object);
1100  return result.EscapeFrom(&scope);
1101 }
1102 
1103 
1105  Vector< Handle<Object> > args) {
1106  return NewError("MakeEvalError", message, args);
1107 }
1108 
1109 
1111  Vector< Handle<Object> > args) {
1112  return NewError("MakeError", message, args);
1113 }
1114 
1115 
1117  Handle<JSArray> args) {
1118  const int kBufferSize = 1000;
1119  char buffer[kBufferSize];
1120  size_t space = kBufferSize;
1121  char* p = &buffer[0];
1122 
1123  Vector<char> v(buffer, kBufferSize);
1124  OS::StrNCpy(v, message, space);
1125  space -= Min(space, strlen(message));
1126  p = &buffer[kBufferSize] - space;
1127 
1128  for (unsigned i = 0; i < ARRAY_SIZE(args); i++) {
1129  if (space > 0) {
1130  *p++ = ' ';
1131  space--;
1132  if (space > 0) {
1134  Object::GetElementNoExceptionThrown(isolate(), args, i));
1135  SmartArrayPointer<char> arg = arg_str->ToCString();
1136  Vector<char> v2(p, static_cast<int>(space));
1137  OS::StrNCpy(v2, arg.get(), space);
1138  space -= Min(space, strlen(arg.get()));
1139  p = &buffer[kBufferSize] - space;
1140  }
1141  }
1142  }
1143  if (space > 0) {
1144  *p = '\0';
1145  } else {
1146  buffer[kBufferSize - 1] = '\0';
1147  }
1148  Handle<String> error_string = NewStringFromUtf8(CStrVector(buffer), TENURED);
1149  return error_string;
1150 }
1151 
1152 
1154  const char* message,
1155  Handle<JSArray> args) {
1156  Handle<String> make_str = InternalizeUtf8String(maker);
1157  Handle<Object> fun_obj(
1158  isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str),
1159  isolate());
1160  // If the builtins haven't been properly configured yet this error
1161  // constructor may not have been defined. Bail out.
1162  if (!fun_obj->IsJSFunction()) {
1163  return EmergencyNewError(message, args);
1164  }
1166  Handle<Object> message_obj = InternalizeUtf8String(message);
1167  Handle<Object> argv[] = { message_obj, args };
1168 
1169  // Invoke the JavaScript factory method. If an exception is thrown while
1170  // running the factory method, use the exception as the result.
1171  bool caught_exception;
1172  Handle<Object> result = Execution::TryCall(fun,
1173  isolate()->js_builtins_object(),
1174  ARRAY_SIZE(argv),
1175  argv,
1176  &caught_exception);
1177  return result;
1178 }
1179 
1180 
1182  return NewError("$Error", message);
1183 }
1184 
1185 
1186 Handle<Object> Factory::NewError(const char* constructor,
1188  Handle<String> constr = InternalizeUtf8String(constructor);
1190  JSFunction::cast(isolate()->js_builtins_object()->
1191  GetPropertyNoExceptionThrown(*constr)));
1192  Handle<Object> argv[] = { message };
1193 
1194  // Invoke the JavaScript factory method. If an exception is thrown while
1195  // running the factory method, use the exception as the result.
1196  bool caught_exception;
1197  Handle<Object> result = Execution::TryCall(fun,
1198  isolate()->js_builtins_object(),
1199  ARRAY_SIZE(argv),
1200  argv,
1201  &caught_exception);
1202  return result;
1203 }
1204 
1205 
1207  InstanceType type,
1208  int instance_size,
1210  bool force_initial_map) {
1211  // Allocate the function
1212  Handle<JSFunction> function = NewFunction(name, the_hole_value());
1213 
1214  // Set up the code pointer in both the shared function info and in
1215  // the function itself.
1216  function->shared()->set_code(*code);
1217  function->set_code(*code);
1218 
1219  if (force_initial_map ||
1220  type != JS_OBJECT_TYPE ||
1221  instance_size != JSObject::kHeaderSize) {
1222  Handle<Map> initial_map = NewMap(type, instance_size);
1223  Handle<JSObject> prototype = NewFunctionPrototype(function);
1224  initial_map->set_prototype(*prototype);
1225  function->set_initial_map(*initial_map);
1226  initial_map->set_constructor(*function);
1227  } else {
1228  ASSERT(!function->has_initial_map());
1229  ASSERT(!function->has_prototype());
1230  }
1231 
1232  return function;
1233 }
1234 
1235 
1237  InstanceType type,
1238  int instance_size,
1239  Handle<JSObject> prototype,
1241  bool force_initial_map) {
1242  // Allocate the function.
1243  Handle<JSFunction> function = NewFunction(name, prototype);
1244 
1245  // Set up the code pointer in both the shared function info and in
1246  // the function itself.
1247  function->shared()->set_code(*code);
1248  function->set_code(*code);
1249 
1250  if (force_initial_map ||
1251  type != JS_OBJECT_TYPE ||
1252  instance_size != JSObject::kHeaderSize) {
1253  Handle<Map> initial_map = NewMap(type,
1254  instance_size,
1256  function->set_initial_map(*initial_map);
1257  initial_map->set_constructor(*function);
1258  }
1259 
1260  JSFunction::SetPrototype(function, prototype);
1261  return function;
1262 }
1263 
1264 
1266  Handle<Code> code) {
1268  function->shared()->set_code(*code);
1269  function->set_code(*code);
1270  ASSERT(!function->has_initial_map());
1271  ASSERT(!function->has_prototype());
1272  return function;
1273 }
1274 
1275 
1278  isolate(),
1279  isolate()->heap()->AllocateScopeInfo(length),
1280  ScopeInfo);
1281 }
1282 
1283 
1285  CALL_HEAP_FUNCTION(isolate(),
1286  isolate()->heap()->AllocateExternal(value),
1287  JSObject);
1288 }
1289 
1290 
1293  Handle<Object> self_ref,
1294  bool immovable,
1295  bool crankshafted,
1296  int prologue_offset) {
1297  CALL_HEAP_FUNCTION(isolate(),
1298  isolate()->heap()->CreateCode(
1299  desc, flags, self_ref, immovable, crankshafted,
1300  prologue_offset),
1301  Code);
1302 }
1303 
1304 
1306  CALL_HEAP_FUNCTION(isolate(),
1307  isolate()->heap()->CopyCode(*code),
1308  Code);
1309 }
1310 
1311 
1313  CALL_HEAP_FUNCTION(isolate(),
1314  isolate()->heap()->CopyCode(*code, reloc_info),
1315  Code);
1316 }
1317 
1318 
1320  PretenureFlag pretenure) {
1321  JSFunction::EnsureHasInitialMap(constructor);
1323  isolate(),
1324  isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject);
1325 }
1326 
1327 
1329  Handle<JSFunction> constructor,
1330  Handle<AllocationSite> site) {
1331  JSFunction::EnsureHasInitialMap(constructor);
1333  isolate(),
1334  isolate()->heap()->AllocateJSObject(*constructor, NOT_TENURED, *site),
1335  JSObject);
1336 }
1337 
1338 
1340  Handle<ScopeInfo> scope_info) {
1342  isolate(),
1343  isolate()->heap()->AllocateJSModule(*context, *scope_info), JSModule);
1344 }
1345 
1346 
1347 // TODO(mstarzinger): Temporary wrapper until handlified.
1348 static Handle<NameDictionary> NameDictionaryAdd(Handle<NameDictionary> dict,
1350  Handle<Object> value,
1351  PropertyDetails details) {
1352  CALL_HEAP_FUNCTION(dict->GetIsolate(),
1353  dict->Add(*name, *value, details),
1354  NameDictionary);
1355 }
1356 
1357 
1358 static Handle<GlobalObject> NewGlobalObjectFromMap(Isolate* isolate,
1359  Handle<Map> map) {
1360  CALL_HEAP_FUNCTION(isolate,
1361  isolate->heap()->Allocate(*map, OLD_POINTER_SPACE),
1362  GlobalObject);
1363 }
1364 
1365 
1367  ASSERT(constructor->has_initial_map());
1368  Handle<Map> map(constructor->initial_map());
1369  ASSERT(map->is_dictionary_map());
1370 
1371  // Make sure no field properties are described in the initial map.
1372  // This guarantees us that normalizing the properties does not
1373  // require us to change property values to PropertyCells.
1374  ASSERT(map->NextFreePropertyIndex() == 0);
1375 
1376  // Make sure we don't have a ton of pre-allocated slots in the
1377  // global objects. They will be unused once we normalize the object.
1378  ASSERT(map->unused_property_fields() == 0);
1379  ASSERT(map->inobject_properties() == 0);
1380 
1381  // Initial size of the backing store to avoid resize of the storage during
1382  // bootstrapping. The size differs between the JS global object ad the
1383  // builtins object.
1384  int initial_size = map->instance_type() == JS_GLOBAL_OBJECT_TYPE ? 64 : 512;
1385 
1386  // Allocate a dictionary object for backing storage.
1387  int at_least_space_for = map->NumberOfOwnDescriptors() * 2 + initial_size;
1388  Handle<NameDictionary> dictionary = NewNameDictionary(at_least_space_for);
1389 
1390  // The global object might be created from an object template with accessors.
1391  // Fill these accessors into the dictionary.
1392  Handle<DescriptorArray> descs(map->instance_descriptors());
1393  for (int i = 0; i < map->NumberOfOwnDescriptors(); i++) {
1394  PropertyDetails details = descs->GetDetails(i);
1395  ASSERT(details.type() == CALLBACKS); // Only accessors are expected.
1396  PropertyDetails d = PropertyDetails(details.attributes(), CALLBACKS, i + 1);
1397  Handle<Name> name(descs->GetKey(i));
1398  Handle<Object> value(descs->GetCallbacksObject(i), isolate());
1399  Handle<PropertyCell> cell = NewPropertyCell(value);
1400  NameDictionaryAdd(dictionary, name, cell, d);
1401  }
1402 
1403  // Allocate the global object and initialize it with the backing store.
1404  Handle<GlobalObject> global = NewGlobalObjectFromMap(isolate(), map);
1405  isolate()->heap()->InitializeJSObjectFromMap(*global, *dictionary, *map);
1406 
1407  // Create a new map for the global object.
1408  Handle<Map> new_map = Map::CopyDropDescriptors(map);
1409  new_map->set_dictionary_map(true);
1410 
1411  // Set up the global object as a normalized object.
1412  global->set_map(*new_map);
1413  global->set_properties(*dictionary);
1414 
1415  // Make sure result is a global object with properties in dictionary.
1416  ASSERT(global->IsGlobalObject() && !global->HasFastProperties());
1417  return global;
1418 }
1419 
1420 
1422  Handle<Map> map,
1423  PretenureFlag pretenure,
1424  bool alloc_props,
1425  Handle<AllocationSite> allocation_site) {
1427  isolate(),
1428  isolate()->heap()->AllocateJSObjectFromMap(
1429  *map,
1430  pretenure,
1431  alloc_props,
1432  allocation_site.is_null() ? NULL : *allocation_site),
1433  JSObject);
1434 }
1435 
1436 
1438  int length,
1439  int capacity,
1441  PretenureFlag pretenure) {
1442  if (capacity != 0) {
1443  elements_kind = GetHoleyElementsKind(elements_kind);
1444  }
1445  CALL_HEAP_FUNCTION(isolate(),
1446  isolate()->heap()->AllocateJSArrayAndStorage(
1447  elements_kind,
1448  length,
1449  capacity,
1450  mode,
1451  pretenure),
1452  JSArray);
1453 }
1454 
1455 
1457  ElementsKind elements_kind,
1458  int length,
1459  PretenureFlag pretenure) {
1460  ASSERT(length <= elements->length());
1462  isolate(),
1463  isolate()->heap()->AllocateJSArrayWithElements(*elements,
1464  elements_kind,
1465  length,
1466  pretenure),
1467  JSArray);
1468 }
1469 
1470 
1472  int length,
1473  int capacity,
1475  CALL_HEAP_FUNCTION_VOID(isolate(),
1476  isolate()->heap()->AllocateJSArrayStorage(*array,
1477  length,
1478  capacity,
1479  mode));
1480 }
1481 
1482 
1484  Handle<JSFunction> function) {
1485  ASSERT(function->shared()->is_generator());
1487  Handle<Map> map(function->initial_map());
1488  ASSERT(map->instance_type() == JS_GENERATOR_OBJECT_TYPE);
1490  isolate(),
1491  isolate()->heap()->AllocateJSObjectFromMap(*map),
1493 }
1494 
1495 
1497  Handle<JSFunction> array_buffer_fun(
1498  isolate()->context()->native_context()->array_buffer_fun());
1500  isolate(),
1501  isolate()->heap()->AllocateJSObject(*array_buffer_fun),
1502  JSArrayBuffer);
1503 }
1504 
1505 
1507  Handle<JSFunction> data_view_fun(
1508  isolate()->context()->native_context()->data_view_fun());
1510  isolate(),
1511  isolate()->heap()->AllocateJSObject(*data_view_fun),
1512  JSDataView);
1513 }
1514 
1515 
1516 static JSFunction* GetTypedArrayFun(ExternalArrayType type,
1517  Isolate* isolate) {
1518  Context* native_context = isolate->context()->native_context();
1519  switch (type) {
1520 #define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size) \
1521  case kExternal##Type##Array: \
1522  return native_context->type##_array_fun();
1523 
1525 #undef TYPED_ARRAY_FUN
1526 
1527  default:
1528  UNREACHABLE();
1529  return NULL;
1530  }
1531 }
1532 
1533 
1535  Handle<JSFunction> typed_array_fun_handle(GetTypedArrayFun(type, isolate()));
1536 
1538  isolate(),
1539  isolate()->heap()->AllocateJSObject(*typed_array_fun_handle),
1540  JSTypedArray);
1541 }
1542 
1543 
1545  Handle<Object> prototype) {
1547  isolate(),
1548  isolate()->heap()->AllocateJSProxy(*handler, *prototype),
1549  JSProxy);
1550 }
1551 
1552 
1555  isolate(),
1556  isolate()->heap()->ReinitializeJSReceiver(
1558 }
1559 
1560 
1563  isolate(),
1564  isolate()->heap()->ReinitializeJSReceiver(
1565  *object, JS_FUNCTION_TYPE, JSFunction::kSize));
1566 }
1567 
1568 
1570  Handle<String> name,
1571  int number_of_literals,
1572  bool is_generator,
1574  Handle<ScopeInfo> scope_info) {
1576  shared->set_code(*code);
1577  shared->set_scope_info(*scope_info);
1578  int literals_array_size = number_of_literals;
1579  // If the function contains object, regexp or array literals,
1580  // allocate extra space for a literals array prefix containing the
1581  // context.
1582  if (number_of_literals > 0) {
1583  literals_array_size += JSFunction::kLiteralsPrefixSize;
1584  }
1585  shared->set_num_literals(literals_array_size);
1586  if (is_generator) {
1587  shared->set_instance_class_name(isolate()->heap()->Generator_string());
1588  shared->DisableOptimization(kGenerator);
1589  }
1590  return shared;
1591 }
1592 
1593 
1595  Handle<String> type,
1596  Handle<JSArray> arguments,
1597  int start_position,
1598  int end_position,
1599  Handle<Object> script,
1600  Handle<Object> stack_frames) {
1601  CALL_HEAP_FUNCTION(isolate(),
1602  isolate()->heap()->AllocateJSMessageObject(*type,
1603  *arguments,
1604  start_position,
1605  end_position,
1606  *script,
1607  *stack_frames),
1608  JSMessageObject);
1609 }
1610 
1611 
1613  CALL_HEAP_FUNCTION(isolate(),
1614  isolate()->heap()->AllocateSharedFunctionInfo(*name),
1616 }
1617 
1618 
1620  CALL_HEAP_FUNCTION(isolate(),
1621  isolate()->heap()->NumberToString(*number), String);
1622 }
1623 
1624 
1626  CALL_HEAP_FUNCTION(isolate(),
1627  isolate()->heap()->Uint32ToString(value), String);
1628 }
1629 
1630 
1632  Handle<SeededNumberDictionary> dictionary,
1633  uint32_t key,
1634  Handle<Object> value) {
1635  CALL_HEAP_FUNCTION(isolate(),
1636  dictionary->AtNumberPut(key, *value),
1638 }
1639 
1640 
1643  uint32_t key,
1644  Handle<Object> value) {
1645  CALL_HEAP_FUNCTION(isolate(),
1646  dictionary->AtNumberPut(key, *value),
1648 }
1649 
1650 
1651 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name,
1652  Handle<Object> prototype) {
1653  Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
1655  isolate(),
1656  isolate()->heap()->AllocateFunction(*isolate()->sloppy_function_map(),
1657  *function_share,
1658  *prototype),
1659  JSFunction);
1660 }
1661 
1662 
1664  Handle<Object> prototype) {
1665  Handle<JSFunction> fun = NewFunctionHelper(name, prototype);
1666  fun->set_context(isolate()->context()->native_context());
1667  return fun;
1668 }
1669 
1670 
1671 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
1672  Handle<String> name,
1673  StrictMode strict_mode) {
1674  Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
1675  Handle<Map> map = strict_mode == SLOPPY
1676  ? isolate()->sloppy_function_without_prototype_map()
1677  : isolate()->strict_function_without_prototype_map();
1678  CALL_HEAP_FUNCTION(isolate(),
1679  isolate()->heap()->AllocateFunction(
1680  *map,
1681  *function_share,
1682  *the_hole_value()),
1683  JSFunction);
1684 }
1685 
1686 
1688  Handle<String> name,
1689  StrictMode strict_mode) {
1690  Handle<JSFunction> fun = NewFunctionWithoutPrototypeHelper(name, strict_mode);
1691  fun->set_context(isolate()->context()->native_context());
1692  return fun;
1693 }
1694 
1695 
1697  CALL_HEAP_FUNCTION(isolate(), object->ToObject(isolate()), Object);
1698 }
1699 
1700 
1702  Handle<Context> native_context) {
1703  CALL_HEAP_FUNCTION(isolate(), object->ToObject(*native_context), Object);
1704 }
1705 
1706 
1707 #ifdef ENABLE_DEBUGGER_SUPPORT
1708 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
1709  // Get the original code of the function.
1710  Handle<Code> code(shared->code());
1711 
1712  // Create a copy of the code before allocating the debug info object to avoid
1713  // allocation while setting up the debug info object.
1714  Handle<Code> original_code(*Factory::CopyCode(code));
1715 
1716  // Allocate initial fixed array for active break points before allocating the
1717  // debug info object to avoid allocation while setting up the debug info
1718  // object.
1719  Handle<FixedArray> break_points(
1720  NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction));
1721 
1722  // Create and set up the debug info object. Debug info contains function, a
1723  // copy of the original code, the executing code and initial fixed array for
1724  // active break points.
1725  Handle<DebugInfo> debug_info =
1727  debug_info->set_shared(*shared);
1728  debug_info->set_original_code(*original_code);
1729  debug_info->set_code(*code);
1730  debug_info->set_break_points(*break_points);
1731 
1732  // Link debug info to function.
1733  shared->set_debug_info(*debug_info);
1734 
1735  return debug_info;
1736 }
1737 #endif
1738 
1739 
1741  int length) {
1743  isolate(),
1744  isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject);
1745 }
1746 
1747 
1750  Handle<Code> code = isolate()->builtins()->HandleApiCall();
1751  Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi();
1752 
1753  int internal_field_count = 0;
1754  if (!obj->instance_template()->IsUndefined()) {
1755  Handle<ObjectTemplateInfo> instance_template =
1757  ObjectTemplateInfo::cast(obj->instance_template()));
1758  internal_field_count =
1759  Smi::cast(instance_template->internal_field_count())->value();
1760  }
1761 
1762  // TODO(svenpanne) Kill ApiInstanceType and refactor things by generalizing
1763  // JSObject::GetHeaderSize.
1764  int instance_size = kPointerSize * internal_field_count;
1765  InstanceType type;
1766  switch (instance_type) {
1767  case JavaScriptObject:
1768  type = JS_OBJECT_TYPE;
1769  instance_size += JSObject::kHeaderSize;
1770  break;
1771  case InnerGlobalObject:
1772  type = JS_GLOBAL_OBJECT_TYPE;
1773  instance_size += JSGlobalObject::kSize;
1774  break;
1775  case OuterGlobalObject:
1776  type = JS_GLOBAL_PROXY_TYPE;
1777  instance_size += JSGlobalProxy::kSize;
1778  break;
1779  default:
1780  UNREACHABLE();
1781  type = JS_OBJECT_TYPE; // Keep the compiler happy.
1782  break;
1783  }
1784 
1785  Handle<JSFunction> result =
1786  NewFunction(Factory::empty_string(),
1787  type,
1788  instance_size,
1789  code,
1790  true);
1791 
1792  // Set length.
1793  result->shared()->set_length(obj->length());
1794 
1795  // Set class name.
1796  Handle<Object> class_name = Handle<Object>(obj->class_name(), isolate());
1797  if (class_name->IsString()) {
1798  result->shared()->set_instance_class_name(*class_name);
1799  result->shared()->set_name(*class_name);
1800  }
1801 
1802  Handle<Map> map = Handle<Map>(result->initial_map());
1803 
1804  // Mark as undetectable if needed.
1805  if (obj->undetectable()) {
1806  map->set_is_undetectable();
1807  }
1808 
1809  // Mark as hidden for the __proto__ accessor if needed.
1810  if (obj->hidden_prototype()) {
1811  map->set_is_hidden_prototype();
1812  }
1813 
1814  // Mark as needs_access_check if needed.
1815  if (obj->needs_access_check()) {
1816  map->set_is_access_check_needed(true);
1817  }
1818 
1819  // Set interceptor information in the map.
1820  if (!obj->named_property_handler()->IsUndefined()) {
1821  map->set_has_named_interceptor();
1822  }
1823  if (!obj->indexed_property_handler()->IsUndefined()) {
1824  map->set_has_indexed_interceptor();
1825  }
1826 
1827  // Set instance call-as-function information in the map.
1828  if (!obj->instance_call_handler()->IsUndefined()) {
1829  map->set_has_instance_call_handler();
1830  }
1831 
1832  result->shared()->set_function_data(*obj);
1833  result->shared()->set_construct_stub(*construct_stub);
1834  result->shared()->DontAdaptArguments();
1835 
1836  // Recursively copy parent instance templates' accessors,
1837  // 'data' may be modified.
1838  int max_number_of_additional_properties = 0;
1839  int max_number_of_static_properties = 0;
1841  while (true) {
1842  if (!info->instance_template()->IsUndefined()) {
1843  Object* props =
1845  info->instance_template())->property_accessors();
1846  if (!props->IsUndefined()) {
1847  Handle<Object> props_handle(props, isolate());
1848  NeanderArray props_array(props_handle);
1849  max_number_of_additional_properties += props_array.length();
1850  }
1851  }
1852  if (!info->property_accessors()->IsUndefined()) {
1853  Object* props = info->property_accessors();
1854  if (!props->IsUndefined()) {
1855  Handle<Object> props_handle(props, isolate());
1856  NeanderArray props_array(props_handle);
1857  max_number_of_static_properties += props_array.length();
1858  }
1859  }
1860  Object* parent = info->parent_template();
1861  if (parent->IsUndefined()) break;
1862  info = FunctionTemplateInfo::cast(parent);
1863  }
1864 
1865  Map::EnsureDescriptorSlack(map, max_number_of_additional_properties);
1866 
1867  // Use a temporary FixedArray to acculumate static accessors
1868  int valid_descriptors = 0;
1869  Handle<FixedArray> array;
1870  if (max_number_of_static_properties > 0) {
1871  array = NewFixedArray(max_number_of_static_properties);
1872  }
1873 
1874  while (true) {
1875  // Install instance descriptors
1876  if (!obj->instance_template()->IsUndefined()) {
1877  Handle<ObjectTemplateInfo> instance =
1879  ObjectTemplateInfo::cast(obj->instance_template()), isolate());
1880  Handle<Object> props = Handle<Object>(instance->property_accessors(),
1881  isolate());
1882  if (!props->IsUndefined()) {
1883  Map::AppendCallbackDescriptors(map, props);
1884  }
1885  }
1886  // Accumulate static accessors
1887  if (!obj->property_accessors()->IsUndefined()) {
1888  Handle<Object> props = Handle<Object>(obj->property_accessors(),
1889  isolate());
1890  valid_descriptors =
1891  AccessorInfo::AppendUnique(props, array, valid_descriptors);
1892  }
1893  // Climb parent chain
1894  Handle<Object> parent = Handle<Object>(obj->parent_template(), isolate());
1895  if (parent->IsUndefined()) break;
1896  obj = Handle<FunctionTemplateInfo>::cast(parent);
1897  }
1898 
1899  // Install accumulated static accessors
1900  for (int i = 0; i < valid_descriptors; i++) {
1901  Handle<AccessorInfo> accessor(AccessorInfo::cast(array->get(i)));
1902  JSObject::SetAccessor(result, accessor);
1903  }
1904 
1905  ASSERT(result->shared()->IsApiFunction());
1906  return result;
1907 }
1908 
1909 
1910 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) {
1911  CALL_HEAP_FUNCTION(isolate(),
1912  MapCache::Allocate(isolate()->heap(),
1913  at_least_space_for),
1914  MapCache);
1915 }
1916 
1917 
1918 MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context,
1919  FixedArray* keys,
1920  Map* map) {
1921  Object* result;
1922  { MaybeObject* maybe_result =
1923  MapCache::cast(context->map_cache())->Put(keys, map);
1924  if (!maybe_result->ToObject(&result)) return maybe_result;
1925  }
1926  context->set_map_cache(MapCache::cast(result));
1927  return result;
1928 }
1929 
1930 
1931 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context,
1932  Handle<FixedArray> keys,
1933  Handle<Map> map) {
1934  CALL_HEAP_FUNCTION(isolate(),
1935  UpdateMapCacheWith(*context, *keys, *map), MapCache);
1936 }
1937 
1938 
1940  Handle<FixedArray> keys) {
1941  if (context->map_cache()->IsUndefined()) {
1942  // Allocate the new map cache for the native context.
1943  Handle<MapCache> new_cache = NewMapCache(24);
1944  context->set_map_cache(*new_cache);
1945  }
1946  // Check to see whether there is a matching element in the cache.
1947  Handle<MapCache> cache =
1948  Handle<MapCache>(MapCache::cast(context->map_cache()));
1949  Handle<Object> result = Handle<Object>(cache->Lookup(*keys), isolate());
1950  if (result->IsMap()) return Handle<Map>::cast(result);
1951  // Create a new map and add it to the cache.
1952  Handle<Map> map =
1953  CopyMap(Handle<Map>(context->object_function()->initial_map()),
1954  keys->length());
1955  AddToMapCache(context, keys, map);
1956  return Handle<Map>(map);
1957 }
1958 
1959 
1961  JSRegExp::Type type,
1962  Handle<String> source,
1964  Handle<Object> data) {
1966 
1967  store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
1968  store->set(JSRegExp::kSourceIndex, *source);
1969  store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
1970  store->set(JSRegExp::kAtomPatternIndex, *data);
1971  regexp->set_data(*store);
1972 }
1973 
1975  JSRegExp::Type type,
1976  Handle<String> source,
1978  int capture_count) {
1981  store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
1982  store->set(JSRegExp::kSourceIndex, *source);
1983  store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
1984  store->set(JSRegExp::kIrregexpASCIICodeIndex, uninitialized);
1985  store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
1986  store->set(JSRegExp::kIrregexpASCIICodeSavedIndex, uninitialized);
1987  store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
1990  Smi::FromInt(capture_count));
1991  regexp->set_data(*store);
1992 }
1993 
1994 
1995 
1997  Handle<JSObject> instance,
1998  bool* pending_exception) {
1999  // Configure the instance by adding the properties specified by the
2000  // instance template.
2001  Handle<Object> instance_template(desc->instance_template(), isolate());
2002  if (!instance_template->IsUndefined()) {
2003  Execution::ConfigureInstance(isolate(),
2004  instance,
2005  instance_template,
2006  pending_exception);
2007  } else {
2008  *pending_exception = false;
2009  }
2010 }
2011 
2012 
2014  Heap* h = isolate()->heap();
2015  if (name->Equals(h->undefined_string())) return undefined_value();
2016  if (name->Equals(h->nan_string())) return nan_value();
2017  if (name->Equals(h->infinity_string())) return infinity_value();
2018  return Handle<Object>::null();
2019 }
2020 
2021 
2023  return value ? true_value() : false_value();
2024 }
2025 
2026 
2027 } } // namespace v8::internal
byte * Address
Definition: globals.h:186
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter NULL
Definition: flags.cc:269
Handle< Object > NewEvalError(const char *message, Vector< Handle< Object > > args)
Definition: factory.cc:1104
static void SetValueInferType(Handle< PropertyCell > cell, Handle< Object > value)
Definition: objects.cc:16416
Handle< ObjectHashTable > NewObjectHashTable(int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY)
Definition: factory.cc:145
Handle< JSObject > NewFunctionPrototype(Handle< JSFunction > function)
Definition: factory.cc:819
static MUST_USE_RESULT MaybeObject * Allocate(Isolate *isolate, int number_of_deopt_points, PretenureFlag pretenure)
Definition: objects.cc:8177
Handle< FixedArray > CopyAndTenureFixedCOWArray(Handle< FixedArray > array)
Definition: factory.cc:891
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1319
Handle< String > NewExternalStringFromAscii(const ExternalAsciiString::Resource *resource)
Definition: factory.cc:554
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown 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
static const int kIrregexpMaxRegisterCountIndex
Definition: objects.h:7954
Handle< Context > NewModuleContext(Handle< ScopeInfo > scope_info)
Definition: factory.cc:605
static void EnsureHasInitialMap(Handle< JSFunction > function)
Definition: objects.cc:9792
Handle< JSFunction > NewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Context > context, PretenureFlag pretenure=TENURED)
Definition: factory.cc:944
Handle< String > ConcatStringContent(Handle< StringType > result, Handle< String > first, Handle< String > second)
Definition: factory.cc:350
static Handle< Object > TryCall(Handle< JSFunction > func, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *caught_exception)
Definition: execution.cc:199
MUST_USE_RESULT MaybeObject * CopyDropDescriptors()
Definition: objects.cc:6717
Handle< FixedTypedArrayBase > NewFixedTypedArray(int length, ExternalArrayType array_type, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:762
Handle< String > InternalizeString(Handle< String > str)
Definition: factory.cc:225
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf map
Definition: flags.cc:350
static int FunctionMapIndex(StrictMode strict_mode, bool is_generator)
Definition: contexts.h:502
Handle< PropertyCell > NewPropertyCell(Handle< Object > value)
Definition: factory.cc:793
static int AppendUnique(Handle< Object > descriptors, Handle< FixedArray > array, int valid_descriptors)
Definition: objects.cc:3184
static MapCache * cast(Object *obj)
static void SetPrototype(Handle< JSFunction > function, Handle< Object > value)
Definition: objects.cc:9745
Handle< DescriptorArray > NewDescriptorArray(int number_of_descriptors, int slack=0)
Definition: factory.cc:169
void NewJSArrayStorage(Handle< JSArray > array, int length, int capacity, ArrayStorageAllocationMode mode=DONT_INITIALIZE_ARRAY_ELEMENTS)
Definition: factory.cc:1471
Handle< SlicedString > NewRawSlicedString(String::Encoding encoding)
Definition: factory.cc:466
Handle< FixedArray > NewFixedArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:62
static Smi * FromInt(int value)
Definition: objects-inl.h:1209
Handle< Script > NewScript(Handle< String > source)
Definition: factory.cc:699
Handle< JSFunction > BaseNewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Map > function_map, PretenureFlag pretenure)
Definition: factory.cc:921
static ObjectTemplateInfo * cast(Object *obj)
Handle< String > NewStringFromOneByte(Vector< const uint8_t > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:265
static Handle< T > cast(Handle< S > that)
Definition: handles.h:75
Handle< JSDataView > NewJSDataView()
Definition: factory.cc:1506
Handle< Context > NewCatchContext(Handle< JSFunction > function, Handle< Context > previous, Handle< String > name, Handle< Object > thrown_object)
Definition: factory.cc:622
static const int kIrregexpDataSize
Definition: objects.h:7958
static Map * cast(Object *obj)
static MUST_USE_RESULT MaybeObject * Allocate(Isolate *isolate, int deopt_entry_count, PretenureFlag pretenure)
Definition: objects.cc:8168
Handle< DeclaredAccessorDescriptor > NewDeclaredAccessorDescriptor()
Definition: factory.cc:675
kSerializedDataOffset Object
Definition: objects-inl.h:5016
Handle< Symbol > NewPrivateSymbol()
Definition: factory.cc:580
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage message
Definition: flags.cc:665
Builtins * builtins()
Definition: isolate.h:948
Handle< String > EmergencyNewError(const char *message, Handle< JSArray > args)
Definition: factory.cc:1116
int int32_t
Definition: unicode.cc:47
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind, int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1456
Handle< Context > NewFunctionContext(int length, Handle< JSFunction > function)
Definition: factory.cc:613
Handle< String > NewFlatConcatString(Handle< String > first, Handle< String > second)
Definition: factory.cc:453
static const int kSize
Definition: objects.h:7568
int length()
Definition: api.cc:775
bool marked_for_deoptimization()
Definition: objects-inl.h:4553
static Handle< Object > GetElementNoExceptionThrown(Isolate *isolate, Handle< Object > object, uint32_t index)
Definition: objects-inl.h:1071
uint32_t Flags
Definition: objects.h:5184
static const int kIrregexpASCIICodeIndex
Definition: objects.h:7939
static const int kIrregexpUC16CodeIndex
Definition: objects.h:7943
#define ASSERT(condition)
Definition: checks.h:329
static const int kIrregexpASCIICodeSavedIndex
Definition: objects.h:7947
static void AppendCallbackDescriptors(Handle< Map > map, Handle< Object > descriptors)
Definition: objects.cc:3173
static Handle< Object > SetLocalPropertyIgnoreAttributes(Handle< JSObject > object, Handle< Name > key, Handle< Object > value, PropertyAttributes attributes, ValueType value_type=OPTIMAL_REPRESENTATION, StoreMode mode=ALLOW_AS_CONSTANT, ExtensibilityCheck extensibility_check=PERFORM_EXTENSIBILITY_CHECK)
Definition: objects.cc:4141
Handle< JSFunction > NewFunctionWithPrototype(Handle< String > name, InstanceType type, int instance_size, Handle< JSObject > prototype, Handle< Code > code, bool force_initial_map)
Definition: factory.cc:1236
const int kPointerSizeLog2
Definition: globals.h:281
ExternalArrayType
Definition: v8.h:2113
unsigned short uint16_t
Definition: unicode.cc:46
#define CALL_HEAP_FUNCTION_VOID(ISOLATE, FUNCTION_CALL)
Definition: heap-inl.h:686
static const uint32_t kMaxOneByteCharCodeU
Definition: objects.h:8915
Handle< Object > NewRangeError(const char *message, Vector< Handle< Object > > args)
Definition: factory.cc:1050
Handle< JSGeneratorObject > NewJSGeneratorObject(Handle< JSFunction > function)
Definition: factory.cc:1483
static const int kSourceIndex
Definition: objects.h:7926
static Handle< Object > SetAccessor(Handle< JSObject > object, Handle< AccessorInfo > info)
Definition: objects.cc:6482
int global_ic_age()
Definition: heap.h:1862
static MUST_USE_RESULT MaybeObject * Allocate(Isolate *isolate, int number_of_descriptors, int slack=0)
Definition: objects.cc:7922
Handle< Object > NewNumber(double value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:998
Handle< JSObject > NewArgumentsObject(Handle< Object > callee, int length)
Definition: factory.cc:1740
Handle< Code > CopyCode(Handle< Code > code)
Definition: factory.cc:1305
Handle< String > NumberToString(Handle< Object > number)
Definition: factory.cc:1619
MUST_USE_RESULT MaybeObject * Copy()
Definition: objects.cc:6990
ArrayStorageAllocationMode
Definition: heap.h:554
kSerializedDataOffset kPrototypeTemplateOffset kIndexedPropertyHandlerOffset kInstanceCallHandlerOffset internal_field_count
Definition: objects-inl.h:5034
static Smi * cast(Object *object)
Handle< String > FlattenGetString(Handle< String > string)
Definition: handles.cc:156
Handle< SharedFunctionInfo > NewSharedFunctionInfo(Handle< String > name, int number_of_literals, bool is_generator, Handle< Code > code, Handle< ScopeInfo > scope_info)
Definition: factory.cc:1569
Handle< SeededNumberDictionary > DictionaryAtNumberPut(Handle< SeededNumberDictionary >, uint32_t key, Handle< Object > value)
Definition: factory.cc:1631
static const int kMinLength
Definition: objects.h:9170
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:273
void ConfigureInstance(Handle< FunctionTemplateInfo > desc, Handle< JSObject > instance, bool *pending_exception)
Definition: factory.cc:1996
static const int kLiteralNativeContextIndex
Definition: objects.h:7531
#define UNREACHABLE()
Definition: checks.h:52
Handle< JSObject > NewJSObjectFromMap(Handle< Map > map, PretenureFlag pretenure=NOT_TENURED, bool allocate_properties=true, Handle< AllocationSite > allocation_site=Handle< AllocationSite >::null())
Definition: factory.cc:1421
Handle< Map > CopyWithPreallocatedFieldDescriptors(Handle< Map > map)
Definition: factory.cc:849
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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_string(expose_natives_as
Handle< Map > CopyMap(Handle< Map > map, int extra_inobject_props)
Definition: factory.cc:855
static const int kIrregexpUC16CodeSavedIndex
Definition: objects.h:7950
Handle< JSFunction > NewFunction(Handle< String > name, Handle< Object > prototype)
Definition: factory.cc:1663
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object size
Definition: flags.cc:211
Handle< Object > NewReferenceError(const char *message, Vector< Handle< Object > > args)
Definition: factory.cc:1072
Handle< SeqTwoByteString > NewRawTwoByteString(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:300
Handle< JSFunction > NewFunctionWithoutPrototype(Handle< String > name, StrictMode strict_mode)
Definition: factory.cc:1687
Handle< PropertyCell > NewPropertyCellWithHole()
Definition: factory.cc:785
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))
#define MUST_USE_RESULT
Definition: globals.h:381
Handle< JSObject > NewNeanderObject()
Definition: factory.cc:1030
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in only print modified registers Don t break for ASM_UNIMPLEMENTED_BREAK macros print stack trace when an illegal exception is thrown randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot testing_bool_flag testing_int_flag string flag tmp file in which to serialize heap Print the time it takes to lazily compile hydrogen code stubs concurrent_recompilation concurrent_sweeping Print usage including flags
Definition: flags.cc:665
Handle< ScopeInfo > NewScopeInfo(int length)
Definition: factory.cc:1276
Context * native_context()
Definition: contexts.cc:67
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1278
#define CALL_HEAP_FUNCTION(ISOLATE, FUNCTION_CALL, TYPE)
Definition: heap-inl.h:679
void SetRegExpAtomData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, Handle< Object > match_pattern)
Definition: factory.cc:1960
const int kPointerSize
Definition: globals.h:268
Handle< Object > NewTypeError(const char *message, Vector< Handle< Object > > args)
Definition: factory.cc:1039
Handle< String > InternalizeStringWithKey(StringTableKey *key)
Definition: factory.cc:252
Handle< WeakHashTable > NewWeakHashTable(int at_least_space_for)
Definition: factory.cc:157
Handle< Object > ToBoolean(bool value)
Definition: factory.cc:2022
static const int kMaxInstanceSize
Definition: objects.h:2748
Handle< ExecutableAccessorInfo > NewExecutableAccessorInfo()
Definition: factory.cc:690
Handle< JSArrayBuffer > NewJSArrayBuffer()
Definition: factory.cc:1496
Handle< Object > GlobalConstantFor(Handle< String > name)
Definition: factory.cc:2013
static void ConfigureInstance(Isolate *isolate, Handle< Object > instance, Handle< Object > data, bool *exc)
Definition: execution.cc:866
Handle< JSTypedArray > NewJSTypedArray(ExternalArrayType type)
Definition: factory.cc:1534
Handle< HeapNumber > NewHeapNumber(double value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1022
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static MUST_USE_RESULT MaybeObject * Allocate(Heap *heap, int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
Handle< JSObject > NewExternal(void *value)
Definition: factory.cc:1284
Handle< String > NewStringFromTwoByte(Vector< const uc16 > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:282
Handle< ExternalArray > NewExternalArray(int length, ExternalArrayType array_type, void *external_pointer, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:747
Handle< ByteArray > NewByteArray(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:738
static FunctionTemplateInfo * cast(Object *obj)
Handle< FixedDoubleArray > NewFixedDoubleArray(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:80
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:53
static void EnsureDescriptorSlack(Handle< Map > map, int slack)
Definition: objects.cc:3083
Handle< AliasedArgumentsEntry > NewAliasedArgumentsEntry(int aliased_context_slot)
Definition: factory.cc:666
Handle< AllocationSite > NewAllocationSite()
Definition: factory.cc:801
Handle< GlobalObject > NewGlobalObject(Handle< JSFunction > constructor)
Definition: factory.cc:1366
static const int kMinLength
Definition: objects.h:9214
Handle< Cell > NewCell(Handle< Object > value)
Definition: factory.cc:776
Handle< DeclaredAccessorInfo > NewDeclaredAccessorInfo()
Definition: factory.cc:681
bool IsPowerOf2(T x)
Definition: utils.h:51
static const int kIrregexpCaptureCountIndex
Definition: objects.h:7956
Handle< Object > ToObject(Handle< Object > object)
Definition: factory.cc:1696
V8_INLINE bool IsUndefined() const
Definition: v8.h:6229
Handle< Context > NewBlockContext(Handle< JSFunction > function, Handle< Context > previous, Handle< ScopeInfo > scope_info)
Definition: factory.cc:646
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
Definition: factory.cc:886
static BailoutId None()
Definition: utils.h:1164
Vector< const char > CStrVector(const char *data)
Definition: utils.h:574
i::Code * CreateCode(LocalContext *env)
Context * context()
Definition: isolate.h:557
V8_INLINE bool IsString() const
Definition: v8.h:6265
Handle< Object > NewNumberFromInt(int32_t value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1006
Handle< String > NewProperSubString(Handle< String > str, int begin, int end)
Definition: factory.cc:475
Handle< DeoptimizationInputData > NewDeoptimizationInputData(int deopt_entry_count, PretenureFlag pretenure)
Definition: factory.cc:179
Handle< Box > NewBox(Handle< Object > value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:45
Handle< JSProxy > NewJSProxy(Handle< Object > handler, Handle< Object > prototype)
Definition: factory.cc:1544
#define TYPED_ARRAY_FUN(Type, type, TYPE, ctype, size)
Handle< DeoptimizationOutputData > NewDeoptimizationOutputData(int deopt_entry_count, PretenureFlag pretenure)
Definition: factory.cc:191
Handle< Object > NewSyntaxError(const char *message, Handle< JSArray > args)
Definition: factory.cc:1061
Handle< String > InternalizeTwoByteString(Vector< const uc16 > str)
Definition: factory.cc:245
static const int kAtomDataSize
Definition: objects.h:7934
static void WriteToFlat(String *source, sinkchar *sink, int from, int to)
Definition: objects.cc:8635
static MUST_USE_RESULT MaybeObject * Allocate(Heap *heap, int at_least_space_for, MinimumCapacity capacity_option=USE_DEFAULT_MINIMUM_CAPACITY, PretenureFlag pretenure=NOT_TENURED)
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
Definition: factory.cc:563
Handle< String > InternalizeOneByteString(Vector< const uint8_t > str)
Definition: factory.cc:232
Handle< TypeFeedbackInfo > NewTypeFeedbackInfo()
Definition: factory.cc:210
bool is_null() const
Definition: handles.h:81
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:103
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function info
Definition: flags.cc:317
Handle< JSFunction > CreateApiFunction(Handle< FunctionTemplateInfo > data, ApiInstanceType type=JavaScriptObject)
Definition: factory.cc:1748
Handle< String > LookupSingleCharacterStringFromCode(Isolate *isolate, uint32_t index)
Definition: handles.cc:212
static const int kAtomPatternIndex
Definition: objects.h:7932
Handle< ConstantPoolArray > NewConstantPoolArray(int number_of_int64_entries, int number_of_code_ptr_entries, int number_of_heap_ptr_entries, int number_of_int32_entries)
Definition: factory.cc:90
ElementsKind GetInitialFastElementsKind()
void BecomeJSObject(Handle< JSReceiver > object)
Definition: factory.cc:1553
uint16_t uc16
Definition: globals.h:309
Handle< Symbol > NewSymbol()
Definition: factory.cc:572
Handle< NameDictionary > NewNameDictionary(int at_least_space_for)
Definition: factory.cc:107
Handle< String > InternalizeUtf8String(Vector< const char > str)
Definition: factory.cc:218
bool DebuggerHasBreakPoints()
Definition: isolate-inl.h:66
Handle< JSModule > NewJSModule(Handle< Context > context, Handle< ScopeInfo > scope_info)
Definition: factory.cc:1339
Handle< Code > NewCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false, bool crankshafted=false, int prologue_offset=Code::kPrologueOffsetNotSet)
Definition: factory.cc:1291
#define TYPED_ARRAYS(V)
Definition: objects.h:4663
static Handle< T > null()
Definition: handles.h:80
Handle< SeqOneByteString > NewRawOneByteString(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:291
Handle< Context > NewGlobalContext(Handle< JSFunction > function, Handle< ScopeInfo > scope_info)
Definition: factory.cc:596
Handle< Map > ObjectLiteralMapFromCache(Handle< Context > context, Handle< FixedArray > keys)
Definition: factory.cc:1939
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:726
Handle< String > Uint32ToString(uint32_t value)
Definition: factory.cc:1625
static void StrNCpy(Vector< char > dest, const char *src, size_t n)
Handle< ConstantPoolArray > CopyConstantPoolArray(Handle< ConstantPoolArray > array)
Definition: factory.cc:915
static AccessorInfo * cast(Object *obj)
static const int kHeaderSize
Definition: objects.h:2757
Handle< ConsString > NewRawConsString(String::Encoding encoding)
Definition: factory.cc:361
Handle< FixedDoubleArray > CopyFixedDoubleArray(Handle< FixedDoubleArray > array)
Definition: factory.cc:909
static const int kFlagsIndex
Definition: objects.h:7927
Object * get(int index)
Definition: objects-inl.h:2127
static VisitorId GetVisitorId(int instance_type, int instance_size)
static const int kSize
Definition: objects.h:7527
Handle< Context > NewWithContext(Handle< JSFunction > function, Handle< Context > previous, Handle< JSObject > extension)
Definition: factory.cc:636
Local< Object > ToObject() const
Definition: api.cc:2570
HeapObject * obj
Handle< Struct > NewStruct(InstanceType type)
Definition: factory.cc:658
static const int kTagIndex
Definition: objects.h:7925
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric literals(0o77, 0b11)") DEFINE_bool(harmony_strings
Handle< JSMessageObject > NewJSMessageObject(Handle< String > type, Handle< JSArray > arguments, int start_position, int end_position, Handle< Object > script, Handle< Object > stack_frames)
Definition: factory.cc:1594
Handle< String > NewConsString(Handle< String > left, Handle< String > right)
Definition: factory.cc:370
static const int kMaxLength
Definition: objects.h:8922
Handle< Object > NewError(const char *maker, const char *message, Handle< JSArray > args)
Definition: factory.cc:1153
void SetRegExpIrregexpData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, int capture_count)
Definition: factory.cc:1974
Handle< AccessorPair > NewAccessorPair()
Definition: factory.cc:203
Handle< Context > NewNativeContext()
Definition: factory.cc:588
Handle< JSObject > NewJSObjectWithMemento(Handle< JSFunction > constructor, Handle< AllocationSite > site)
Definition: factory.cc:1328
Handle< FixedArray > NewUninitializedFixedArray(int size)
Definition: factory.cc:72
T Min(T a, T b)
Definition: utils.h:234
static const int kSize
Definition: objects.h:7638
static const int kEmptyHashField
Definition: objects.h:8678
Handle< FixedArray > CopySizeFixedArray(Handle< FixedArray > array, int new_length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:900
static const int kUninitializedValue
Definition: objects.h:7979
Handle< Map > NewMap(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
Definition: factory.cc:809
static const int kMaxValue
Definition: objects.h:1681
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV 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 expose natives in global object expose freeBuffer extension expose gc extension under the specified name expose externalize string extension number of stack frames to capture disable builtin natives files print name of functions for which code is generated use random jit cookie to mask large constants trace lazy optimization use adaptive optimizations always try to OSR functions trace optimize function deoptimization minimum length for automatic enable preparsing maximum number of optimization attempts before giving up cache prototype transitions trace debugging JSON request response trace out of bounds accesses to external arrays trace_js_array_abuse automatically set the debug break flag when debugger commands are in the queue abort by crashing maximum length of function source code printed in a stack trace max size of the new max size of the old max size of executable always perform global GCs print one trace line following each garbage collection do not print trace line after scavenger collection print statistics of the maximum memory committed for the heap in name
Definition: flags.cc:505
Handle< Object > NewNumberFromUint(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1014
#define ARRAY_SIZE(a)
Definition: globals.h:333
Handle< ObjectHashSet > NewObjectHashSet(int at_least_space_for)
Definition: factory.cc:136
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
Handle< UnseededNumberDictionary > NewUnseededNumberDictionary(int at_least_space_for)
Definition: factory.cc:126
Handle< JSArray > NewJSArray(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=INITIALIZE_ARRAY_ELEMENTS_WITH_HOLE, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1437
void BecomeJSFunction(Handle< JSReceiver > object)
Definition: factory.cc:1561
Handle< SeededNumberDictionary > NewSeededNumberDictionary(int at_least_space_for)
Definition: factory.cc:116
static const int kLiteralsPrefixSize
Definition: objects.h:7530
static JSFunction * cast(Object *obj)