46 template <BuiltinExtraArguments extra_args>
47 class BuiltinArguments :
public Arguments {
49 BuiltinArguments(
int length,
Object** arguments)
50 : Arguments(length, arguments) { }
52 Object*& operator[] (
int index) {
57 template <
class S> Handle<S> at(
int index) {
59 return Arguments::at<S>(index);
62 Handle<Object> receiver() {
63 return Arguments::at<Object>(0);
66 Handle<JSFunction> called_function() {
68 return Arguments::at<JSFunction>(Arguments::length() - 1);
75 return Arguments::length();
81 ASSERT(Arguments::length() >= 1);
90 int BuiltinArguments<NEEDS_CALLED_FUNCTION>::length()
const {
91 return Arguments::length() - 1;
96 void BuiltinArguments<NEEDS_CALLED_FUNCTION>::Verify() {
98 ASSERT(Arguments::length() >= 2);
105 #define DEF_ARG_TYPE(name, spec) \
106 typedef BuiltinArguments<spec> name##ArgumentsType;
127 #define BUILTIN(name) \
128 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \
129 name##ArgumentsType args, Isolate* isolate); \
130 MUST_USE_RESULT static MaybeObject* Builtin_##name( \
131 name##ArgumentsType args, Isolate* isolate) { \
132 ASSERT(isolate == Isolate::Current()); \
134 return Builtin_Impl_##name(args, isolate); \
136 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \
137 name##ArgumentsType args, Isolate* isolate)
139 #else // For release mode.
141 #define BUILTIN(name) \
142 static MaybeObject* Builtin_##name(name##ArgumentsType args, Isolate* isolate)
147 static inline bool CalledAsConstructor(Isolate* isolate) {
152 StackFrameIterator it;
153 ASSERT(it.frame()->is_exit());
156 bool reference_result = frame->is_construct();
168 const Smi* kConstructMarker =
Smi::FromInt(StackFrame::CONSTRUCT);
170 bool result = (marker == kConstructMarker);
179 return isolate->heap()->undefined_value();
184 return isolate->heap()->undefined_value();
188 static MaybeObject* ArrayCodeGenericCommon(
Arguments* args,
190 JSFunction* constructor) {
191 Heap* heap = isolate->heap();
192 isolate->counters()->array_function_runtime()->Increment();
195 if (CalledAsConstructor(isolate)) {
200 array->set_elements(heap->empty_fixed_array());
201 if (!FLAG_smi_only_arrays) {
202 Context* global_context = isolate->context()->global_context();
204 !global_context->js_array_maps()->IsUndefined()) {
205 FixedArray* map_array =
213 MaybeObject* maybe_obj = heap->AllocateJSObject(constructor);
214 if (!maybe_obj->To(&array))
return maybe_obj;
219 if (args->length() == 2) {
225 { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(len);
226 if (!maybe_obj->ToObject(&fixed_array))
return maybe_obj;
231 MaybeObject* maybe_array =
232 array->TransitionElementsKind(elements_kind);
233 if (maybe_array->IsFailure())
return maybe_array;
242 { MaybeObject* maybe_obj = array->Initialize(0);
243 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
245 return array->SetElementsLength((*args)[1]);
249 if (args->length() == 1) {
254 int number_of_elements = args->length() - 1;
255 MaybeObject* maybe_object =
256 array->EnsureCanContainElements(args, 1, number_of_elements,
258 if (maybe_object->IsFailure())
return maybe_object;
261 MaybeObject* maybe_elms;
264 maybe_elms = heap->AllocateUninitializedFixedDoubleArray(
267 maybe_elms = heap->AllocateFixedArrayWithHoles(number_of_elements);
269 FixedArrayBase* elms;
270 if (!maybe_elms->To<FixedArrayBase>(&elms))
return maybe_elms;
273 switch (array->GetElementsKind()) {
277 for (
int index = 0; index < number_of_elements; index++) {
284 AssertNoAllocation no_gc;
287 for (
int index = 0; index < number_of_elements; index++) {
288 object_elms->set(index, (*args)[index+1], mode);
295 for (
int index = 0; index < number_of_elements; index++) {
296 double_elms->set(index, (*args)[index+1]->Number());
305 array->set_elements(elms);
312 return ArrayCodeGenericCommon(
315 isolate->context()->global_context()->internal_array_function());
320 return ArrayCodeGenericCommon(
323 isolate->context()->global_context()->array_function());
327 static void MoveElements(Heap* heap,
328 AssertNoAllocation* no_gc,
334 if (len == 0)
return;
335 ASSERT(dst->map() !=
HEAP->fixed_cow_array_map());
336 memmove(dst->data_start() + dst_index,
337 src->data_start() + src_index,
341 heap->RecordWrites(dst->address(), dst->OffsetOfElementAt(dst_index), len);
343 heap->incremental_marking()->RecordWrites(dst);
347 static void FillWithHoles(Heap* heap, FixedArray* dst,
int from,
int to) {
348 ASSERT(dst->map() != heap->fixed_cow_array_map());
349 MemsetPointer(dst->data_start() + from, heap->the_hole_value(), to - from);
353 static FixedArray* LeftTrimFixedArray(Heap* heap,
356 ASSERT(elms->map() !=
HEAP->fixed_cow_array_map());
368 const int len = elms->length();
371 !heap->new_space()->Contains(elms)) {
375 Object** zap =
reinterpret_cast<Object**
>(elms->address());
377 for (
int i = 1; i < to_trim; i++) {
384 heap->CreateFillerObjectAt(elms->address(), to_trim *
kPointerSize);
386 former_start[to_trim] = heap->fixed_array_map();
387 former_start[to_trim + 1] =
Smi::FromInt(len - to_trim);
392 if (heap->marking()->TransferMark(elms->address(),
393 elms->address() + size_delta)) {
398 elms->address() + size_delta));
404 static bool ArrayPrototypeHasNoElements(Heap* heap,
405 Context* global_context,
406 JSObject* array_proto) {
409 if (array_proto->elements() != heap->empty_fixed_array())
return false;
411 Object* proto = array_proto->GetPrototype();
412 if (proto == heap->null_value())
return false;
414 if (array_proto != global_context->initial_object_prototype())
return false;
415 if (array_proto->elements() != heap->empty_fixed_array())
return false;
416 return array_proto->GetPrototype()->IsNull();
421 static inline MaybeObject* EnsureJSArrayWithWritableFastElements(
422 Heap* heap,
Object* receiver, Arguments* args,
int first_added_arg) {
423 if (!receiver->IsJSArray())
return NULL;
425 HeapObject* elms = array->elements();
426 Map* map = elms->map();
427 if (map == heap->fixed_array_map()) {
428 if (args ==
NULL || array->HasFastObjectElements())
return elms;
429 if (array->HasFastDoubleElements()) {
430 ASSERT(elms == heap->empty_fixed_array());
431 MaybeObject* maybe_transition =
433 if (maybe_transition->IsFailure())
return maybe_transition;
436 }
else if (map == heap->fixed_cow_array_map()) {
437 MaybeObject* maybe_writable_result = array->EnsureWritableFastElements();
438 if (args ==
NULL || array->HasFastObjectElements() ||
439 maybe_writable_result->IsFailure()) {
440 return maybe_writable_result;
448 int args_length = args->length();
449 if (first_added_arg >= args_length)
return array->elements();
451 MaybeObject* maybe_array = array->EnsureCanContainElements(
454 args_length - first_added_arg,
456 if (maybe_array->IsFailure())
return maybe_array;
457 return array->elements();
461 static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap,
463 if (!FLAG_clever_optimizations)
return false;
464 Context* global_context = heap->isolate()->context()->global_context();
465 JSObject* array_proto =
468 ArrayPrototypeHasNoElements(heap, global_context, array_proto);
475 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) {
476 HandleScope handleScope(isolate);
478 Handle<Object> js_builtin =
479 GetProperty(Handle<JSObject>(isolate->global_context()->builtins()),
482 int argc = args.length() - 1;
483 ScopedVector<Handle<Object> > argv(argc);
484 for (
int i = 0; i < argc; ++i) {
485 argv[i] = args.at<
Object>(i + 1);
487 bool pending_exception;
499 Heap* heap = isolate->heap();
500 Object* receiver = *args.receiver();
502 { MaybeObject* maybe_elms_obj =
503 EnsureJSArrayWithWritableFastElements(heap, receiver, &args, 1);
504 if (maybe_elms_obj ==
NULL) {
505 return CallJsBuiltin(isolate,
"ArrayPush", args);
507 if (!maybe_elms_obj->ToObject(&elms_obj))
return maybe_elms_obj;
512 int len =
Smi::cast(array->length())->value();
513 int to_add = args.length() - 1;
521 int new_length = len + to_add;
523 if (new_length > elms->
length()) {
525 int capacity = new_length + (new_length >> 1) + 16;
528 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
534 FillWithHoles(heap, new_elms, new_length, capacity);
542 for (
int index = 0; index < to_add; index++) {
543 elms->
set(index + len, args[index + 1], mode);
546 if (elms != array->elements()) {
547 array->set_elements(elms);
557 Heap* heap = isolate->heap();
558 Object* receiver = *args.receiver();
560 { MaybeObject* maybe_elms_obj =
561 EnsureJSArrayWithWritableFastElements(heap, receiver,
NULL, 0);
562 if (maybe_elms_obj ==
NULL)
return CallJsBuiltin(isolate,
"ArrayPop", args);
563 if (!maybe_elms_obj->ToObject(&elms_obj))
return maybe_elms_obj;
568 int len =
Smi::cast(array->length())->value();
569 if (len == 0)
return heap->undefined_value();
572 MaybeObject* top = elms->
get(len - 1);
577 if (!top->IsTheHole()) {
590 Heap* heap = isolate->heap();
591 Object* receiver = *args.receiver();
593 { MaybeObject* maybe_elms_obj =
594 EnsureJSArrayWithWritableFastElements(heap, receiver,
NULL, 0);
595 if (maybe_elms_obj ==
NULL)
596 return CallJsBuiltin(isolate,
"ArrayShift", args);
597 if (!maybe_elms_obj->ToObject(&elms_obj))
return maybe_elms_obj;
599 if (!IsJSArrayFastElementMovingAllowed(heap,
JSArray::cast(receiver))) {
600 return CallJsBuiltin(isolate,
"ArrayShift", args);
606 int len =
Smi::cast(array->length())->value();
607 if (len == 0)
return heap->undefined_value();
611 if (first->IsTheHole()) {
612 first = heap->undefined_value();
616 array->set_elements(LeftTrimFixedArray(heap, elms, 1));
620 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1);
621 elms->
set(len - 1, heap->the_hole_value());
632 Heap* heap = isolate->heap();
633 Object* receiver = *args.receiver();
635 { MaybeObject* maybe_elms_obj =
636 EnsureJSArrayWithWritableFastElements(heap, receiver,
NULL, 0);
637 if (maybe_elms_obj ==
NULL)
638 return CallJsBuiltin(isolate,
"ArrayUnshift", args);
639 if (!maybe_elms_obj->ToObject(&elms_obj))
return maybe_elms_obj;
641 if (!IsJSArrayFastElementMovingAllowed(heap,
JSArray::cast(receiver))) {
642 return CallJsBuiltin(isolate,
"ArrayUnshift", args);
648 int len =
Smi::cast(array->length())->value();
649 int to_add = args.length() - 1;
650 int new_length = len + to_add;
655 MaybeObject* maybe_object =
658 if (maybe_object->IsFailure())
return maybe_object;
660 if (new_length > elms->
length()) {
662 int capacity = new_length + (new_length >> 1) + 16;
665 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
670 FillWithHoles(heap, new_elms, new_length, capacity);
672 array->set_elements(elms);
675 MoveElements(heap, &no_gc, elms, to_add, elms, 0, len);
681 for (
int i = 0; i < to_add; i++) {
682 elms->
set(i, args[i + 1], mode);
692 Heap* heap = isolate->heap();
693 Object* receiver = *args.receiver();
696 if (receiver->IsJSArray()) {
699 !IsJSArrayFastElementMovingAllowed(heap, array)) {
700 return CallJsBuiltin(isolate,
"ArraySlice", args);
704 len =
Smi::cast(array->length())->value();
709 isolate->context()->global_context()->arguments_boilerplate()->
map();
711 bool is_arguments_object_with_fast_elements =
712 receiver->IsJSObject()
715 if (!is_arguments_object_with_fast_elements) {
716 return CallJsBuiltin(isolate,
"ArraySlice", args);
721 if (!len_obj->IsSmi()) {
722 return CallJsBuiltin(isolate,
"ArraySlice", args);
725 if (len > elms->
length()) {
726 return CallJsBuiltin(isolate,
"ArraySlice", args);
728 for (
int i = 0; i < len; i++) {
729 if (elms->
get(i) == heap->the_hole_value()) {
730 return CallJsBuiltin(isolate,
"ArraySlice", args);
735 int n_arguments = args.length() - 1;
740 int relative_start = 0;
741 int relative_end = len;
742 if (n_arguments > 0) {
746 }
else if (!arg1->IsUndefined()) {
747 return CallJsBuiltin(isolate,
"ArraySlice", args);
749 if (n_arguments > 1) {
753 }
else if (!arg2->IsUndefined()) {
754 return CallJsBuiltin(isolate,
"ArraySlice", args);
760 int k = (relative_start < 0) ?
Max(len + relative_start, 0)
761 :
Min(relative_start, len);
764 int final = (relative_end < 0) ?
Max(len + relative_end, 0)
765 :
Min(relative_end, len);
770 int result_len =
Max(
final - k, 0);
772 MaybeObject* maybe_array =
777 if (!maybe_array->To(&result_array))
return maybe_array;
781 elements_kind, 0, result_len);
788 Heap* heap = isolate->heap();
789 Object* receiver = *args.receiver();
791 { MaybeObject* maybe_elms_obj =
792 EnsureJSArrayWithWritableFastElements(heap, receiver, &args, 3);
793 if (maybe_elms_obj ==
NULL)
794 return CallJsBuiltin(isolate,
"ArraySplice", args);
795 if (!maybe_elms_obj->ToObject(&elms_obj))
return maybe_elms_obj;
797 if (!IsJSArrayFastElementMovingAllowed(heap,
JSArray::cast(receiver))) {
798 return CallJsBuiltin(isolate,
"ArraySplice", args);
804 int len =
Smi::cast(array->length())->value();
806 int n_arguments = args.length() - 1;
808 int relative_start = 0;
809 if (n_arguments > 0) {
813 }
else if (!arg1->IsUndefined()) {
814 return CallJsBuiltin(isolate,
"ArraySplice", args);
817 int actual_start = (relative_start < 0) ?
Max(len + relative_start, 0)
818 :
Min(relative_start, len);
825 int actual_delete_count;
826 if (n_arguments == 1) {
827 ASSERT(len - actual_start >= 0);
828 actual_delete_count = len - actual_start;
831 if (n_arguments > 1) {
836 return CallJsBuiltin(isolate,
"ArraySplice", args);
839 actual_delete_count =
Min(
Max(value, 0), len - actual_start);
845 MaybeObject* maybe_array =
848 actual_delete_count);
849 if (!maybe_array->To(&result_array))
return maybe_array;
855 elements_kind, 0, actual_delete_count);
858 int item_count = (n_arguments > 1) ? (n_arguments - 2) : 0;
859 int new_length = len - actual_delete_count + item_count;
861 bool elms_changed =
false;
862 if (item_count < actual_delete_count) {
865 ((actual_start + item_count) <
866 (len - actual_delete_count - actual_start));
868 const int delta = actual_delete_count - item_count;
872 MoveElements(heap, &no_gc, elms, delta, elms, 0, actual_start);
875 elms = LeftTrimFixedArray(heap, elms, delta);
880 MoveElements(heap, &no_gc,
881 elms, actual_start + item_count,
882 elms, actual_start + actual_delete_count,
883 (len - actual_delete_count - actual_start));
884 FillWithHoles(heap, elms, new_length, len);
886 }
else if (item_count > actual_delete_count) {
892 if (new_length > elms->
length()) {
894 int capacity = new_length + (new_length >> 1) + 16;
896 { MaybeObject* maybe_obj =
898 if (!maybe_obj->ToObject(&obj))
return maybe_obj;
906 new_elms, kind, 0, actual_start);
907 const int to_copy = len - actual_delete_count - actual_start;
909 actual_start + actual_delete_count,
911 actual_start + item_count, to_copy);
914 FillWithHoles(heap, new_elms, new_length, capacity);
920 MoveElements(heap, &no_gc,
921 elms, actual_start + item_count,
922 elms, actual_start + actual_delete_count,
923 (len - actual_delete_count - actual_start));
929 for (
int k = actual_start; k < actual_start + item_count; k++) {
930 elms->
set(k, args[3 + k - actual_start], mode);
934 array->set_elements(elms);
945 Heap* heap = isolate->heap();
949 if (!ArrayPrototypeHasNoElements(heap, global_context, array_proto)) {
950 return CallJsBuiltin(isolate,
"ArrayConcat", args);
955 int n_arguments = args.length();
958 for (
int i = 0; i < n_arguments; i++) {
960 if (!arg->IsJSArray() ||
963 return CallJsBuiltin(isolate,
"ArrayConcat", args);
976 return CallJsBuiltin(isolate,
"ArrayConcat", args);
996 MaybeObject* maybe_array =
1000 if (!maybe_array->To(&result_array))
return maybe_array;
1001 if (result_len == 0)
return result_array;
1006 for (
int i = 0; i < n_arguments; i++) {
1008 int len =
Smi::cast(array->length())->value();
1011 result_elms, elements_kind,
1015 ASSERT(start_pos == result_len);
1017 return result_array;
1027 return isolate->Throw(*isolate->factory()->NewTypeError(
1028 "strict_poison_pill", HandleVector<Object>(
NULL, 0)));
1041 static inline Object* TypeCheck(Heap* heap,
1044 FunctionTemplateInfo* info) {
1047 if (!recv->IsJSObject())
return heap->null_value();
1048 Object* sig_obj = info->signature();
1052 Object* recv_type = sig->receiver();
1056 for (; holder != heap->null_value(); holder = holder->
GetPrototype()) {
1061 if (holder == heap->null_value())
return holder;
1063 Object* args_obj = sig->args();
1065 if (args_obj->IsUndefined())
return holder;
1067 int length = args->length();
1068 if (argc <= length) length = argc - 1;
1069 for (
int i = 0; i < length; i++) {
1070 Object* argtype = args->get(i);
1071 if (argtype->IsUndefined())
continue;
1072 Object** arg = &argv[-1 - i];
1074 for (; current != heap->null_value(); current = current->GetPrototype()) {
1080 if (current == heap->null_value()) *arg = heap->undefined_value();
1086 template <
bool is_construct>
1088 BuiltinArguments<NEEDS_CALLED_FUNCTION> args, Isolate* isolate) {
1089 ASSERT(is_construct == CalledAsConstructor(isolate));
1090 Heap* heap = isolate->heap();
1092 HandleScope scope(isolate);
1093 Handle<JSFunction>
function = args.called_function();
1094 ASSERT(function->shared()->IsApiFunction());
1096 FunctionTemplateInfo* fun_data =
function->shared()->get_api_func_data();
1098 Handle<FunctionTemplateInfo> desc(fun_data, isolate);
1099 bool pending_exception =
false;
1100 isolate->factory()->ConfigureInstance(
1101 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception);
1102 ASSERT(isolate->has_pending_exception() == pending_exception);
1107 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data);
1109 if (raw_holder->IsNull()) {
1111 Handle<Object> obj =
1112 isolate->factory()->NewTypeError(
1114 return isolate->Throw(*obj);
1117 Object* raw_call_data = fun_data->call_code();
1118 if (!raw_call_data->IsUndefined()) {
1120 Object* callback_obj = call_data->callback();
1122 v8::ToCData<v8::InvocationCallback>(callback_obj);
1123 Object* data_obj = call_data->data();
1127 ASSERT(raw_holder->IsJSObject());
1129 CustomArguments custom(isolate);
1131 isolate, data_obj, *
function, raw_holder);
1142 VMState state(isolate, EXTERNAL);
1143 ExternalCallbackScope call_scope(isolate,
1144 v8::ToCData<Address>(callback_obj));
1145 value = callback(new_args);
1147 if (value.IsEmpty()) {
1148 result = heap->undefined_value();
1150 result = *
reinterpret_cast<Object**
>(*value);
1154 if (!is_construct || result->IsJSObject())
return result;
1157 return *args.receiver();
1162 return HandleApiCallHelper<false>(args, isolate);
1167 return HandleApiCallHelper<true>(args, isolate);
1174 MUST_USE_RESULT static MaybeObject* HandleApiCallAsFunctionOrConstructor(
1176 bool is_construct_call,
1177 BuiltinArguments<NO_EXTRA_ARGUMENTS> args) {
1180 ASSERT(!CalledAsConstructor(isolate));
1181 Heap* heap = isolate->heap();
1190 ASSERT(obj->map()->has_instance_call_handler());
1192 ASSERT(constructor->shared()->IsApiFunction());
1194 constructor->shared()->get_api_func_data()->instance_call_handler();
1195 ASSERT(!handler->IsUndefined());
1197 Object* callback_obj = call_data->callback();
1199 v8::ToCData<v8::InvocationCallback>(callback_obj);
1205 LOG(isolate, ApiObjectAccess(
"call non-function", obj));
1207 CustomArguments custom(isolate);
1209 isolate, call_data->data(), constructor, obj);
1218 VMState state(isolate, EXTERNAL);
1219 ExternalCallbackScope call_scope(isolate,
1220 v8::ToCData<Address>(callback_obj));
1221 value = callback(new_args);
1223 if (value.IsEmpty()) {
1224 result = heap->undefined_value();
1226 result = *
reinterpret_cast<Object**
>(*value);
1238 return HandleApiCallAsFunctionOrConstructor(isolate,
false, args);
1245 return HandleApiCallAsFunctionOrConstructor(isolate,
true, args);
1249 static void Generate_LoadIC_ArrayLength(MacroAssembler* masm) {
1254 static void Generate_LoadIC_StringLength(MacroAssembler* masm) {
1259 static void Generate_LoadIC_StringWrapperLength(MacroAssembler* masm) {
1264 static void Generate_LoadIC_FunctionPrototype(MacroAssembler* masm) {
1269 static void Generate_LoadIC_Initialize(MacroAssembler* masm) {
1274 static void Generate_LoadIC_PreMonomorphic(MacroAssembler* masm) {
1279 static void Generate_LoadIC_Miss(MacroAssembler* masm) {
1284 static void Generate_LoadIC_Megamorphic(MacroAssembler* masm) {
1289 static void Generate_LoadIC_Normal(MacroAssembler* masm) {
1294 static void Generate_KeyedLoadIC_Initialize(MacroAssembler* masm) {
1299 static void Generate_KeyedLoadIC_Slow(MacroAssembler* masm) {
1304 static void Generate_KeyedLoadIC_Miss(MacroAssembler* masm) {
1309 static void Generate_KeyedLoadIC_MissForceGeneric(MacroAssembler* masm) {
1314 static void Generate_KeyedLoadIC_Generic(MacroAssembler* masm) {
1319 static void Generate_KeyedLoadIC_String(MacroAssembler* masm) {
1324 static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) {
1328 static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) {
1332 static void Generate_KeyedLoadIC_NonStrictArguments(MacroAssembler* masm) {
1336 static void Generate_StoreIC_Initialize(MacroAssembler* masm) {
1341 static void Generate_StoreIC_Initialize_Strict(MacroAssembler* masm) {
1346 static void Generate_StoreIC_Miss(MacroAssembler* masm) {
1351 static void Generate_StoreIC_Normal(MacroAssembler* masm) {
1356 static void Generate_StoreIC_Normal_Strict(MacroAssembler* masm) {
1361 static void Generate_StoreIC_Megamorphic(MacroAssembler* masm) {
1366 static void Generate_StoreIC_Megamorphic_Strict(MacroAssembler* masm) {
1371 static void Generate_StoreIC_ArrayLength(MacroAssembler* masm) {
1376 static void Generate_StoreIC_ArrayLength_Strict(MacroAssembler* masm) {
1381 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) {
1386 static void Generate_StoreIC_GlobalProxy_Strict(MacroAssembler* masm) {
1391 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
1396 static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) {
1401 static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
1406 static void Generate_KeyedStoreIC_MissForceGeneric(MacroAssembler* masm) {
1411 static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) {
1416 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) {
1421 static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) {
1425 static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) {
1429 static void Generate_TransitionElementsSmiToDouble(MacroAssembler* masm) {
1433 static void Generate_TransitionElementsDoubleToObject(MacroAssembler* masm) {
1437 #ifdef ENABLE_DEBUGGER_SUPPORT
1438 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) {
1439 Debug::GenerateLoadICDebugBreak(masm);
1443 static void Generate_StoreIC_DebugBreak(MacroAssembler* masm) {
1444 Debug::GenerateStoreICDebugBreak(masm);
1448 static void Generate_KeyedLoadIC_DebugBreak(MacroAssembler* masm) {
1449 Debug::GenerateKeyedLoadICDebugBreak(masm);
1453 static void Generate_KeyedStoreIC_DebugBreak(MacroAssembler* masm) {
1454 Debug::GenerateKeyedStoreICDebugBreak(masm);
1458 static void Generate_Return_DebugBreak(MacroAssembler* masm) {
1459 Debug::GenerateReturnDebugBreak(masm);
1463 static void Generate_CallFunctionStub_DebugBreak(MacroAssembler* masm) {
1464 Debug::GenerateCallFunctionStubDebugBreak(masm);
1468 static void Generate_CallFunctionStub_Recording_DebugBreak(
1469 MacroAssembler* masm) {
1470 Debug::GenerateCallFunctionStubRecordDebugBreak(masm);
1474 static void Generate_CallConstructStub_DebugBreak(MacroAssembler* masm) {
1475 Debug::GenerateCallConstructStubDebugBreak(masm);
1479 static void Generate_CallConstructStub_Recording_DebugBreak(
1480 MacroAssembler* masm) {
1481 Debug::GenerateCallConstructStubRecordDebugBreak(masm);
1485 static void Generate_Slot_DebugBreak(MacroAssembler* masm) {
1486 Debug::GenerateSlotDebugBreak(masm);
1490 static void Generate_PlainReturn_LiveEdit(MacroAssembler* masm) {
1491 Debug::GeneratePlainReturnLiveEdit(masm);
1495 static void Generate_FrameDropper_LiveEdit(MacroAssembler* masm) {
1496 Debug::GenerateFrameDropperLiveEdit(masm);
1501 Builtins::Builtins() : initialized_(
false) {
1502 memset(builtins_, 0,
sizeof(builtins_[0]) * builtin_count);
1503 memset(names_, 0,
sizeof(names_[0]) * builtin_count);
1507 Builtins::~Builtins() {
1511 #define DEF_ENUM_C(name, ignore) FUNCTION_ADDR(Builtin_##name),
1512 Address const Builtins::c_functions_[cfunction_count] = {
1517 #define DEF_JS_NAME(name, ignore) #name,
1518 #define DEF_JS_ARGC(ignore, argc) argc,
1519 const char*
const Builtins::javascript_names_[id_count] = {
1523 int const Builtins::javascript_argc_[id_count] = {
1538 #define BUILTIN_FUNCTION_TABLE_INIT { V8_ONCE_INIT, {} }
1543 CallOnce(&once_, &Builtins::InitBuiltinFunctionTable);
1560 void Builtins::InitBuiltinFunctionTable() {
1565 functions[builtin_count].
name = builtin_count;
1569 #define DEF_FUNCTION_PTR_C(aname, aextra_args) \
1570 functions->generator = FUNCTION_ADDR(Generate_Adaptor); \
1571 functions->c_code = FUNCTION_ADDR(Builtin_##aname); \
1572 functions->s_name = #aname; \
1573 functions->name = c_##aname; \
1574 functions->flags = Code::ComputeFlags(Code::BUILTIN); \
1575 functions->extra_args = aextra_args; \
1578 #define DEF_FUNCTION_PTR_A(aname, kind, state, extra) \
1579 functions->generator = FUNCTION_ADDR(Generate_##aname); \
1580 functions->c_code = NULL; \
1581 functions->s_name = #aname; \
1582 functions->name = k##aname; \
1583 functions->flags = Code::ComputeFlags(Code::kind, \
1586 functions->extra_args = NO_EXTRA_ARGUMENTS; \
1593 #undef DEF_FUNCTION_PTR_C
1594 #undef DEF_FUNCTION_PTR_A
1597 void Builtins::SetUp(
bool create_heap_objects) {
1599 Isolate* isolate = Isolate::Current();
1610 union {
int force_alignment;
byte buffer[4*
KB]; } u;
1614 for (
int i = 0; i < builtin_count; i++) {
1615 if (create_heap_objects) {
1619 Generator g = FUNCTION_CAST<Generator>(functions[i].
generator);
1624 g(&masm, functions[i].name, functions[i].extra_args);
1634 { MaybeObject* maybe_code =
1636 if (!maybe_code->ToObject(&code)) {
1643 CodeCreateEvent(Logger::BUILTIN_TAG,
1645 functions[i].s_name));
1647 functions[i].s_name,
1649 builtins_[i] = code;
1650 #ifdef ENABLE_DISASSEMBLER
1651 if (FLAG_print_builtin_code) {
1652 PrintF(
"Builtin: %s\n", functions[i].s_name);
1653 Code::cast(code)->Disassemble(functions[i].s_name);
1659 builtins_[i] =
NULL;
1661 names_[i] = functions[i].
s_name;
1665 initialized_ =
true;
1669 void Builtins::TearDown() {
1670 initialized_ =
false;
1674 void Builtins::IterateBuiltins(ObjectVisitor* v) {
1675 v->VisitPointers(&builtins_[0], &builtins_[0] + builtin_count);
1682 for (
int i = 0; i < builtin_count; i++) {
1683 Code* entry = Code::cast(builtins_[i]);
1693 #define DEFINE_BUILTIN_ACCESSOR_C(name, ignore) \
1694 Handle<Code> Builtins::name() { \
1695 Code** code_address = \
1696 reinterpret_cast<Code**>(builtin_address(k##name)); \
1697 return Handle<Code>(code_address); \
1699 #define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra) \
1700 Handle<Code> Builtins::name() { \
1701 Code** code_address = \
1702 reinterpret_cast<Code**>(builtin_address(k##name)); \
1703 return Handle<Code>(code_address); \
1708 #undef DEFINE_BUILTIN_ACCESSOR_C
1709 #undef DEFINE_BUILTIN_ACCESSOR_A
static void GenerateTransitionElementsDoubleToObject(MacroAssembler *masm)
BuiltinDesc functions_[Builtins::builtin_count+1]
static void GenerateRuntimeGetProperty(MacroAssembler *masm)
static const int kMaxLength
static Object *& Object_at(Address addr)
static CallHandlerInfo * cast(Object *obj)
#define BUILTINS_LIST_JS(V)
#define RETURN_IF_SCHEDULED_EXCEPTION(isolate)
void set(int index, Object *value)
void PrintF(const char *format,...)
static void PrepareArgumentsData(internal::Object **implicit_args, internal::Isolate *isolate, internal::Object *data, internal::JSFunction *callee, internal::Object *holder)
static void GenerateGeneric(MacroAssembler *masm, StrictModeFlag strict_mode)
void set_length(Smi *length)
Object * InObjectPropertyAt(int index)
static Smi * FromInt(int value)
#define LOG(isolate, Call)
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
static Handle< T > cast(Handle< S > that)
BuiltinDesc * functions()
void CallOnce(OnceType *once, NoArgFunction init_func)
static void GenerateGlobalProxy(MacroAssembler *masm, StrictModeFlag strict_mode)
static void GenerateMegamorphic(MacroAssembler *masm, StrictModeFlag strict_mode)
static Map * cast(Object *obj)
static void GenerateStringLength(MacroAssembler *masm, bool support_wrappers)
static Failure * Exception()
Context * global_context()
static void GenerateMegamorphic(MacroAssembler *masm)
#define ASSERT(condition)
#define PROFILE(isolate, Call)
#define DEFINE_BUILTIN_ACCESSOR_C(name, ignore)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
void set_the_hole(int index)
static Object ** RawField(HeapObject *obj, int offset)
static Smi * cast(Object *object)
static void GenerateArrayLength(MacroAssembler *masm)
bool HasFastSmiOrObjectElements()
HANDLE HANDLE LPSTACKFRAME64 StackFrame
Handle< Value >(* InvocationCallback)(const Arguments &args)
static v8::Arguments NewArguments(internal::Object **implicit_args, internal::Object **argv, int argc, bool is_construct_call)
STATIC_ASSERT((FixedDoubleArray::kHeaderSize &kDoubleAlignmentMask)==0)
static void GenerateInitialize(MacroAssembler *masm)
static Address c_entry_fp(ThreadLocalTop *thread)
#define HEAP_PROFILE(heap, call)
static const int kCallerFPOffset
V8EXPORT Local< Value > GetPrototype()
#define BUILTIN_FUNCTION_TABLE_INIT
ElementsKind GetElementsKind()
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
void GetCode(CodeDesc *desc)
static void GeneratePreMonomorphic(MacroAssembler *masm)
static void GenerateGeneric(MacroAssembler *masm)
static Address & Address_at(Address addr)
static void GenerateInitialize(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm)
static FunctionTemplateInfo * cast(Object *obj)
static FixedDoubleArray * cast(Object *obj)
#define DEF_FUNCTION_PTR_C(aname, aextra_args)
bool IsFastSmiElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * AllocateJSArrayAndStorage(ElementsKind elements_kind, int length, int capacity, ArrayStorageAllocationMode mode=DONT_INITIALIZE_ARRAY_ELEMENTS, PretenureFlag pretenure=NOT_TENURED)
WriteBarrierMode GetWriteBarrierMode(const AssertNoAllocation &)
LargeObjectSpace * lo_space()
MUST_USE_RESULT MaybeObject * CreateCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false)
static Handle< Object > Call(Handle< Object > callable, Handle< Object > receiver, int argc, Handle< Object > argv[], bool *pending_exception, bool convert_receiver=false)
static JSArray * cast(Object *obj)
static const int kHeaderSize
#define DEF_ENUM_C(name, ignore)
void CopyObjectToObjectElements(FixedArray *from, ElementsKind from_kind, uint32_t from_start, FixedArray *to, ElementsKind to_kind, uint32_t to_start, int raw_copy_size)
static void GenerateSlow(MacroAssembler *masm)
bool Contains(HeapObject *obj)
static const int kMapOffset
#define BUILTIN_LIST_DEBUG_A(V)
static const int kLengthOffset
Local< Value > operator[](int i) const
static const int kArgumentsLengthIndex
ElementsKind GetInitialFastElementsKind()
static void GenerateString(MacroAssembler *masm)
MUST_USE_RESULT MaybeObject * AllocateUninitializedFixedArray(int length)
#define DEF_JS_ARGC(ignore, argc)
Handle< Object > CodeObject()
void MemsetPointer(T **dest, U *value, int counter)
static void IncrementLiveBytesFromMutator(Address address, int by)
#define ASSERT_EQ(v1, v2)
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
static void GenerateNonStrictArguments(MacroAssembler *masm)
static HeapObject * FromAddress(Address address)
static FixedArray * cast(Object *obj)
static void GenerateNormal(MacroAssembler *masm)
static void GenerateFunctionPrototype(MacroAssembler *masm)
static void GenerateIndexedInterceptor(MacroAssembler *masm)
static Handle< Object > GetElement(Handle< Object > object, uint32_t index)
static const int kPreallocatedArrayElements
bool IsFastHoleyElementsKind(ElementsKind kind)
static void GenerateInitialize(MacroAssembler *masm)
#define DEF_FUNCTION_PTR_A(aname, kind, state, extra)
Vector< Handle< Object > > HandleVector(v8::internal::Handle< T > *elms, int length)
static void GenerateNonStrictArguments(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm, bool force_generic)
#define DEFINE_BUILTIN_ACCESSOR_A(name, kind, state, extra)
static void GenerateMiss(MacroAssembler *masm)
static void GenerateTransitionElementsSmiToDouble(MacroAssembler *masm)
static const int kMarkerOffset
#define DEF_ARG_TYPE(name, spec)
static SignatureInfo * cast(Object *obj)
static void GenerateArrayLength(MacroAssembler *masm)
static const int kInitialMaxFastElementArray
static const int kMaxValue
static void FatalProcessOutOfMemory(const char *location, bool take_snapshot=false)
BuiltinExtraArguments extra_args
#define BUILTIN_LIST_C(V)
ElementsKind GetHoleyElementsKind(ElementsKind packed_kind)
static void GenerateInitialize(MacroAssembler *masm)
#define DEF_JS_NAME(name, ignore)
static JSObject * cast(Object *obj)
static void GeneratePreMonomorphic(MacroAssembler *masm)
#define BUILTIN_LIST_A(V)
bool IsFastDoubleElementsKind(ElementsKind kind)
MUST_USE_RESULT MaybeObject * EnsureCanContainElements(Object **elements, uint32_t count, EnsureElementsMode mode)
static void GenerateNormal(MacroAssembler *masm)
static void GenerateMiss(MacroAssembler *masm, bool force_generic)
static JSFunction * cast(Object *obj)