| 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++] = |
| 900 FAST_HOLEY_ELEMENTS, | 900 factory->NewJSArray(10, FAST_HOLEY_ELEMENTS, 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 1680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3905 | 3905 |
| 3906 // Allocate the object. | 3906 // Allocate the object. |
| 3907 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); | 3907 Handle<FixedArray> array_data = factory->NewFixedArray(2, NOT_TENURED); |
| 3908 array_data->set(0, Smi::FromInt(1)); | 3908 array_data->set(0, Smi::FromInt(1)); |
| 3909 array_data->set(1, Smi::FromInt(2)); | 3909 array_data->set(1, Smi::FromInt(2)); |
| 3910 | 3910 |
| 3911 AllocateAllButNBytes(CcTest::heap()->new_space(), | 3911 AllocateAllButNBytes(CcTest::heap()->new_space(), |
| 3912 JSArray::kSize + AllocationMemento::kSize + | 3912 JSArray::kSize + AllocationMemento::kSize + |
| 3913 kPointerSize); | 3913 kPointerSize); |
| 3914 | 3914 |
| 3915 Handle<JSArray> array = factory->NewJSArrayWithElements(array_data, | 3915 Handle<JSArray> array = |
| 3916 FAST_SMI_ELEMENTS, | 3916 factory->NewJSArrayWithElements(array_data, FAST_SMI_ELEMENTS); |
| 3917 NOT_TENURED); | |
| 3918 | 3917 |
| 3919 CHECK_EQ(Smi::FromInt(2), array->length()); | 3918 CHECK_EQ(Smi::FromInt(2), array->length()); |
| 3920 CHECK(array->HasFastSmiOrObjectElements()); | 3919 CHECK(array->HasFastSmiOrObjectElements()); |
| 3921 | 3920 |
| 3922 // We need filler the size of AllocationMemento object, plus an extra | 3921 // We need filler the size of AllocationMemento object, plus an extra |
| 3923 // fill pointer value. | 3922 // fill pointer value. |
| 3924 HeapObject* obj = NULL; | 3923 HeapObject* obj = NULL; |
| 3925 AllocationResult allocation = | 3924 AllocationResult allocation = |
| 3926 CcTest::heap()->new_space()->AllocateRawUnaligned( | 3925 CcTest::heap()->new_space()->AllocateRawUnaligned( |
| 3927 AllocationMemento::kSize + kPointerSize); | 3926 AllocationMemento::kSize + kPointerSize); |
| (...skipping 1706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5634 size_t counter2 = 2000; | 5633 size_t counter2 = 2000; |
| 5635 tracer->SampleAllocation(time2, counter2, counter2); | 5634 tracer->SampleAllocation(time2, counter2, counter2); |
| 5636 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5635 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5637 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5636 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
| 5638 int time3 = 1000; | 5637 int time3 = 1000; |
| 5639 size_t counter3 = 30000; | 5638 size_t counter3 = 30000; |
| 5640 tracer->SampleAllocation(time3, counter3, counter3); | 5639 tracer->SampleAllocation(time3, counter3, counter3); |
| 5641 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5640 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5642 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5641 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
| 5643 } | 5642 } |
| OLD | NEW |