OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 879 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
890 v8::HandleScope scope(CcTest::isolate()); | 890 v8::HandleScope scope(CcTest::isolate()); |
891 | 891 |
892 // Array of objects to scan haep for. | 892 // Array of objects to scan haep for. |
893 const int objs_count = 6; | 893 const int objs_count = 6; |
894 Handle<Object> objs[objs_count]; | 894 Handle<Object> objs[objs_count]; |
895 int next_objs_index = 0; | 895 int next_objs_index = 0; |
896 | 896 |
897 // Allocate a JS array to OLD_SPACE and NEW_SPACE | 897 // Allocate a JS array to OLD_SPACE and NEW_SPACE |
898 objs[next_objs_index++] = factory->NewJSArray(10); | 898 objs[next_objs_index++] = factory->NewJSArray(10); |
899 objs[next_objs_index++] = | 899 objs[next_objs_index++] = |
900 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, WEAK, TENURED); | 900 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, Strength::WEAK, TENURED); |
901 | 901 |
902 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 902 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
903 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); | 903 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); |
904 objs[next_objs_index++] = | 904 objs[next_objs_index++] = |
905 factory->NewStringFromStaticChars("abcdefghij", TENURED); | 905 factory->NewStringFromStaticChars("abcdefghij", TENURED); |
906 | 906 |
907 // Allocate a large string (for large object space). | 907 // Allocate a large string (for large object space). |
908 int large_size = Page::kMaxRegularHeapObjectSize + 1; | 908 int large_size = Page::kMaxRegularHeapObjectSize + 1; |
909 char* str = new char[large_size]; | 909 char* str = new char[large_size]; |
910 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; | 910 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; |
(...skipping 1557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2468 int j = TransitionArray::kProtoTransitionHeaderSize + i; | 2468 int j = TransitionArray::kProtoTransitionHeaderSize + i; |
2469 CHECK(trans->get(j)->IsMap()); | 2469 CHECK(trans->get(j)->IsMap()); |
2470 } | 2470 } |
2471 | 2471 |
2472 // Make sure next prototype is placed on an old-space evacuation candidate. | 2472 // Make sure next prototype is placed on an old-space evacuation candidate. |
2473 Handle<JSObject> prototype; | 2473 Handle<JSObject> prototype; |
2474 PagedSpace* space = CcTest::heap()->old_space(); | 2474 PagedSpace* space = CcTest::heap()->old_space(); |
2475 { | 2475 { |
2476 AlwaysAllocateScope always_allocate(isolate); | 2476 AlwaysAllocateScope always_allocate(isolate); |
2477 SimulateFullSpace(space); | 2477 SimulateFullSpace(space); |
2478 prototype = | 2478 prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, |
2479 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); | 2479 Strength::WEAK, TENURED); |
2480 } | 2480 } |
2481 | 2481 |
2482 // Add a prototype on an evacuation candidate and verify that transition | 2482 // Add a prototype on an evacuation candidate and verify that transition |
2483 // clearing correctly records slots in prototype transition array. | 2483 // clearing correctly records slots in prototype transition array. |
2484 i::FLAG_always_compact = true; | 2484 i::FLAG_always_compact = true; |
2485 Handle<Map> map(baseObject->map()); | 2485 Handle<Map> map(baseObject->map()); |
2486 CHECK(!space->LastPage()->Contains( | 2486 CHECK(!space->LastPage()->Contains( |
2487 TransitionArray::GetPrototypeTransitions(*map)->address())); | 2487 TransitionArray::GetPrototypeTransitions(*map)->address())); |
2488 CHECK(space->LastPage()->Contains(prototype->address())); | 2488 CHECK(space->LastPage()->Contains(prototype->address())); |
2489 } | 2489 } |
(...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5898 size_t counter2 = 2000; | 5898 size_t counter2 = 2000; |
5899 tracer->SampleAllocation(time2, counter2, counter2); | 5899 tracer->SampleAllocation(time2, counter2, counter2); |
5900 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5900 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5901 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5901 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
5902 int time3 = 1000; | 5902 int time3 = 1000; |
5903 size_t counter3 = 30000; | 5903 size_t counter3 = 30000; |
5904 tracer->SampleAllocation(time3, counter3, counter3); | 5904 tracer->SampleAllocation(time3, counter3, counter3); |
5905 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5905 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5906 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5906 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
5907 } | 5907 } |
OLD | NEW |