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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
889 Factory* factory = isolate->factory(); | 889 Factory* factory = isolate->factory(); |
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++] = factory->NewJSArray(10, | 899 objs[next_objs_index++] = factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, |
900 FAST_HOLEY_ELEMENTS, | 900 WEAK, TENURED); |
901 TENURED); | |
902 | 901 |
903 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE | 902 // Allocate a small string to OLD_DATA_SPACE and NEW_SPACE |
904 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); | 903 objs[next_objs_index++] = factory->NewStringFromStaticChars("abcdefghij"); |
905 objs[next_objs_index++] = | 904 objs[next_objs_index++] = |
906 factory->NewStringFromStaticChars("abcdefghij", TENURED); | 905 factory->NewStringFromStaticChars("abcdefghij", TENURED); |
907 | 906 |
908 // Allocate a large string (for large object space). | 907 // Allocate a large string (for large object space). |
909 int large_size = Page::kMaxRegularHeapObjectSize + 1; | 908 int large_size = Page::kMaxRegularHeapObjectSize + 1; |
910 char* str = new char[large_size]; | 909 char* str = new char[large_size]; |
911 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 1292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2204 int j = TransitionArray::kProtoTransitionHeaderSize + i; | 2203 int j = TransitionArray::kProtoTransitionHeaderSize + i; |
2205 CHECK(trans->get(j)->IsMap()); | 2204 CHECK(trans->get(j)->IsMap()); |
2206 } | 2205 } |
2207 | 2206 |
2208 // Make sure next prototype is placed on an old-space evacuation candidate. | 2207 // Make sure next prototype is placed on an old-space evacuation candidate. |
2209 Handle<JSObject> prototype; | 2208 Handle<JSObject> prototype; |
2210 PagedSpace* space = CcTest::heap()->old_space(); | 2209 PagedSpace* space = CcTest::heap()->old_space(); |
2211 { | 2210 { |
2212 AlwaysAllocateScope always_allocate(isolate); | 2211 AlwaysAllocateScope always_allocate(isolate); |
2213 SimulateFullSpace(space); | 2212 SimulateFullSpace(space); |
2214 prototype = factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, TENURED); | 2213 prototype = |
| 2214 factory->NewJSArray(32 * KB, FAST_HOLEY_ELEMENTS, WEAK, TENURED); |
2215 } | 2215 } |
2216 | 2216 |
2217 // Add a prototype on an evacuation candidate and verify that transition | 2217 // Add a prototype on an evacuation candidate and verify that transition |
2218 // clearing correctly records slots in prototype transition array. | 2218 // clearing correctly records slots in prototype transition array. |
2219 i::FLAG_always_compact = true; | 2219 i::FLAG_always_compact = true; |
2220 Handle<Map> map(baseObject->map()); | 2220 Handle<Map> map(baseObject->map()); |
2221 CHECK(!space->LastPage()->Contains( | 2221 CHECK(!space->LastPage()->Contains( |
2222 TransitionArray::GetPrototypeTransitions(*map)->address())); | 2222 TransitionArray::GetPrototypeTransitions(*map)->address())); |
2223 CHECK(space->LastPage()->Contains(prototype->address())); | 2223 CHECK(space->LastPage()->Contains(prototype->address())); |
2224 } | 2224 } |
(...skipping 3326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5551 size_t counter2 = 2000; | 5551 size_t counter2 = 2000; |
5552 tracer->SampleNewSpaceAllocation(time2, counter2); | 5552 tracer->SampleNewSpaceAllocation(time2, counter2); |
5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); | 5553 size_t bytes = tracer->NewSpaceAllocatedBytesInLast(1000); |
5554 CHECK_EQ(0, bytes); | 5554 CHECK_EQ(0, bytes); |
5555 int time3 = 1000; | 5555 int time3 = 1000; |
5556 size_t counter3 = 30000; | 5556 size_t counter3 = 30000; |
5557 tracer->SampleNewSpaceAllocation(time3, counter3); | 5557 tracer->SampleNewSpaceAllocation(time3, counter3); |
5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); | 5558 bytes = tracer->NewSpaceAllocatedBytesInLast(100); |
5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); | 5559 CHECK_EQ((counter3 - counter1) * 100 / (time3 - time1), bytes); |
5560 } | 5560 } |
OLD | NEW |