v8  3.11.10(node0.8.26)
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 2012 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 "macro-assembler.h"
35 #include "objects.h"
36 #include "objects-visiting.h"
37 #include "platform.h"
38 #include "scopeinfo.h"
39 
40 namespace v8 {
41 namespace internal {
42 
43 
45  ASSERT(0 <= size);
47  isolate(),
48  isolate()->heap()->AllocateFixedArray(size, pretenure),
49  FixedArray);
50 }
51 
52 
54  PretenureFlag pretenure) {
55  ASSERT(0 <= size);
57  isolate(),
58  isolate()->heap()->AllocateFixedArrayWithHoles(size, pretenure),
59  FixedArray);
60 }
61 
62 
64  PretenureFlag pretenure) {
65  ASSERT(0 <= size);
67  isolate(),
68  isolate()->heap()->AllocateUninitializedFixedDoubleArray(size, pretenure),
70 }
71 
72 
74  ASSERT(0 <= at_least_space_for);
75  CALL_HEAP_FUNCTION(isolate(),
76  StringDictionary::Allocate(at_least_space_for),
78 }
79 
80 
82  int at_least_space_for) {
83  ASSERT(0 <= at_least_space_for);
84  CALL_HEAP_FUNCTION(isolate(),
85  SeededNumberDictionary::Allocate(at_least_space_for),
87 }
88 
89 
91  int at_least_space_for) {
92  ASSERT(0 <= at_least_space_for);
93  CALL_HEAP_FUNCTION(isolate(),
94  UnseededNumberDictionary::Allocate(at_least_space_for),
96 }
97 
98 
100  ASSERT(0 <= at_least_space_for);
101  CALL_HEAP_FUNCTION(isolate(),
102  ObjectHashSet::Allocate(at_least_space_for),
103  ObjectHashSet);
104 }
105 
106 
108  ASSERT(0 <= at_least_space_for);
109  CALL_HEAP_FUNCTION(isolate(),
110  ObjectHashTable::Allocate(at_least_space_for),
112 }
113 
114 
116  ASSERT(0 <= number_of_descriptors);
117  CALL_HEAP_FUNCTION(isolate(),
118  DescriptorArray::Allocate(number_of_descriptors,
121 }
122 
123 
125  int deopt_entry_count,
126  PretenureFlag pretenure) {
127  ASSERT(deopt_entry_count > 0);
128  CALL_HEAP_FUNCTION(isolate(),
129  DeoptimizationInputData::Allocate(deopt_entry_count,
130  pretenure),
132 }
133 
134 
136  int deopt_entry_count,
137  PretenureFlag pretenure) {
138  ASSERT(deopt_entry_count > 0);
139  CALL_HEAP_FUNCTION(isolate(),
140  DeoptimizationOutputData::Allocate(deopt_entry_count,
141  pretenure),
143 }
144 
145 
147  CALL_HEAP_FUNCTION(isolate(),
148  isolate()->heap()->AllocateAccessorPair(),
149  AccessorPair);
150 }
151 
152 
154  CALL_HEAP_FUNCTION(isolate(),
155  isolate()->heap()->AllocateTypeFeedbackInfo(),
157 }
158 
159 
160 // Symbols are created in the old generation (data space).
162  CALL_HEAP_FUNCTION(isolate(),
163  isolate()->heap()->LookupSymbol(string),
164  String);
165 }
166 
167 // Symbols are created in the old generation (data space).
169  CALL_HEAP_FUNCTION(isolate(),
170  isolate()->heap()->LookupSymbol(*string),
171  String);
172 }
173 
175  CALL_HEAP_FUNCTION(isolate(),
176  isolate()->heap()->LookupAsciiSymbol(string),
177  String);
178 }
179 
180 
182  int from,
183  int length) {
184  CALL_HEAP_FUNCTION(isolate(),
185  isolate()->heap()->LookupAsciiSymbol(string,
186  from,
187  length),
188  String);
189 }
190 
191 
193  CALL_HEAP_FUNCTION(isolate(),
194  isolate()->heap()->LookupTwoByteSymbol(string),
195  String);
196 }
197 
198 
200  PretenureFlag pretenure) {
202  isolate(),
203  isolate()->heap()->AllocateStringFromAscii(string, pretenure),
204  String);
205 }
206 
208  PretenureFlag pretenure) {
210  isolate(),
211  isolate()->heap()->AllocateStringFromUtf8(string, pretenure),
212  String);
213 }
214 
215 
217  PretenureFlag pretenure) {
219  isolate(),
220  isolate()->heap()->AllocateStringFromTwoByte(string, pretenure),
221  String);
222 }
223 
224 
226  PretenureFlag pretenure) {
228  isolate(),
229  isolate()->heap()->AllocateRawAsciiString(length, pretenure),
231 }
232 
233 
235  PretenureFlag pretenure) {
237  isolate(),
238  isolate()->heap()->AllocateRawTwoByteString(length, pretenure),
240 }
241 
242 
244  Handle<String> second) {
245  CALL_HEAP_FUNCTION(isolate(),
246  isolate()->heap()->AllocateConsString(*first, *second),
247  String);
248 }
249 
250 
252  int begin,
253  int end) {
254  CALL_HEAP_FUNCTION(isolate(),
255  str->SubString(begin, end),
256  String);
257 }
258 
259 
261  int begin,
262  int end) {
263  ASSERT(begin > 0 || end < str->length());
264  CALL_HEAP_FUNCTION(isolate(),
265  isolate()->heap()->AllocateSubString(*str, begin, end),
266  String);
267 }
268 
269 
271  const ExternalAsciiString::Resource* resource) {
273  isolate(),
274  isolate()->heap()->AllocateExternalStringFromAscii(resource),
275  String);
276 }
277 
278 
280  const ExternalTwoByteString::Resource* resource) {
282  isolate(),
283  isolate()->heap()->AllocateExternalStringFromTwoByte(resource),
284  String);
285 }
286 
287 
290  isolate(),
291  isolate()->heap()->AllocateGlobalContext(),
292  Context);
293 }
294 
295 
297  Handle<ScopeInfo> scope_info) {
299  isolate(),
300  isolate()->heap()->AllocateModuleContext(*previous, *scope_info),
301  Context);
302 }
303 
304 
306  Handle<JSFunction> function) {
308  isolate(),
309  isolate()->heap()->AllocateFunctionContext(length, *function),
310  Context);
311 }
312 
313 
315  Handle<Context> previous,
317  Handle<Object> thrown_object) {
319  isolate(),
320  isolate()->heap()->AllocateCatchContext(*function,
321  *previous,
322  *name,
323  *thrown_object),
324  Context);
325 }
326 
327 
329  Handle<Context> previous,
330  Handle<JSObject> extension) {
332  isolate(),
333  isolate()->heap()->AllocateWithContext(*function, *previous, *extension),
334  Context);
335 }
336 
337 
339  Handle<Context> previous,
340  Handle<ScopeInfo> scope_info) {
342  isolate(),
343  isolate()->heap()->AllocateBlockContext(*function,
344  *previous,
345  *scope_info),
346  Context);
347 }
348 
349 
352  isolate(),
353  isolate()->heap()->AllocateStruct(type),
354  Struct);
355 }
356 
357 
359  Handle<AccessorInfo> info =
361  info->set_flag(0); // Must clear the flag, it was initialized as undefined.
362  return info;
363 }
364 
365 
367  // Generate id for this script.
368  int id;
369  Heap* heap = isolate()->heap();
370  if (heap->last_script_id()->IsUndefined()) {
371  // Script ids start from one.
372  id = 1;
373  } else {
374  // Increment id, wrap when positive smi is exhausted.
375  id = Smi::cast(heap->last_script_id())->value();
376  id++;
377  if (!Smi::IsValid(id)) {
378  id = 0;
379  }
380  }
381  heap->SetLastScriptId(Smi::FromInt(id));
382 
383  // Create and initialize script object.
384  Handle<Foreign> wrapper = NewForeign(0, TENURED);
386  script->set_source(*source);
387  script->set_name(heap->undefined_value());
388  script->set_id(heap->last_script_id());
389  script->set_line_offset(Smi::FromInt(0));
390  script->set_column_offset(Smi::FromInt(0));
391  script->set_data(heap->undefined_value());
392  script->set_context_data(heap->undefined_value());
393  script->set_type(Smi::FromInt(Script::TYPE_NORMAL));
394  script->set_compilation_type(Smi::FromInt(Script::COMPILATION_TYPE_HOST));
395  script->set_compilation_state(
397  script->set_wrapper(*wrapper);
398  script->set_line_ends(heap->undefined_value());
399  script->set_eval_from_shared(heap->undefined_value());
400  script->set_eval_from_instructions_offset(Smi::FromInt(0));
401 
402  return script;
403 }
404 
405 
407  CALL_HEAP_FUNCTION(isolate(),
408  isolate()->heap()->AllocateForeign(addr, pretenure),
409  Foreign);
410 }
411 
412 
414  return NewForeign((Address) desc, TENURED);
415 }
416 
417 
419  ASSERT(0 <= length);
421  isolate(),
422  isolate()->heap()->AllocateByteArray(length, pretenure),
423  ByteArray);
424 }
425 
426 
428  ExternalArrayType array_type,
429  void* external_pointer,
430  PretenureFlag pretenure) {
431  ASSERT(0 <= length);
433  isolate(),
434  isolate()->heap()->AllocateExternalArray(length,
435  array_type,
436  external_pointer,
437  pretenure),
438  ExternalArray);
439 }
440 
441 
443  Handle<Object> value) {
445  isolate(),
446  isolate()->heap()->AllocateJSGlobalPropertyCell(*value),
448 }
449 
450 
452  int instance_size,
453  ElementsKind elements_kind) {
455  isolate(),
456  isolate()->heap()->AllocateMap(type, instance_size, elements_kind),
457  Map);
458 }
459 
460 
463  isolate(),
464  isolate()->heap()->AllocateFunctionPrototype(*function),
465  JSObject);
466 }
467 
468 
470  CALL_HEAP_FUNCTION(isolate(), src->CopyDropDescriptors(), Map);
471 }
472 
473 
475  int extra_inobject_properties) {
477  // Check that we do not overflow the instance size when adding the
478  // extra inobject properties.
479  int instance_size_delta = extra_inobject_properties * kPointerSize;
480  int max_instance_size_delta =
481  JSObject::kMaxInstanceSize - copy->instance_size();
482  if (instance_size_delta > max_instance_size_delta) {
483  // If the instance size overflows, we allocate as many properties
484  // as we can as inobject properties.
485  instance_size_delta = max_instance_size_delta;
486  extra_inobject_properties = max_instance_size_delta >> kPointerSizeLog2;
487  }
488  // Adjust the map with the extra inobject properties.
489  int inobject_properties =
490  copy->inobject_properties() + extra_inobject_properties;
491  copy->set_inobject_properties(inobject_properties);
492  copy->set_unused_property_fields(inobject_properties);
493  copy->set_instance_size(copy->instance_size() + instance_size_delta);
494  copy->set_visitor_id(StaticVisitorBase::GetVisitorId(*copy));
495  return copy;
496 }
497 
498 
500  CALL_HEAP_FUNCTION(isolate(),
501  src->CopyDropTransitions(DescriptorArray::MAY_BE_SHARED),
502  Map);
503 }
504 
505 
507  Handle<JSObject> src,
508  ElementsKind elements_kind) {
509  Isolate* i = isolate();
511  src->GetElementsTransitionMap(i, elements_kind),
512  Map);
513 }
514 
515 
517  CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedArray);
518 }
519 
520 
522  Handle<FixedDoubleArray> array) {
523  CALL_HEAP_FUNCTION(isolate(), array->Copy(), FixedDoubleArray);
524 }
525 
526 
528  Handle<SharedFunctionInfo> function_info,
529  Handle<Map> function_map,
530  PretenureFlag pretenure) {
532  isolate(),
533  isolate()->heap()->AllocateFunction(*function_map,
534  *function_info,
535  isolate()->heap()->the_hole_value(),
536  pretenure),
537  JSFunction);
538 }
539 
540 
542  Handle<SharedFunctionInfo> function_info,
543  Handle<Context> context,
544  PretenureFlag pretenure) {
546  function_info,
547  function_info->is_classic_mode()
548  ? isolate()->function_map()
549  : isolate()->strict_mode_function_map(),
550  pretenure);
551 
552  if (function_info->ic_age() != isolate()->heap()->global_ic_age()) {
553  function_info->ResetForNewContext(isolate()->heap()->global_ic_age());
554  }
555 
556  result->set_context(*context);
557  if (!function_info->bound()) {
558  int number_of_literals = function_info->num_literals();
559  Handle<FixedArray> literals = NewFixedArray(number_of_literals, pretenure);
560  if (number_of_literals > 0) {
561  // Store the object, regexp and array functions in the literals
562  // array prefix. These functions will be used when creating
563  // object, regexp and array literals in this function.
565  context->global_context());
566  }
567  result->set_literals(*literals);
568  }
569  if (V8::UseCrankshaft() &&
570  FLAG_always_opt &&
571  result->is_compiled() &&
572  !function_info->is_toplevel() &&
573  function_info->allows_lazy_compilation() &&
574  !function_info->optimization_disabled()) {
575  result->MarkForLazyRecompilation();
576  }
577  return result;
578 }
579 
580 
582  PretenureFlag pretenure) {
584  isolate(),
585  isolate()->heap()->NumberFromDouble(value, pretenure), Object);
586 }
587 
588 
590  PretenureFlag pretenure) {
592  isolate(),
593  isolate()->heap()->NumberFromInt32(value, pretenure), Object);
594 }
595 
596 
598  PretenureFlag pretenure) {
600  isolate(),
601  isolate()->heap()->NumberFromUint32(value, pretenure), Object);
602 }
603 
604 
607  isolate(),
608  isolate()->heap()->AllocateJSObjectFromMap(
609  isolate()->heap()->neander_map()),
610  JSObject);
611 }
612 
613 
615  Vector< Handle<Object> > args) {
616  return NewError("MakeTypeError", type, args);
617 }
618 
619 
621  return NewError("$TypeError", message);
622 }
623 
624 
626  Vector< Handle<Object> > args) {
627  return NewError("MakeRangeError", type, args);
628 }
629 
630 
632  return NewError("$RangeError", message);
633 }
634 
635 
637  return NewError("MakeSyntaxError", type, args);
638 }
639 
640 
642  return NewError("$SyntaxError", message);
643 }
644 
645 
647  Vector< Handle<Object> > args) {
648  return NewError("MakeReferenceError", type, args);
649 }
650 
651 
653  return NewError("$ReferenceError", message);
654 }
655 
656 
657 Handle<Object> Factory::NewError(const char* maker, const char* type,
658  Vector< Handle<Object> > args) {
659  v8::HandleScope scope; // Instantiate a closeable HandleScope for EscapeFrom.
660  Handle<FixedArray> array = NewFixedArray(args.length());
661  for (int i = 0; i < args.length(); i++) {
662  array->set(i, *args[i]);
663  }
664  Handle<JSArray> object = NewJSArrayWithElements(array);
665  Handle<Object> result = NewError(maker, type, object);
666  return result.EscapeFrom(&scope);
667 }
668 
669 
671  Vector< Handle<Object> > args) {
672  return NewError("MakeEvalError", type, args);
673 }
674 
675 
677  Vector< Handle<Object> > args) {
678  return NewError("MakeError", type, args);
679 }
680 
681 
683  Handle<JSArray> args) {
684  const int kBufferSize = 1000;
685  char buffer[kBufferSize];
686  size_t space = kBufferSize;
687  char* p = &buffer[0];
688 
689  Vector<char> v(buffer, kBufferSize);
690  OS::StrNCpy(v, type, space);
691  space -= Min(space, strlen(type));
692  p = &buffer[kBufferSize] - space;
693 
694  for (unsigned i = 0; i < ARRAY_SIZE(args); i++) {
695  if (space > 0) {
696  *p++ = ' ';
697  space--;
698  if (space > 0) {
699  MaybeObject* maybe_arg = args->GetElement(i);
700  Handle<String> arg_str(reinterpret_cast<String*>(maybe_arg));
701  const char* arg = *arg_str->ToCString();
702  Vector<char> v2(p, space);
703  OS::StrNCpy(v2, arg, space);
704  space -= Min(space, strlen(arg));
705  p = &buffer[kBufferSize] - space;
706  }
707  }
708  }
709  if (space > 0) {
710  *p = '\0';
711  } else {
712  buffer[kBufferSize - 1] = '\0';
713  }
714  Handle<String> error_string = NewStringFromUtf8(CStrVector(buffer), TENURED);
715  return error_string;
716 }
717 
718 
720  const char* type,
721  Handle<JSArray> args) {
722  Handle<String> make_str = LookupAsciiSymbol(maker);
723  Handle<Object> fun_obj(
724  isolate()->js_builtins_object()->GetPropertyNoExceptionThrown(*make_str));
725  // If the builtins haven't been properly configured yet this error
726  // constructor may not have been defined. Bail out.
727  if (!fun_obj->IsJSFunction()) {
728  return EmergencyNewError(type, args);
729  }
731  Handle<Object> type_obj = LookupAsciiSymbol(type);
732  Handle<Object> argv[] = { type_obj, args };
733 
734  // Invoke the JavaScript factory method. If an exception is thrown while
735  // running the factory method, use the exception as the result.
736  bool caught_exception;
737  Handle<Object> result = Execution::TryCall(fun,
738  isolate()->js_builtins_object(),
739  ARRAY_SIZE(argv),
740  argv,
741  &caught_exception);
742  return result;
743 }
744 
745 
747  return NewError("$Error", message);
748 }
749 
750 
751 Handle<Object> Factory::NewError(const char* constructor,
752  Handle<String> message) {
753  Handle<String> constr = LookupAsciiSymbol(constructor);
755  JSFunction::cast(isolate()->js_builtins_object()->
756  GetPropertyNoExceptionThrown(*constr)));
757  Handle<Object> argv[] = { message };
758 
759  // Invoke the JavaScript factory method. If an exception is thrown while
760  // running the factory method, use the exception as the result.
761  bool caught_exception;
762  Handle<Object> result = Execution::TryCall(fun,
763  isolate()->js_builtins_object(),
764  ARRAY_SIZE(argv),
765  argv,
766  &caught_exception);
767  return result;
768 }
769 
770 
773  int instance_size,
774  Handle<Code> code,
775  bool force_initial_map) {
776  // Allocate the function
777  Handle<JSFunction> function = NewFunction(name, the_hole_value());
778 
779  // Set up the code pointer in both the shared function info and in
780  // the function itself.
781  function->shared()->set_code(*code);
782  function->set_code(*code);
783 
784  if (force_initial_map ||
785  type != JS_OBJECT_TYPE ||
786  instance_size != JSObject::kHeaderSize) {
787  Handle<Map> initial_map = NewMap(type, instance_size);
788  Handle<JSObject> prototype = NewFunctionPrototype(function);
789  initial_map->set_prototype(*prototype);
790  function->set_initial_map(*initial_map);
791  initial_map->set_constructor(*function);
792  } else {
793  ASSERT(!function->has_initial_map());
794  ASSERT(!function->has_prototype());
795  }
796 
797  return function;
798 }
799 
800 
803  int instance_size,
804  Handle<JSObject> prototype,
805  Handle<Code> code,
806  bool force_initial_map) {
807  // Allocate the function.
808  Handle<JSFunction> function = NewFunction(name, prototype);
809 
810  // Set up the code pointer in both the shared function info and in
811  // the function itself.
812  function->shared()->set_code(*code);
813  function->set_code(*code);
814 
815  if (force_initial_map ||
816  type != JS_OBJECT_TYPE ||
817  instance_size != JSObject::kHeaderSize) {
818  Handle<Map> initial_map = NewMap(type,
819  instance_size,
821  function->set_initial_map(*initial_map);
822  initial_map->set_constructor(*function);
823  }
824 
825  // Set function.prototype and give the prototype a constructor
826  // property that refers to the function.
827  SetPrototypeProperty(function, prototype);
828  // Currently safe because it is only invoked from Genesis.
829  CHECK_NOT_EMPTY_HANDLE(isolate(),
831  prototype, constructor_symbol(),
832  function, DONT_ENUM));
833  return function;
834 }
835 
836 
838  Handle<Code> code) {
840  CLASSIC_MODE);
841  function->shared()->set_code(*code);
842  function->set_code(*code);
843  ASSERT(!function->has_initial_map());
844  ASSERT(!function->has_prototype());
845  return function;
846 }
847 
848 
851  isolate(),
852  isolate()->heap()->AllocateScopeInfo(length),
853  ScopeInfo);
854 }
855 
856 
859  Handle<Object> self_ref,
860  bool immovable) {
861  CALL_HEAP_FUNCTION(isolate(),
862  isolate()->heap()->CreateCode(
863  desc, flags, self_ref, immovable),
864  Code);
865 }
866 
867 
869  CALL_HEAP_FUNCTION(isolate(),
870  isolate()->heap()->CopyCode(*code),
871  Code);
872 }
873 
874 
876  CALL_HEAP_FUNCTION(isolate(),
877  isolate()->heap()->CopyCode(*code, reloc_info),
878  Code);
879 }
880 
881 
882 MUST_USE_RESULT static inline MaybeObject* DoCopyInsert(
883  DescriptorArray* array,
884  String* key,
885  Object* value,
886  PropertyAttributes attributes) {
887  CallbacksDescriptor desc(key, value, attributes);
888  MaybeObject* obj = array->CopyInsert(&desc, REMOVE_TRANSITIONS);
889  return obj;
890 }
891 
892 
893 // Allocate the new array.
896  Handle<String> key,
897  Handle<Object> value,
898  PropertyAttributes attributes) {
899  CALL_HEAP_FUNCTION(isolate(),
900  DoCopyInsert(*array, *key, *value, attributes),
902 }
903 
904 
906  CALL_HEAP_FUNCTION(isolate(),
907  isolate()->heap()->LookupSymbol(*value), String);
908 }
909 
910 
911 Handle<DescriptorArray> Factory::CopyAppendCallbackDescriptors(
913  Handle<Object> descriptors) {
914  v8::NeanderArray callbacks(descriptors);
915  int nof_callbacks = callbacks.length();
916  Handle<DescriptorArray> result =
917  NewDescriptorArray(array->number_of_descriptors() + nof_callbacks);
918 
919  // Number of descriptors added to the result so far.
920  int descriptor_count = 0;
921 
922  // Ensure that marking will not progress and change color of objects.
923  DescriptorArray::WhitenessWitness witness(*result);
924 
925  // Copy the descriptors from the array.
926  for (int i = 0; i < array->number_of_descriptors(); i++) {
927  if (!array->IsNullDescriptor(i)) {
928  DescriptorArray::CopyFrom(result, descriptor_count++, array, i, witness);
929  }
930  }
931 
932  // Number of duplicates detected.
933  int duplicates = 0;
934 
935  // Fill in new callback descriptors. Process the callbacks from
936  // back to front so that the last callback with a given name takes
937  // precedence over previously added callbacks with that name.
938  for (int i = nof_callbacks - 1; i >= 0; i--) {
939  Handle<AccessorInfo> entry =
940  Handle<AccessorInfo>(AccessorInfo::cast(callbacks.get(i)));
941  // Ensure the key is a symbol before writing into the instance descriptor.
942  Handle<String> key =
943  SymbolFromString(Handle<String>(String::cast(entry->name())));
944  // Check if a descriptor with this name already exists before writing.
945  if (result->LinearSearch(EXPECT_UNSORTED, *key, descriptor_count) ==
947  CallbacksDescriptor desc(*key, *entry, entry->property_attributes());
948  result->Set(descriptor_count, &desc, witness);
949  descriptor_count++;
950  } else {
951  duplicates++;
952  }
953  }
954 
955  // If duplicates were detected, allocate a result of the right size
956  // and transfer the elements.
957  if (duplicates > 0) {
958  int number_of_descriptors = result->number_of_descriptors() - duplicates;
959  Handle<DescriptorArray> new_result =
960  NewDescriptorArray(number_of_descriptors);
961  for (int i = 0; i < number_of_descriptors; i++) {
962  DescriptorArray::CopyFrom(new_result, i, result, i, witness);
963  }
964  result = new_result;
965  }
966 
967  // Sort the result before returning.
968  result->Sort(witness);
969  return result;
970 }
971 
972 
974  PretenureFlag pretenure) {
976  isolate(),
977  isolate()->heap()->AllocateJSObject(*constructor, pretenure), JSObject);
978 }
979 
980 
983  isolate(),
984  isolate()->heap()->AllocateJSModule(), JSModule);
985 }
986 
987 
989  Handle<JSFunction> constructor) {
990  CALL_HEAP_FUNCTION(isolate(),
991  isolate()->heap()->AllocateGlobalObject(*constructor),
992  GlobalObject);
993 }
994 
995 
996 
999  isolate(),
1000  isolate()->heap()->AllocateJSObjectFromMap(*map, NOT_TENURED),
1001  JSObject);
1002 }
1003 
1004 
1006  ElementsKind elements_kind,
1007  PretenureFlag pretenure) {
1008  CALL_HEAP_FUNCTION(isolate(),
1009  isolate()->heap()->AllocateJSArrayAndStorage(
1010  elements_kind,
1011  0,
1012  capacity,
1014  pretenure),
1015  JSArray);
1016 }
1017 
1018 
1020  ElementsKind elements_kind,
1021  PretenureFlag pretenure) {
1023  isolate(),
1024  isolate()->heap()->AllocateJSArrayWithElements(*elements,
1025  elements_kind,
1026  pretenure),
1027  JSArray);
1028 }
1029 
1030 
1032  int capacity,
1033  int length) {
1034  ElementsAccessor* accessor = array->GetElementsAccessor();
1036  isolate(),
1037  accessor->SetCapacityAndLength(*array, capacity, length));
1038 }
1039 
1040 
1042  Handle<FixedArrayBase> elements) {
1044  isolate(),
1045  array->SetContent(*elements));
1046 }
1047 
1048 
1051  isolate(),
1052  array->EnsureCanContainHeapObjectElements());
1053 }
1054 
1055 
1057  Handle<FixedArrayBase> elements,
1058  uint32_t length,
1059  EnsureElementsMode mode) {
1061  isolate(),
1062  array->EnsureCanContainElements(*elements, length, mode));
1063 }
1064 
1065 
1067  Handle<Object> prototype) {
1069  isolate(),
1070  isolate()->heap()->AllocateJSProxy(*handler, *prototype),
1071  JSProxy);
1072 }
1073 
1074 
1077  isolate(),
1078  isolate()->heap()->ReinitializeJSReceiver(
1080 }
1081 
1082 
1085  isolate(),
1086  isolate()->heap()->ReinitializeJSReceiver(
1087  *object, JS_FUNCTION_TYPE, JSFunction::kSize));
1088 }
1089 
1090 
1093  isolate(),
1094  object->SetIdentityHash(hash, ALLOW_CREATION));
1095 }
1096 
1097 
1100  int number_of_literals,
1101  Handle<Code> code,
1102  Handle<ScopeInfo> scope_info) {
1104  shared->set_code(*code);
1105  shared->set_scope_info(*scope_info);
1106  int literals_array_size = number_of_literals;
1107  // If the function contains object, regexp or array literals,
1108  // allocate extra space for a literals array prefix containing the
1109  // context.
1110  if (number_of_literals > 0) {
1111  literals_array_size += JSFunction::kLiteralsPrefixSize;
1112  }
1113  shared->set_num_literals(literals_array_size);
1114  return shared;
1115 }
1116 
1117 
1120  Handle<JSArray> arguments,
1121  int start_position,
1122  int end_position,
1123  Handle<Object> script,
1124  Handle<Object> stack_trace,
1125  Handle<Object> stack_frames) {
1126  CALL_HEAP_FUNCTION(isolate(),
1127  isolate()->heap()->AllocateJSMessageObject(*type,
1128  *arguments,
1129  start_position,
1130  end_position,
1131  *script,
1132  *stack_trace,
1133  *stack_frames),
1134  JSMessageObject);
1135 }
1136 
1138  CALL_HEAP_FUNCTION(isolate(),
1139  isolate()->heap()->AllocateSharedFunctionInfo(*name),
1141 }
1142 
1143 
1145  CALL_HEAP_FUNCTION(isolate(),
1146  isolate()->heap()->NumberToString(*number), String);
1147 }
1148 
1149 
1151  CALL_HEAP_FUNCTION(isolate(),
1152  isolate()->heap()->Uint32ToString(value), String);
1153 }
1154 
1155 
1157  Handle<SeededNumberDictionary> dictionary,
1158  uint32_t key,
1159  Handle<Object> value) {
1160  CALL_HEAP_FUNCTION(isolate(),
1161  dictionary->AtNumberPut(key, *value),
1163 }
1164 
1165 
1168  uint32_t key,
1169  Handle<Object> value) {
1170  CALL_HEAP_FUNCTION(isolate(),
1171  dictionary->AtNumberPut(key, *value),
1173 }
1174 
1175 
1176 Handle<JSFunction> Factory::NewFunctionHelper(Handle<String> name,
1177  Handle<Object> prototype) {
1178  Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
1180  isolate(),
1181  isolate()->heap()->AllocateFunction(*isolate()->function_map(),
1182  *function_share,
1183  *prototype),
1184  JSFunction);
1185 }
1186 
1187 
1189  Handle<Object> prototype) {
1190  Handle<JSFunction> fun = NewFunctionHelper(name, prototype);
1191  fun->set_context(isolate()->context()->global_context());
1192  return fun;
1193 }
1194 
1195 
1196 Handle<JSFunction> Factory::NewFunctionWithoutPrototypeHelper(
1197  Handle<String> name,
1198  LanguageMode language_mode) {
1199  Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
1200  Handle<Map> map = (language_mode == CLASSIC_MODE)
1201  ? isolate()->function_without_prototype_map()
1202  : isolate()->strict_mode_function_without_prototype_map();
1203  CALL_HEAP_FUNCTION(isolate(),
1204  isolate()->heap()->AllocateFunction(
1205  *map,
1206  *function_share,
1207  *the_hole_value()),
1208  JSFunction);
1209 }
1210 
1211 
1213  Handle<String> name,
1214  LanguageMode language_mode) {
1215  Handle<JSFunction> fun =
1216  NewFunctionWithoutPrototypeHelper(name, language_mode);
1217  fun->set_context(isolate()->context()->global_context());
1218  return fun;
1219 }
1220 
1221 
1223  CALL_HEAP_FUNCTION(isolate(), object->ToObject(), Object);
1224 }
1225 
1226 
1228  Handle<Context> global_context) {
1229  CALL_HEAP_FUNCTION(isolate(), object->ToObject(*global_context), Object);
1230 }
1231 
1232 
1233 #ifdef ENABLE_DEBUGGER_SUPPORT
1234 Handle<DebugInfo> Factory::NewDebugInfo(Handle<SharedFunctionInfo> shared) {
1235  // Get the original code of the function.
1236  Handle<Code> code(shared->code());
1237 
1238  // Create a copy of the code before allocating the debug info object to avoid
1239  // allocation while setting up the debug info object.
1240  Handle<Code> original_code(*Factory::CopyCode(code));
1241 
1242  // Allocate initial fixed array for active break points before allocating the
1243  // debug info object to avoid allocation while setting up the debug info
1244  // object.
1245  Handle<FixedArray> break_points(
1246  NewFixedArray(Debug::kEstimatedNofBreakPointsInFunction));
1247 
1248  // Create and set up the debug info object. Debug info contains function, a
1249  // copy of the original code, the executing code and initial fixed array for
1250  // active break points.
1251  Handle<DebugInfo> debug_info =
1253  debug_info->set_shared(*shared);
1254  debug_info->set_original_code(*original_code);
1255  debug_info->set_code(*code);
1256  debug_info->set_break_points(*break_points);
1257 
1258  // Link debug info to function.
1259  shared->set_debug_info(*debug_info);
1260 
1261  return debug_info;
1262 }
1263 #endif
1264 
1265 
1267  int length) {
1269  isolate(),
1270  isolate()->heap()->AllocateArgumentsObject(*callee, length), JSObject);
1271 }
1272 
1273 
1275  Handle<FunctionTemplateInfo> obj, ApiInstanceType instance_type) {
1276  Handle<Code> code = isolate()->builtins()->HandleApiCall();
1277  Handle<Code> construct_stub = isolate()->builtins()->JSConstructStubApi();
1278 
1279  int internal_field_count = 0;
1280  if (!obj->instance_template()->IsUndefined()) {
1283  ObjectTemplateInfo::cast(obj->instance_template()));
1284  internal_field_count =
1285  Smi::cast(instance_template->internal_field_count())->value();
1286  }
1287 
1288  int instance_size = kPointerSize * internal_field_count;
1290  switch (instance_type) {
1291  case JavaScriptObject:
1292  type = JS_OBJECT_TYPE;
1293  instance_size += JSObject::kHeaderSize;
1294  break;
1295  case InnerGlobalObject:
1296  type = JS_GLOBAL_OBJECT_TYPE;
1297  instance_size += JSGlobalObject::kSize;
1298  break;
1299  case OuterGlobalObject:
1300  type = JS_GLOBAL_PROXY_TYPE;
1301  instance_size += JSGlobalProxy::kSize;
1302  break;
1303  default:
1304  break;
1305  }
1306  ASSERT(type != INVALID_TYPE);
1307 
1308  Handle<JSFunction> result =
1309  NewFunction(Factory::empty_symbol(),
1310  type,
1311  instance_size,
1312  code,
1313  true);
1314  // Set class name.
1315  Handle<Object> class_name = Handle<Object>(obj->class_name());
1316  if (class_name->IsString()) {
1317  result->shared()->set_instance_class_name(*class_name);
1318  result->shared()->set_name(*class_name);
1319  }
1320 
1321  Handle<Map> map = Handle<Map>(result->initial_map());
1322 
1323  // Mark as undetectable if needed.
1324  if (obj->undetectable()) {
1325  map->set_is_undetectable();
1326  }
1327 
1328  // Mark as hidden for the __proto__ accessor if needed.
1329  if (obj->hidden_prototype()) {
1330  map->set_is_hidden_prototype();
1331  }
1332 
1333  // Mark as needs_access_check if needed.
1334  if (obj->needs_access_check()) {
1335  map->set_is_access_check_needed(true);
1336  }
1337 
1338  // Set interceptor information in the map.
1339  if (!obj->named_property_handler()->IsUndefined()) {
1340  map->set_has_named_interceptor();
1341  }
1342  if (!obj->indexed_property_handler()->IsUndefined()) {
1343  map->set_has_indexed_interceptor();
1344  }
1345 
1346  // Set instance call-as-function information in the map.
1347  if (!obj->instance_call_handler()->IsUndefined()) {
1348  map->set_has_instance_call_handler();
1349  }
1350 
1351  result->shared()->set_function_data(*obj);
1352  result->shared()->set_construct_stub(*construct_stub);
1353  result->shared()->DontAdaptArguments();
1354 
1355  // Recursively copy parent templates' accessors, 'data' may be modified.
1356  Handle<DescriptorArray> array =
1357  Handle<DescriptorArray>(map->instance_descriptors());
1358  while (true) {
1359  Handle<Object> props = Handle<Object>(obj->property_accessors());
1360  if (!props->IsUndefined()) {
1361  array = CopyAppendCallbackDescriptors(array, props);
1362  }
1363  Handle<Object> parent = Handle<Object>(obj->parent_template());
1364  if (parent->IsUndefined()) break;
1365  obj = Handle<FunctionTemplateInfo>::cast(parent);
1366  }
1367  if (!array->IsEmpty()) {
1368  map->set_instance_descriptors(*array);
1369  }
1370 
1371  ASSERT(result->shared()->IsApiFunction());
1372  return result;
1373 }
1374 
1375 
1376 Handle<MapCache> Factory::NewMapCache(int at_least_space_for) {
1377  CALL_HEAP_FUNCTION(isolate(),
1378  MapCache::Allocate(at_least_space_for), MapCache);
1379 }
1380 
1381 
1382 MUST_USE_RESULT static MaybeObject* UpdateMapCacheWith(Context* context,
1383  FixedArray* keys,
1384  Map* map) {
1385  Object* result;
1386  { MaybeObject* maybe_result =
1387  MapCache::cast(context->map_cache())->Put(keys, map);
1388  if (!maybe_result->ToObject(&result)) return maybe_result;
1389  }
1390  context->set_map_cache(MapCache::cast(result));
1391  return result;
1392 }
1393 
1394 
1395 Handle<MapCache> Factory::AddToMapCache(Handle<Context> context,
1396  Handle<FixedArray> keys,
1397  Handle<Map> map) {
1398  CALL_HEAP_FUNCTION(isolate(),
1399  UpdateMapCacheWith(*context, *keys, *map), MapCache);
1400 }
1401 
1402 
1404  Handle<FixedArray> keys) {
1405  if (context->map_cache()->IsUndefined()) {
1406  // Allocate the new map cache for the global context.
1407  Handle<MapCache> new_cache = NewMapCache(24);
1408  context->set_map_cache(*new_cache);
1409  }
1410  // Check to see whether there is a matching element in the cache.
1411  Handle<MapCache> cache =
1412  Handle<MapCache>(MapCache::cast(context->map_cache()));
1413  Handle<Object> result = Handle<Object>(cache->Lookup(*keys));
1414  if (result->IsMap()) return Handle<Map>::cast(result);
1415  // Create a new map and add it to the cache.
1416  Handle<Map> map =
1417  CopyMap(Handle<Map>(context->object_function()->initial_map()),
1418  keys->length());
1419  AddToMapCache(context, keys, map);
1420  return Handle<Map>(map);
1421 }
1422 
1423 
1426  Handle<String> source,
1428  Handle<Object> data) {
1430 
1431  store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
1432  store->set(JSRegExp::kSourceIndex, *source);
1433  store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
1434  store->set(JSRegExp::kAtomPatternIndex, *data);
1435  regexp->set_data(*store);
1436 }
1437 
1440  Handle<String> source,
1442  int capture_count) {
1445  store->set(JSRegExp::kTagIndex, Smi::FromInt(type));
1446  store->set(JSRegExp::kSourceIndex, *source);
1447  store->set(JSRegExp::kFlagsIndex, Smi::FromInt(flags.value()));
1448  store->set(JSRegExp::kIrregexpASCIICodeIndex, uninitialized);
1449  store->set(JSRegExp::kIrregexpUC16CodeIndex, uninitialized);
1450  store->set(JSRegExp::kIrregexpASCIICodeSavedIndex, uninitialized);
1451  store->set(JSRegExp::kIrregexpUC16CodeSavedIndex, uninitialized);
1454  Smi::FromInt(capture_count));
1455  regexp->set_data(*store);
1456 }
1457 
1458 
1459 
1461  Handle<JSObject> instance,
1462  bool* pending_exception) {
1463  // Configure the instance by adding the properties specified by the
1464  // instance template.
1465  Handle<Object> instance_template = Handle<Object>(desc->instance_template());
1466  if (!instance_template->IsUndefined()) {
1468  instance_template,
1469  pending_exception);
1470  } else {
1471  *pending_exception = false;
1472  }
1473 }
1474 
1475 
1477  Heap* h = isolate()->heap();
1478  if (name->Equals(h->undefined_symbol())) return undefined_value();
1479  if (name->Equals(h->nan_symbol())) return nan_value();
1480  if (name->Equals(h->infinity_symbol())) return infinity_value();
1481  return Handle<Object>::null();
1482 }
1483 
1484 
1486  return Handle<Object>(value
1487  ? isolate()->heap()->true_value()
1488  : isolate()->heap()->false_value());
1489 }
1490 
1491 
1492 } } // namespace v8::internal
byte * Address
Definition: globals.h:172
#define CHECK_NOT_EMPTY_HANDLE(isolate, call)
Definition: isolate.h:127
Handle< JSObject > NewFunctionPrototype(Handle< JSFunction > function)
Definition: factory.cc:461
Handle< JSObject > NewJSObject(Handle< JSFunction > constructor, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:973
Handle< String > NewExternalStringFromAscii(const ExternalAsciiString::Resource *resource)
Definition: factory.cc:270
static const int kIrregexpMaxRegisterCountIndex
Definition: objects.h:6465
Handle< JSFunction > NewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Context > context, PretenureFlag pretenure=TENURED)
Definition: factory.cc:541
static Handle< Object > TryCall(Handle< JSFunction > func, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *caught_exception)
Definition: execution.cc:186
Handle< String > SymbolFromString(Handle< String > value)
Definition: factory.cc:905
static String * cast(Object *obj)
virtual MUST_USE_RESULT MaybeObject * SetCapacityAndLength(JSArray *array, int capacity, int length)=0
static MapCache * cast(Object *obj)
static bool UseCrankshaft()
Definition: v8.h:86
static void CopyFrom(Handle< DescriptorArray > dst, int dst_index, Handle< DescriptorArray > src, int src_index, const WhitenessWitness &witness)
Definition: objects.cc:5811
Handle< FixedArray > NewFixedArrayWithHoles(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:53
static Smi * FromInt(int value)
Definition: objects-inl.h:973
Handle< String > NewSubString(Handle< String > str, int begin, int end)
Definition: factory.cc:251
Handle< Script > NewScript(Handle< String > source)
Definition: factory.cc:366
Handle< SeqAsciiString > NewRawAsciiString(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:225
Handle< ObjectHashTable > NewObjectHashTable(int at_least_space_for)
Definition: factory.cc:107
Handle< JSFunction > BaseNewFunctionFromSharedFunctionInfo(Handle< SharedFunctionInfo > function_info, Handle< Map > function_map, PretenureFlag pretenure)
Definition: factory.cc:527
static ObjectTemplateInfo * cast(Object *obj)
MUST_USE_RESULT MaybeObject * CopyInsert(Descriptor *descriptor, TransitionFlag transition_flag)
Definition: objects.cc:5838
static MUST_USE_RESULT MaybeObject * Allocate(int at_least_space_for, PretenureFlag pretenure=NOT_TENURED)
Handle< JSArray > NewJSArray(int capacity, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1005
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
static Handle< T > cast(Handle< S > that)
Definition: handles.h:81
Handle< Context > NewCatchContext(Handle< JSFunction > function, Handle< Context > previous, Handle< String > name, Handle< Object > thrown_object)
Definition: factory.cc:314
static const int kIrregexpDataSize
Definition: objects.h:6469
Handle< DescriptorArray > CopyAppendForeignDescriptor(Handle< DescriptorArray > array, Handle< String > key, Handle< Object > value, PropertyAttributes attributes)
Definition: factory.cc:894
Flag flags[]
Definition: flags.cc:1467
Builtins * builtins()
Definition: isolate.h:909
int int32_t
Definition: unicode.cc:47
Handle< Context > NewFunctionContext(int length, Handle< JSFunction > function)
Definition: factory.cc:305
Handle< AccessorInfo > NewAccessorInfo()
Definition: factory.cc:358
static const int kSize
Definition: objects.h:6036
void SetPrototypeProperty(Handle< JSFunction > func, Handle< JSObject > value)
Definition: handles.cc:176
static const int kIrregexpASCIICodeIndex
Definition: objects.h:6450
static const int kIrregexpUC16CodeIndex
Definition: objects.h:6454
#define ASSERT(condition)
Definition: checks.h:270
static const int kIrregexpASCIICodeSavedIndex
Definition: objects.h:6458
Handle< JSFunction > NewFunctionWithPrototype(Handle< String > name, InstanceType type, int instance_size, Handle< JSObject > prototype, Handle< Code > code, bool force_initial_map)
Definition: factory.cc:801
const int kPointerSizeLog2
Definition: globals.h:246
ExternalArrayType
Definition: v8.h:1407
#define CALL_HEAP_FUNCTION_VOID(ISOLATE, FUNCTION_CALL)
Definition: heap-inl.h:556
static MUST_USE_RESULT MaybeObject * Allocate(int deopt_entry_count, PretenureFlag pretenure)
Definition: objects.cc:6084
static void ConfigureInstance(Handle< Object > instance, Handle< Object > data, bool *exc)
Definition: execution.cc:752
Handle< SharedFunctionInfo > NewSharedFunctionInfo(Handle< String > name, int number_of_literals, Handle< Code > code, Handle< ScopeInfo > scope_info)
Definition: factory.cc:1098
static const int kSourceIndex
Definition: objects.h:6437
kPropertyAccessorsOffset kNamedPropertyHandlerOffset instance_template
Definition: objects-inl.h:3618
int global_ic_age()
Definition: heap.h:1595
Handle< Object > NewNumber(double value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:581
Handle< JSObject > NewArgumentsObject(Handle< Object > callee, int length)
Definition: factory.cc:1266
Handle< Code > CopyCode(Handle< Code > code)
Definition: factory.cc:868
Handle< String > NumberToString(Handle< Object > number)
Definition: factory.cc:1144
void EnsureCanContainHeapObjectElements(Handle< JSArray > array)
Definition: factory.cc:1049
PropertyAttributes
Handle< String > LookupAsciiSymbol(Vector< const char > str)
Definition: factory.cc:174
Handle< JSMessageObject > NewJSMessageObject(Handle< String > type, Handle< JSArray > arguments, int start_position, int end_position, Handle< Object > script, Handle< Object > stack_trace, Handle< Object > stack_frames)
Definition: factory.cc:1118
Handle< Object > NewSyntaxError(const char *type, Handle< JSArray > args)
Definition: factory.cc:636
Handle< DescriptorArray > NewDescriptorArray(int number_of_descriptors)
Definition: factory.cc:115
Handle< Context > NewModuleContext(Handle< Context > previous, Handle< ScopeInfo > scope_info)
Definition: factory.cc:296
static Smi * cast(Object *object)
Handle< String > EmergencyNewError(const char *type, Handle< JSArray > args)
Definition: factory.cc:682
Handle< SeededNumberDictionary > DictionaryAtNumberPut(Handle< SeededNumberDictionary >, uint32_t key, Handle< Object > value)
Definition: factory.cc:1156
Handle< Map > GetElementsTransitionMap(Handle< JSObject > object, ElementsKind elements_kind)
Definition: factory.cc:506
Handle< String > NewStringFromUtf8(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:207
Handle< Object > NewRangeError(const char *type, Vector< Handle< Object > > args)
Definition: factory.cc:625
void ConfigureInstance(Handle< FunctionTemplateInfo > desc, Handle< JSObject > instance, bool *pending_exception)
Definition: factory.cc:1460
Handle< StringDictionary > NewStringDictionary(int at_least_space_for)
Definition: factory.cc:73
Handle< Map > CopyMap(Handle< Map > map, int extra_inobject_props)
Definition: factory.cc:474
static const int kIrregexpUC16CodeSavedIndex
Definition: objects.h:6461
Handle< JSFunction > NewFunction(Handle< String > name, Handle< Object > prototype)
Definition: factory.cc:1188
Handle< SeqTwoByteString > NewRawTwoByteString(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:234
void SetLastScriptId(Object *last_script_id)
Definition: heap-inl.h:489
#define MUST_USE_RESULT
Definition: globals.h:360
Handle< JSObject > NewNeanderObject()
Definition: factory.cc:605
Handle< ScopeInfo > NewScopeInfo(int length)
Definition: factory.cc:849
static const int kLiteralGlobalContextIndex
Definition: objects.h:5994
Handle< Map > CopyMapDropTransitions(Handle< Map > map)
Definition: factory.cc:499
void SetIdentityHash(Handle< JSObject > object, Object *hash)
Definition: factory.cc:1091
static bool IsValid(intptr_t value)
Definition: objects-inl.h:1051
#define CALL_HEAP_FUNCTION(ISOLATE, FUNCTION_CALL, TYPE)
Definition: heap-inl.h:549
void SetRegExpAtomData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, Handle< Object > match_pattern)
Definition: factory.cc:1424
void SetElementsCapacityAndLength(Handle< JSArray > array, int capacity, int length)
Definition: factory.cc:1031
const int kPointerSize
Definition: globals.h:234
Handle< Object > ToBoolean(bool value)
Definition: factory.cc:1485
static const int kMaxInstanceSize
Definition: objects.h:2106
Handle< Object > GlobalConstantFor(Handle< String > name)
Definition: factory.cc:1476
Handle< String > LookupSymbol(Vector< const char > str)
Definition: factory.cc:161
Handle< JSObject > NewJSObjectFromMap(Handle< Map > map)
Definition: factory.cc:997
Handle< String > NewStringFromTwoByte(Vector< const uc16 > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:216
Handle< ExternalArray > NewExternalArray(int length, ExternalArrayType array_type, void *external_pointer, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:427
static Handle< Object > SetLocalPropertyIgnoreAttributes(Handle< JSObject > object, Handle< String > key, Handle< Object > value, PropertyAttributes attributes)
Definition: objects.cc:2924
Handle< ByteArray > NewByteArray(int length, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:418
Handle< FixedDoubleArray > NewFixedDoubleArray(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:63
Handle< FixedArray > NewFixedArray(int size, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:44
Handle< JSModule > NewJSModule()
Definition: factory.cc:981
Handle< GlobalObject > NewGlobalObject(Handle< JSFunction > constructor)
Definition: factory.cc:988
static const int kIrregexpCaptureCountIndex
Definition: objects.h:6467
Handle< Object > ToObject(Handle< Object > object)
Definition: factory.cc:1222
Handle< Context > NewBlockContext(Handle< JSFunction > function, Handle< Context > previous, Handle< ScopeInfo > scope_info)
Definition: factory.cc:338
static MUST_USE_RESULT MaybeObject * Allocate(int at_least_space_for)
Handle< FixedArray > CopyFixedArray(Handle< FixedArray > array)
Definition: factory.cc:516
Vector< const char > CStrVector(const char *data)
Definition: utils.h:525
void SetContent(Handle< JSArray > array, Handle< FixedArrayBase > elements)
Definition: factory.cc:1041
Handle< JSArray > NewJSArrayWithElements(Handle< FixedArrayBase > elements, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:1019
Handle< Object > NewNumberFromInt(int32_t value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:589
Handle< String > NewProperSubString(Handle< String > str, int begin, int end)
Definition: factory.cc:260
Handle< DeoptimizationInputData > NewDeoptimizationInputData(int deopt_entry_count, PretenureFlag pretenure)
Definition: factory.cc:124
Handle< JSProxy > NewJSProxy(Handle< Object > handler, Handle< Object > prototype)
Definition: factory.cc:1066
Handle< JSFunction > NewFunctionWithoutPrototype(Handle< String > name, LanguageMode language_mode)
Definition: factory.cc:1212
Handle< DeoptimizationOutputData > NewDeoptimizationOutputData(int deopt_entry_count, PretenureFlag pretenure)
Definition: factory.cc:135
Handle< String > NewStringFromAscii(Vector< const char > str, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:199
static const int kAtomDataSize
Definition: objects.h:6445
Handle< String > NewExternalStringFromTwoByte(const ExternalTwoByteString::Resource *resource)
Definition: factory.cc:279
Handle< TypeFeedbackInfo > NewTypeFeedbackInfo()
Definition: factory.cc:153
Handle< Object > NewReferenceError(const char *type, Vector< Handle< Object > > args)
Definition: factory.cc:646
Handle< JSFunction > CreateApiFunction(Handle< FunctionTemplateInfo > data, ApiInstanceType type=JavaScriptObject)
Definition: factory.cc:1274
static const int kAtomPatternIndex
Definition: objects.h:6443
void EnsureCanContainElements(Handle< JSArray > array, Handle< FixedArrayBase > elements, uint32_t length, EnsureElementsMode mode)
Definition: factory.cc:1056
ElementsKind GetInitialFastElementsKind()
void BecomeJSObject(Handle< JSReceiver > object)
Definition: factory.cc:1075
Handle< Object > NewTypeError(const char *type, Vector< Handle< Object > > args)
Definition: factory.cc:614
Handle< T > EscapeFrom(v8::HandleScope *scope)
Definition: api.h:254
static Handle< T > null()
Definition: handles.h:86
Handle< Map > ObjectLiteralMapFromCache(Handle< Context > context, Handle< FixedArray > keys)
Definition: factory.cc:1403
Handle< Foreign > NewForeign(Address addr, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:406
Handle< Context > NewGlobalContext()
Definition: factory.cc:288
Handle< String > Uint32ToString(uint32_t value)
Definition: factory.cc:1150
static void StrNCpy(Vector< char > dest, const char *src, size_t n)
static AccessorInfo * cast(Object *obj)
static const int kHeaderSize
Definition: objects.h:2115
Handle< FixedDoubleArray > CopyFixedDoubleArray(Handle< FixedDoubleArray > array)
Definition: factory.cc:521
Handle< Map > CopyMapDropDescriptors(Handle< Map > map)
Definition: factory.cc:469
static const int kFlagsIndex
Definition: objects.h:6438
static VisitorId GetVisitorId(int instance_type, int instance_size)
Handle< String > LookupTwoByteSymbol(Vector< const uc16 > str)
Definition: factory.cc:192
static const int kSize
Definition: objects.h:5990
Handle< Context > NewWithContext(Handle< JSFunction > function, Handle< Context > previous, Handle< JSObject > extension)
Definition: factory.cc:328
Handle< Code > NewCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false)
Definition: factory.cc:857
Handle< Struct > NewStruct(InstanceType type)
Definition: factory.cc:350
static const int kTagIndex
Definition: objects.h:6436
void SetRegExpIrregexpData(Handle< JSRegExp > regexp, JSRegExp::Type type, Handle< String > source, JSRegExp::Flags flags, int capture_count)
Definition: factory.cc:1438
Handle< AccessorPair > NewAccessorPair()
Definition: factory.cc:146
T Min(T a, T b)
Definition: utils.h:229
static const int kSize
Definition: objects.h:6111
Handle< Object > NewEvalError(const char *type, Vector< Handle< Object > > args)
Definition: factory.cc:670
static const int kUninitializedValue
Definition: objects.h:6490
Handle< Map > NewMap(InstanceType type, int instance_size, ElementsKind elements_kind=TERMINAL_FAST_ELEMENTS_KIND)
Definition: factory.cc:451
Handle< String > NewConsString(Handle< String > first, Handle< String > second)
Definition: factory.cc:243
static MUST_USE_RESULT MaybeObject * Allocate(int number_of_deopt_points, PretenureFlag pretenure)
Definition: objects.cc:6092
static const int kNotFound
Definition: objects.h:2606
Handle< Object > NewNumberFromUint(uint32_t value, PretenureFlag pretenure=NOT_TENURED)
Definition: factory.cc:597
#define ARRAY_SIZE(a)
Definition: globals.h:295
Handle< ObjectHashSet > NewObjectHashSet(int at_least_space_for)
Definition: factory.cc:99
Handle< JSGlobalPropertyCell > NewJSGlobalPropertyCell(Handle< Object > value)
Definition: factory.cc:442
FlagType type() const
Definition: flags.cc:1358
Handle< UnseededNumberDictionary > NewUnseededNumberDictionary(int at_least_space_for)
Definition: factory.cc:90
static MUST_USE_RESULT MaybeObject * Allocate(int number_of_descriptors, SharedMode shared_mode)
Definition: objects.cc:5754
void BecomeJSFunction(Handle< JSReceiver > object)
Definition: factory.cc:1083
Handle< Object > NewError(const char *maker, const char *type, Handle< JSArray > args)
Definition: factory.cc:719
Handle< SeededNumberDictionary > NewSeededNumberDictionary(int at_least_space_for)
Definition: factory.cc:81
static const int kLiteralsPrefixSize
Definition: objects.h:5993
static JSFunction * cast(Object *obj)