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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 v8::HandleScope scope(CcTest::isolate()); | 945 v8::HandleScope scope(CcTest::isolate()); |
946 | 946 |
947 // Array of objects to scan haep for. | 947 // Array of objects to scan haep for. |
948 const int objs_count = 6; | 948 const int objs_count = 6; |
949 Handle<Object> objs[objs_count]; | 949 Handle<Object> objs[objs_count]; |
950 int next_objs_index = 0; | 950 int next_objs_index = 0; |
951 | 951 |
952 // Allocate a JS array to OLD_SPACE and NEW_SPACE | 952 // Allocate a JS array to OLD_SPACE and NEW_SPACE |
953 objs[next_objs_index++] = factory->NewJSArray(10); | 953 objs[next_objs_index++] = factory->NewJSArray(10); |
954 objs[next_objs_index++] = | 954 objs[next_objs_index++] = |
955 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, WEAK, TENURED); | 955 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, Strength::WEAK, TENURED); |
956 | 956 |
957 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 957 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
958 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); | 958 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); |
959 objs[next_objs_index++] = | 959 objs[next_objs_index++] = |
960 factory->NewStringFromStaticChars("abcdefghij", TENURED); | 960 factory->NewStringFromStaticChars("abcdefghij", TENURED); |
961 | 961 |
962 // Allocate a large string (for large object space). | 962 // Allocate a large string (for large object space). |
963 int large_size = Page::kMaxRegularHeapObjectSize + 1; | 963 int large_size = Page::kMaxRegularHeapObjectSize + 1; |
964 char* str = new char[large_size]; | 964 char* str = new char[large_size]; |
965 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; | 965 for (int i = 0; i < large_size - 1; ++i) str[i] = 'a'; |
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2524 CHECK(trans->get(j)->IsWeakCell()); | 2524 CHECK(trans->get(j)->IsWeakCell()); |
2525 CHECK(WeakCell::cast(trans->get(j))->value()->IsMap()); | 2525 CHECK(WeakCell::cast(trans->get(j))->value()->IsMap()); |
2526 } | 2526 } |
2527 | 2527 |
2528 // Make sure next prototype is placed on an old-space evacuation candidate. | 2528 // Make sure next prototype is placed on an old-space evacuation candidate. |
2529 Handle<JSObject> prototype; | 2529 Handle<JSObject> prototype; |
2530 PagedSpace* space = CcTest::heap()->old_space(); | 2530 PagedSpace* space = CcTest::heap()->old_space(); |
2531 { | 2531 { |
2532 AlwaysAllocateScope always_allocate(isolate); | 2532 AlwaysAllocateScope always_allocate(isolate); |
2533 SimulateFullSpace(space); | 2533 SimulateFullSpace(space); |
2534 prototype = | 2534 prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, |
2535 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); | 2535 Strength::WEAK, TENURED); |
2536 } | 2536 } |
2537 | 2537 |
2538 // Add a prototype on an evacuation candidate and verify that transition | 2538 // Add a prototype on an evacuation candidate and verify that transition |
2539 // clearing correctly records slots in prototype transition array. | 2539 // clearing correctly records slots in prototype transition array. |
2540 i::FLAG_always_compact = true; | 2540 i::FLAG_always_compact = true; |
2541 Handle<Map> map(baseObject->map()); | 2541 Handle<Map> map(baseObject->map()); |
2542 CHECK(!space->LastPage()->Contains( | 2542 CHECK(!space->LastPage()->Contains( |
2543 TransitionArray::GetPrototypeTransitions(*map)->address())); | 2543 TransitionArray::GetPrototypeTransitions(*map)->address())); |
2544 CHECK(space->LastPage()->Contains(prototype->address())); | 2544 CHECK(space->LastPage()->Contains(prototype->address())); |
2545 } | 2545 } |
(...skipping 3408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5954 size_t counter2 = 2000; | 5954 size_t counter2 = 2000; |
5955 tracer->SampleAllocation(time2, counter2, counter2); | 5955 tracer->SampleAllocation(time2, counter2, counter2); |
5956 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5956 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5957 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5957 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
5958 int time3 = 1000; | 5958 int time3 = 1000; |
5959 size_t counter3 = 30000; | 5959 size_t counter3 = 30000; |
5960 tracer->SampleAllocation(time3, counter3, counter3); | 5960 tracer->SampleAllocation(time3, counter3, counter3); |
5961 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5961 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5962 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5962 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
5963 } | 5963 } |
OLD | NEW |