13 using namespace v8::internal;
17 static void InitializeVM() {
24 static void CheckMap(
Map* map,
int type,
int instance_size) {
25 CHECK(map->IsHeapObject());
44 static void CheckOddball(
Object* obj,
const char*
string) {
45 CHECK(obj->IsOddball());
52 static void CheckSmi(
int value,
const char*
string) {
60 static void CheckNumber(
double value,
const char*
string) {
61 Object* obj =
HEAP->NumberFromDouble(value)->ToObjectChecked();
62 CHECK(obj->IsNumber());
69 static void CheckFindCodeObject() {
83 CHECK(code->IsCode());
86 Address obj_addr = obj->address();
89 Object* found =
HEAP->FindCodeObject(obj_addr + i);
97 CHECK(copy->IsCode());
99 Object* not_right =
HEAP->FindCodeObject(obj_copy->address() +
100 obj_copy->Size() / 2);
101 CHECK(not_right != code);
109 Object* value =
HEAP->NumberFromDouble(1.000123)->ToObjectChecked();
110 CHECK(value->IsHeapNumber());
111 CHECK(value->IsNumber());
114 value =
HEAP->NumberFromDouble(1.0)->ToObjectChecked();
115 CHECK(value->IsSmi());
116 CHECK(value->IsNumber());
119 value =
HEAP->NumberFromInt32(1024)->ToObjectChecked();
120 CHECK(value->IsSmi());
121 CHECK(value->IsNumber());
125 CHECK(value->IsSmi());
126 CHECK(value->IsNumber());
130 CHECK(value->IsSmi());
131 CHECK(value->IsNumber());
134 #ifndef V8_TARGET_ARCH_X64
137 CHECK(value->IsHeapNumber());
138 CHECK(value->IsNumber());
142 MaybeObject* maybe_value =
144 value = maybe_value->ToObjectChecked();
145 CHECK(value->IsHeapNumber());
146 CHECK(value->IsNumber());
155 CHECK(s->IsString());
160 Isolate::Current()->context()->global()->HasLocalProperty(object_symbol));
163 CheckOddball(
HEAP->true_value(),
"true");
164 CheckOddball(
HEAP->false_value(),
"false");
165 CheckOddball(
HEAP->null_value(),
"null");
166 CheckOddball(
HEAP->undefined_value(),
"undefined");
171 CheckSmi(-42,
"-42");
174 CheckNumber(1.1,
"1.1");
176 CheckFindCodeObject();
215 function->set_initial_map(*initial_map);
216 Isolate::Current()->context()->global()->SetProperty(
232 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(*name));
234 Object* func_value = Isolate::Current()->context()->global()->
236 CHECK(func_value->IsJSFunction());
243 Isolate::Current()->context()->global()->SetProperty(
252 CHECK(Isolate::Current()->context()->global()->HasLocalProperty(*obj_name));
253 CHECK(Isolate::Current()->context()->global()->
254 GetProperty(*obj_name)->ToObjectChecked()->IsJSObject());
255 Object* obj = Isolate::Current()->context()->global()->
262 static void VerifyStringAllocation(
const char*
string) {
266 for (
int index = 0; index < s->length(); index++) {
267 CHECK_EQ(static_cast<uint16_t>(
string[index]), s->Get(index));
275 VerifyStringAllocation(
"a");
276 VerifyStringAllocation(
"ab");
277 VerifyStringAllocation(
"abc");
278 VerifyStringAllocation(
"abcd");
279 VerifyStringAllocation(
"fiskerdrengen er paa havet");
287 const char*
name =
"Kasper the spunky";
295 GlobalHandles* global_handles = Isolate::Current()->global_handles();
308 h1 = global_handles->
Create(*i);
309 h2 = global_handles->
Create(*u);
310 h3 = global_handles->
Create(*i);
311 h4 = global_handles->
Create(*u);
317 CHECK((*h1)->IsString());
318 CHECK((*h2)->IsHeapNumber());
319 CHECK((*h3)->IsString());
320 CHECK((*h4)->IsHeapNumber());
332 static bool WeakPointerCleared =
false;
336 if (1234 == reinterpret_cast<intptr_t>(
id)) WeakPointerCleared =
true;
341 TEST(WeakGlobalHandlesScavenge) {
343 GlobalHandles* global_handles = Isolate::Current()->global_handles();
345 WeakPointerCleared =
false;
356 h1 = global_handles->
Create(*i);
357 h2 = global_handles->
Create(*u);
361 reinterpret_cast<void*
>(1234),
362 &TestWeakGlobalHandleCallback);
365 HEAP->PerformScavenge();
367 CHECK((*h1)->IsString());
368 CHECK((*h2)->IsHeapNumber());
370 CHECK(!WeakPointerCleared);
381 GlobalHandles* global_handles = Isolate::Current()->global_handles();
383 WeakPointerCleared =
false;
394 h1 = global_handles->
Create(*i);
395 h2 = global_handles->
Create(*u);
403 reinterpret_cast<void*
>(1234),
404 &TestWeakGlobalHandleCallback);
410 CHECK((*h1)->IsString());
412 CHECK(WeakPointerCleared);
420 GlobalHandles* global_handles = Isolate::Current()->global_handles();
422 WeakPointerCleared =
false;
430 h = global_handles->
Create(*i);
434 reinterpret_cast<void*
>(1234),
435 &TestWeakGlobalHandleCallback);
438 HEAP->PerformScavenge();
440 CHECK(!WeakPointerCleared);
445 CHECK(WeakPointerCleared);
448 static const char* not_so_random_string_table[] = {
512 static void CheckSymbols(
const char** strings) {
513 for (
const char*
string = *strings; *strings != 0;
string = *strings++) {
515 MaybeObject* maybe_a =
HEAP->LookupAsciiSymbol(
string);
517 if (!maybe_a->ToObject(&a))
continue;
518 CHECK(a->IsSymbol());
520 MaybeObject* maybe_b =
HEAP->LookupAsciiSymbol(
string);
521 if (!maybe_b->ToObject(&b))
continue;
531 CheckSymbols(not_so_random_string_table);
532 CheckSymbols(not_so_random_string_table);
545 function->set_initial_map(*initial_map);
553 function->SetProperty(
564 Object* raw_object = Isolate::Current()->context()->global()->
573 CHECK(!obj->HasLocalProperty(*first));
578 CHECK(obj->HasLocalProperty(*first));
582 CHECK(!obj->HasLocalProperty(*first));
589 CHECK(obj->HasLocalProperty(*first));
590 CHECK(obj->HasLocalProperty(*second));
594 CHECK(obj->HasLocalProperty(*second));
596 CHECK(!obj->HasLocalProperty(*first));
597 CHECK(!obj->HasLocalProperty(*second));
604 CHECK(obj->HasLocalProperty(*first));
605 CHECK(obj->HasLocalProperty(*second));
609 CHECK(obj->HasLocalProperty(*first));
611 CHECK(!obj->HasLocalProperty(*first));
612 CHECK(!obj->HasLocalProperty(*second));
615 const char* string1 =
"fisk";
620 CHECK(obj->HasLocalProperty(*s1_symbol));
623 const char* string2 =
"fugl";
628 CHECK(obj->HasLocalProperty(*s2));
641 function->set_initial_map(*initial_map);
652 CHECK(*initial_map != obj->map());
661 Object* raw_object = Isolate::Current()->context()->global()->
670 array->Initialize(0)->ToObjectChecked();
673 array->SetElementsLength(
Smi::FromInt(0))->ToObjectChecked();
676 CHECK(array->HasFastSmiOrObjectElements());
686 array->SetElementsLength(*length)->ToObjectChecked();
688 uint32_t int_length = 0;
689 CHECK(length->ToArrayIndex(&int_length));
691 CHECK(array->HasDictionaryElements());
695 uint32_t new_int_length = 0;
696 CHECK(array->length()->ToArrayIndex(&new_int_length));
697 CHECK_EQ(static_cast<double>(int_length), new_int_length - 1);
708 Object* raw_object = Isolate::Current()->context()->global()->
728 CHECK_EQ(obj->GetElement(0), clone->GetElement(0));
729 CHECK_EQ(obj->GetElement(1), clone->GetElement(1));
731 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*first));
732 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*second));
743 CHECK_EQ(obj->GetElement(1), clone->GetElement(0));
744 CHECK_EQ(obj->GetElement(0), clone->GetElement(1));
746 CHECK_EQ(obj->GetProperty(*second), clone->GetProperty(*first));
747 CHECK_EQ(obj->GetProperty(*first), clone->GetProperty(*second));
755 const unsigned char chars[] = { 0xe5, 0xa4, 0xa7 };
756 for (
int length = 0; length < 100; length++) {
758 char* non_ascii = NewArray<char>(3 * length + 1);
759 char* ascii = NewArray<char>(length + 1);
760 non_ascii[3 * length] = 0;
762 for (
int i = 0; i < length; i++) {
764 non_ascii[3 * i] = chars[0];
765 non_ascii[3 * i + 1] = chars[1];
766 non_ascii[3 * i + 2] = chars[2];
770 CHECK_EQ(length, non_ascii_sym->length());
773 CHECK_EQ(length, ascii_sym->length());
776 non_ascii_str->Hash();
777 CHECK_EQ(length, non_ascii_str->length());
781 CHECK_EQ(length, ascii_str->length());
791 HeapIterator iterator;
792 for (
HeapObject* obj = iterator.next(); obj !=
NULL; obj = iterator.next()) {
793 for (
int i = 0; i < size; i++) {
794 if (*objs[i] == obj) {
808 const int objs_count = 6;
810 int next_objs_index = 0;
813 objs[next_objs_index++] =
FACTORY->NewJSArray(10);
814 objs[next_objs_index++] =
FACTORY->NewJSArray(10,
819 objs[next_objs_index++] =
821 objs[next_objs_index++] =
826 char* str =
new char[large_size];
827 for (
int i = 0; i < large_size - 1; ++i) str[i] =
'a';
828 str[large_size - 1] =
'\0';
829 objs[next_objs_index++] =
836 CHECK_EQ(objs_count, next_objs_index);
837 CHECK_EQ(objs_count, ObjectsFoundInHeap(objs, objs_count));
857 static int LenFromSize(
int size) {
877 Isolate::Current()->global_context()->object_function());
878 CHECK(object_ctor->has_initial_map());
879 Handle<Map> object_map(object_ctor->initial_map());
882 int n_properties = my_map->inobject_properties();
885 int object_size = my_map->instance_size();
891 HEAP->MaxObjectSizeInNewSpace());
892 int allocation_len = LenFromSize(allocation_amount);
896 while ((*limit_addr - *top_addr) > allocation_amount) {
898 Object* array =
HEAP->AllocateFixedArray(allocation_len)->ToObjectChecked();
899 CHECK(!array->IsFailure());
904 int to_fill =
static_cast<int>(*limit_addr - *top_addr - object_size);
905 int fixed_array_len = LenFromSize(to_fill);
909 Object* array =
HEAP->AllocateFixedArray(fixed_array_len)->ToObjectChecked();
910 CHECK(!array->IsFailure());
913 Object*
object =
HEAP->AllocateJSObjectFromMap(*my_map)->ToObjectChecked();
917 CHECK_EQ(0, jsobject->properties()->length());
919 jsobject->FastPropertyAtPut(-1, array);
921 CHECK_EQ(0, static_cast<int>(*limit_addr - *top_addr));
925 Address old_pointer_space_top =
HEAP->old_pointer_space()->top();
927 Object* clone_obj =
HEAP->CopyJSObject(jsobject)->ToObjectChecked();
929 if (clone->
address() != old_pointer_space_top) {
938 i::FLAG_allow_natives_syntax =
true;
940 if (!FLAG_flush_code)
return;
943 const char* source =
"function foo() {"
957 Object* func_value = Isolate::Current()->context()->global()->
959 CHECK(func_value->IsJSFunction());
961 CHECK(function->shared()->is_compiled());
967 CHECK(function->shared()->is_compiled());
977 CHECK(!function->shared()->is_compiled() ||
function->IsOptimized());
978 CHECK(!function->is_compiled() ||
function->IsOptimized());
981 CHECK(function->shared()->is_compiled());
982 CHECK(function->is_compiled());
987 static int CountGlobalContexts() {
989 Object*
object =
HEAP->global_contexts_list();
990 while (!object->IsUndefined()) {
1015 static const int kNumTestContexts = 10;
1020 CHECK_EQ(0, CountGlobalContexts());
1023 for (
int i = 0; i < kNumTestContexts; i++) {
1028 CHECK_EQ(i + 1, CountGlobalContexts());
1035 const char* source =
"function f1() { };"
1036 "function f2() { };"
1037 "function f3() { };"
1038 "function f4() { };"
1039 "function f5() { };";
1041 CHECK_EQ(0, CountOptimizedUserFunctions(ctx[i]));
1043 CHECK_EQ(opt ? 1 : 0, CountOptimizedUserFunctions(ctx[i]));
1045 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i]));
1047 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
1049 CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
1051 CHECK_EQ(opt ? 5 : 0, CountOptimizedUserFunctions(ctx[i]));
1054 CompileRun(
"f1=null");
1057 for (
int j = 0; j < 10; j++) {
1058 HEAP->PerformScavenge();
1059 CHECK_EQ(opt ? 5 : 0, CountOptimizedUserFunctions(ctx[i]));
1064 CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
1067 CompileRun(
"f3=null");
1068 for (
int j = 0; j < 10; j++) {
1069 HEAP->PerformScavenge();
1070 CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[i]));
1073 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
1074 CompileRun(
"f5=null");
1075 for (
int j = 0; j < 10; j++) {
1076 HEAP->PerformScavenge();
1077 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[i]));
1080 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[i]));
1089 for (
int i = 0; i < kNumTestContexts; i++) {
1094 for (
int j = 0; j < 10; j++) {
1095 HEAP->PerformScavenge();
1096 CHECK_EQ(kNumTestContexts - i, CountGlobalContexts());
1101 CHECK_EQ(kNumTestContexts - i - 1, CountGlobalContexts());
1104 CHECK_EQ(0, CountGlobalContexts());
1110 static int CountGlobalContextsWithGC(
int n) {
1113 while (!object->IsUndefined()) {
1131 while (object->IsJSFunction() &&
1142 TEST(TestInternalWeakListsTraverseWithGC) {
1145 static const int kNumTestContexts = 10;
1150 CHECK_EQ(0, CountGlobalContexts());
1154 for (
int i = 0; i < kNumTestContexts; i++) {
1156 CHECK_EQ(i + 1, CountGlobalContexts());
1157 CHECK_EQ(i + 1, CountGlobalContextsWithGC(i / 2 + 1));
1165 const char* source =
"function f1() { };"
1166 "function f2() { };"
1167 "function f3() { };"
1168 "function f4() { };"
1169 "function f5() { };";
1171 CHECK_EQ(0, CountOptimizedUserFunctions(ctx[0]));
1173 CHECK_EQ(opt ? 1 : 0, CountOptimizedUserFunctions(ctx[0]));
1174 CHECK_EQ(opt ? 1 : 0, CountOptimizedUserFunctionsWithGC(ctx[0], 1));
1176 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctions(ctx[0]));
1177 CHECK_EQ(opt ? 2 : 0, CountOptimizedUserFunctionsWithGC(ctx[0], 1));
1179 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctions(ctx[0]));
1180 CHECK_EQ(opt ? 3 : 0, CountOptimizedUserFunctionsWithGC(ctx[0], 1));
1182 CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctions(ctx[0]));
1183 CHECK_EQ(opt ? 4 : 0, CountOptimizedUserFunctionsWithGC(ctx[0], 2));
1185 CHECK_EQ(opt ? 5 : 0, CountOptimizedUserFunctions(ctx[0]));
1186 CHECK_EQ(opt ? 5 : 0, CountOptimizedUserFunctionsWithGC(ctx[0], 4));
1201 CHECK(
HEAP->old_pointer_space()->IsSweepingComplete());
1202 int initial_size =
static_cast<int>(
HEAP->SizeOfObjects());
1209 for (
int i = 1; i <= 100; i++) {
1210 HEAP->AllocateFixedArray(8192,
TENURED)->ToObjectChecked();
1211 CHECK_EQ(initial_size + i * filler_size,
1212 static_cast<int>(
HEAP->SizeOfObjects()));
1222 CHECK_EQ(initial_size, static_cast<int>(
HEAP->SizeOfObjects()));
1225 while (!
HEAP->old_pointer_space()->IsSweepingComplete()) {
1226 HEAP->old_pointer_space()->AdvanceSweeper(
KB);
1227 CHECK_EQ(initial_size, static_cast<int>(
HEAP->SizeOfObjects()));
1232 TEST(TestSizeOfObjectsVsHeapIteratorPrecision) {
1234 HEAP->EnsureHeapIsIterable();
1235 intptr_t size_of_objects_1 =
HEAP->SizeOfObjects();
1236 HeapIterator iterator;
1237 intptr_t size_of_objects_2 = 0;
1240 obj = iterator.next()) {
1241 size_of_objects_2 += obj->Size();
1247 if (size_of_objects_1 > size_of_objects_2) {
1248 intptr_t delta = size_of_objects_1 - size_of_objects_2;
1252 size_of_objects_1, size_of_objects_2, delta);
1253 CHECK_GT(size_of_objects_1 / 20, delta);
1255 intptr_t delta = size_of_objects_2 - size_of_objects_1;
1259 size_of_objects_1, size_of_objects_2, delta);
1260 CHECK_GT(size_of_objects_2 / 20, delta);
1265 static void FillUpNewSpace(
NewSpace* new_space) {
1272 for (intptr_t i = 0; i < number_of_fillers; i++) {
1282 if (
HEAP->ReservedSemiSpaceSize() ==
HEAP->InitialSemiSpaceSize()) {
1290 intptr_t old_capacity, new_capacity;
1291 old_capacity = new_space->
Capacity();
1293 new_capacity = new_space->
Capacity();
1294 CHECK(2 * old_capacity == new_capacity);
1296 old_capacity = new_space->
Capacity();
1297 FillUpNewSpace(new_space);
1298 new_capacity = new_space->
Capacity();
1299 CHECK(old_capacity == new_capacity);
1302 old_capacity = new_space->
Capacity();
1304 new_capacity = new_space->
Capacity();
1305 CHECK(old_capacity == new_capacity);
1312 old_capacity = new_space->
Capacity();
1314 new_capacity = new_space->
Capacity();
1315 CHECK(old_capacity == 2 * new_capacity);
1318 old_capacity = new_space->
Capacity();
1322 new_capacity = new_space->
Capacity();
1323 CHECK(old_capacity == new_capacity);
1327 TEST(CollectingAllAvailableGarbageShrinksNewSpace) {
1330 if (
HEAP->ReservedSemiSpaceSize() ==
HEAP->InitialSemiSpaceSize()) {
1339 intptr_t old_capacity, new_capacity;
1340 old_capacity = new_space->
Capacity();
1342 new_capacity = new_space->
Capacity();
1343 CHECK(2 * old_capacity == new_capacity);
1344 FillUpNewSpace(new_space);
1345 HEAP->CollectAllAvailableGarbage();
1346 new_capacity = new_space->
Capacity();
1347 CHECK(old_capacity == new_capacity);
1351 static int NumberOfGlobalObjects() {
1353 HeapIterator iterator;
1354 for (
HeapObject* obj = iterator.next(); obj !=
NULL; obj = iterator.next()) {
1355 if (obj->IsGlobalObject()) count++;
1364 i::FLAG_allow_natives_syntax =
true;
1370 HEAP->CollectAllAvailableGarbage();
1371 CHECK_EQ(4, NumberOfGlobalObjects());
1375 CompileRun(
"var v = {x: 42}");
1378 ctx2->Global()->Set(v8_str(
"o"), v);
1380 "function f() { return o.x; }"
1381 "for (var i = 0; i < 10; ++i) f();"
1382 "%OptimizeFunctionOnNextCall(f);"
1390 HEAP->CollectAllAvailableGarbage();
1391 CHECK_EQ(2, NumberOfGlobalObjects());
1393 HEAP->CollectAllAvailableGarbage();
1394 CHECK_EQ(0, NumberOfGlobalObjects());
1400 TEST(LeakGlobalContextViaFunction) {
1401 i::FLAG_allow_natives_syntax =
true;
1407 HEAP->CollectAllAvailableGarbage();
1408 CHECK_EQ(4, NumberOfGlobalObjects());
1412 CompileRun(
"var v = function() { return 42; }");
1415 ctx2->Global()->Set(v8_str(
"o"), v);
1417 "function f(x) { return x(); }"
1418 "for (var i = 0; i < 10; ++i) f(o);"
1419 "%OptimizeFunctionOnNextCall(f);"
1427 HEAP->CollectAllAvailableGarbage();
1428 CHECK_EQ(2, NumberOfGlobalObjects());
1430 HEAP->CollectAllAvailableGarbage();
1431 CHECK_EQ(0, NumberOfGlobalObjects());
1435 TEST(LeakGlobalContextViaMapKeyed) {
1436 i::FLAG_allow_natives_syntax =
true;
1442 HEAP->CollectAllAvailableGarbage();
1443 CHECK_EQ(4, NumberOfGlobalObjects());
1447 CompileRun(
"var v = [42, 43]");
1450 ctx2->Global()->Set(v8_str(
"o"), v);
1452 "function f() { return o[0]; }"
1453 "for (var i = 0; i < 10; ++i) f();"
1454 "%OptimizeFunctionOnNextCall(f);"
1462 HEAP->CollectAllAvailableGarbage();
1463 CHECK_EQ(2, NumberOfGlobalObjects());
1465 HEAP->CollectAllAvailableGarbage();
1466 CHECK_EQ(0, NumberOfGlobalObjects());
1470 TEST(LeakGlobalContextViaMapProto) {
1471 i::FLAG_allow_natives_syntax =
true;
1477 HEAP->CollectAllAvailableGarbage();
1478 CHECK_EQ(4, NumberOfGlobalObjects());
1482 CompileRun(
"var v = { y: 42}");
1485 ctx2->Global()->Set(v8_str(
"o"), v);
1492 "for (var i = 0; i < 10; ++i) f();"
1493 "%OptimizeFunctionOnNextCall(f);"
1501 HEAP->CollectAllAvailableGarbage();
1502 CHECK_EQ(2, NumberOfGlobalObjects());
1504 HEAP->CollectAllAvailableGarbage();
1505 CHECK_EQ(0, NumberOfGlobalObjects());
1510 i::FLAG_allow_natives_syntax =
true;
1512 i::FLAG_verify_heap =
true;
1521 "function foo () { }"
1522 "function mkbar () { return new (new Function(\"\")) (); }"
1523 "function f (x) { return (x instanceof foo); }"
1524 "function g () { f(mkbar()); }"
1525 "f(new foo()); f(new foo());"
1526 "%OptimizeFunctionOnNextCall(f);"
1527 "f(new foo()); g();");
1539 CHECK(f->IsOptimized());
1548 CHECK(marking->IsMarking());
1558 HEAP->incremental_marking()->set_should_hurry(
true);
1563 TEST(PrototypeTransitionClearing) {
1570 "for (var i = 0; i < 10; i++) {"
1572 " var prototype = {};"
1573 " object.__proto__ = prototype;"
1574 " if (i >= 3) live.push(object, prototype);"
1586 CHECK_EQ(11, baseObject->map()->NumberOfProtoTransitions());
1588 const int transitions = 11 - 3;
1589 CHECK_EQ(transitions, baseObject->map()->NumberOfProtoTransitions());
1592 FixedArray* trans = baseObject->map()->prototype_transitions();
1593 for (
int i = 0; i < transitions; i++) {
1598 CHECK(proto->IsTheHole() || proto->IsJSObject());
1611 i::FLAG_always_compact =
true;
1615 baseObject->SetPrototype(*prototype,
false)->ToObjectChecked();
1622 TEST(ResetSharedFunctionInfoCountersDuringIncrementalMarking) {
1623 i::FLAG_allow_natives_syntax =
true;
1625 i::FLAG_verify_heap =
true;
1636 " for (var i = 0; i < 100; i++) s += i;"
1640 "%OptimizeFunctionOnNextCall(f);"
1647 CHECK(f->IsOptimized());
1654 const int kLongIdlePauseInMs = 1000;
1658 while (!marking->IsStopped() && !marking->IsComplete()) {
1661 if (!marking->IsStopped() || marking->should_hurry()) {
1668 "Test finalizing incremental mark-sweep");
1671 CHECK_EQ(
HEAP->global_ic_age(), f->shared()->ic_age());
1672 CHECK_EQ(0, f->shared()->opt_count());
1673 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
1677 TEST(ResetSharedFunctionInfoCountersDuringMarkSweep) {
1678 i::FLAG_allow_natives_syntax =
true;
1680 i::FLAG_verify_heap =
true;
1691 " for (var i = 0; i < 100; i++) s += i;"
1695 "%OptimizeFunctionOnNextCall(f);"
1702 CHECK(f->IsOptimized());
1704 HEAP->incremental_marking()->Abort();
1708 const int kLongIdlePauseInMs = 1000;
1712 CHECK_EQ(
HEAP->global_ic_age(), f->shared()->ic_age());
1713 CHECK_EQ(0, f->shared()->opt_count());
1714 CHECK_EQ(0, f->shared()->code()->profiler_ticks());
1719 TEST(OptimizedAllocationAlwaysInNewSpace) {
1720 i::FLAG_allow_natives_syntax =
true;
1725 FillUpNewSpace(
HEAP->new_space());
1730 " for (var i = 0; i < 32; i++) {"
1731 " this['x' + i] = x;"
1734 "function f(x) { return new c(x); };"
1736 "%OptimizeFunctionOnNextCall(f);"
1738 CHECK_EQ(4, res->
ToObject()->GetRealNamedProperty(v8_str(
"x"))->Int32Value());
1747 static int CountMapTransitions(
Map* map) {
1762 i::FLAG_allow_natives_syntax =
true;
1763 i::FLAG_trace_incremental_marking =
true;
1767 #define TRANSITION_COUNT 256
1770 OS::SNPrintF(buffer,
"var o = new Object; o.prop%d = %d;", i, i);
1771 CompileRun(buffer.
start());
1773 CompileRun(
"var root = new Object;");
1780 int transitions_before = CountMapTransitions(root->map());
1781 CompileRun(
"%DebugPrint(root);");
1782 CHECK_EQ(TRANSITION_COUNT, transitions_before);
1788 CHECK(marking->IsMarking());
1798 int transitions_after = CountMapTransitions(root->map());
1799 CompileRun(
"%DebugPrint(root);");
1805 i::FLAG_collect_maps =
true;
1806 i::FLAG_incremental_marking =
true;
1812 CompileRun(
"var root = new Object;"
1814 "root = new Object;");
1820 CHECK(marking->IsMarking());
1829 CompileRun(
"function f(o) {"
1836 HEAP->AgeInlineCaches();
1848 CHECK(root->IsJSObject());
1849 CHECK(root->map()->IsMap());
1854 i::FLAG_collect_maps =
true;
1855 i::FLAG_incremental_marking =
true;
1856 i::FLAG_allow_natives_syntax =
true;
1862 CompileRun(
"var root = new Object;"
1864 "root = new Object;");
1870 CHECK(marking->IsMarking());
1879 CompileRun(
"function f(o) {"
1884 "%OptimizeFunctionOnNextCall(f);"
1886 "%DeoptimizeFunction(f);");
1889 HEAP->AgeInlineCaches();
1901 CHECK(root->IsJSObject());
1902 CHECK(root->map()->IsMap());
static bool IsBlack(MarkBit mark_bit)
static Local< Context > GetCurrent()
static const int kMaxLength
void Destroy(Object **location)
#define CHECK_EQ(expected, value)
bool Contains(Address addr)
void PrintF(const char *format,...)
static String * cast(Object *obj)
static bool UseCrankshaft()
V8EXPORT Local< Value > Get(Handle< Value > key)
static Smi * FromInt(int value)
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 HeapObject * cast(Object *obj)
static Handle< T > cast(Handle< S > that)
static const int kProtoTransitionElementsPerEntry
const int kVariableSizeSentinel
bool is_identical_to(const Handle< T > other) const
Address * allocation_top_address()
bool IsTransitionOnly(int descriptor_number)
static bool IsNearDeath(Object **location)
static Failure * Exception()
static Handle< T > Cast(Handle< S > that)
V8EXPORT Local< Value > Call(Handle< Object > recv, int argc, Handle< Value > argv[])
Map * GetPrototypeTransition(Object *prototype)
void Step(intptr_t allocated, CompletionAction action)
static Context * cast(Object *context)
Handle< Object > GetProperty(Handle< JSReceiver > obj, const char *name)
static const int kMaxSize
intptr_t EffectiveCapacity()
static Smi * cast(Object *object)
static MarkBit MarkBitFrom(Address addr)
static const int kProtoTransitionMapOffset
Handle< Object > Create(Object *value)
static Failure * RetryAfterGC()
static const int kMinValue
static const int kNoGCFlags
static int ContextDisposedNotification()
V8EXPORT int32_t Int32Value() const
static const int kMaxNonCodeHeapObjectSize
static const int kAbortIncrementalMarkingMask
Vector< const char > CStrVector(const char *data)
int StrLength(const char *string)
static int SizeFor(int length)
static const int kProtoTransitionHeaderSize
static const int kHeaderSize
static int SNPrintF(Vector< char > str, const char *format,...)
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 available(X64 only)") DEFINE_bool(enable_vfp3
#define OBJECT_POINTER_ALIGN(value)
static Object * cast(Object *value)
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, PropertyType type=NORMAL, int argc=-1, InlineCacheHolderFlag holder=OWN_MAP)
Handle< T > EscapeFrom(v8::HandleScope *scope)
int number_of_descriptors()
static const int kProtoTransitionPrototypeOffset
MUST_USE_RESULT MaybeObject * GetProperty(String *key)
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
InstanceType instance_type()
static V8EXPORT Local< Integer > New(int32_t value)
static FixedArray * cast(Object *obj)
static const int kHeaderSize
static Handle< Object > ToString(Handle< Object > obj, bool *exc)
static Persistent< Context > New(ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
V8EXPORT Local< Object > ToObject() const
Address * allocation_limit_address()
void MakeWeak(Object **location, void *parameter, WeakReferenceCallback callback)
void DeleteArray(T *array)
static const int kMaxValue
static JSObject * cast(Object *obj)
static v8::internal::Handle< v8::internal::TemplateInfo > OpenHandle(const Template *that)
Handle< JSObject > Copy(Handle< JSObject > obj)
static bool IdleNotification(int hint=1000)
static JSFunction * cast(Object *obj)