| 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 5768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5779 Isolate* isolate = CcTest::i_isolate(); | 5779 Isolate* isolate = CcTest::i_isolate(); |
| 5780 Heap* heap = isolate->heap(); | 5780 Heap* heap = isolate->heap(); |
| 5781 size_t counter1 = heap->NewSpaceAllocationCounter(); | 5781 size_t counter1 = heap->NewSpaceAllocationCounter(); |
| 5782 heap->CollectGarbage(NEW_SPACE); | 5782 heap->CollectGarbage(NEW_SPACE); |
| 5783 const size_t kSize = 1024; | 5783 const size_t kSize = 1024; |
| 5784 AllocateInSpace(isolate, kSize, NEW_SPACE); | 5784 AllocateInSpace(isolate, kSize, NEW_SPACE); |
| 5785 size_t counter2 = heap->NewSpaceAllocationCounter(); | 5785 size_t counter2 = heap->NewSpaceAllocationCounter(); |
| 5786 CHECK_EQ(kSize, counter2 - counter1); | 5786 CHECK_EQ(kSize, counter2 - counter1); |
| 5787 heap->CollectGarbage(NEW_SPACE); | 5787 heap->CollectGarbage(NEW_SPACE); |
| 5788 size_t counter3 = heap->NewSpaceAllocationCounter(); | 5788 size_t counter3 = heap->NewSpaceAllocationCounter(); |
| 5789 CHECK_EQ(0, counter3 - counter2); | 5789 CHECK_EQ(0U, counter3 - counter2); |
| 5790 // Test counter overflow. | 5790 // Test counter overflow. |
| 5791 size_t max_counter = -1; | 5791 size_t max_counter = -1; |
| 5792 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); | 5792 heap->set_new_space_allocation_counter(max_counter - 10 * kSize); |
| 5793 size_t start = heap->NewSpaceAllocationCounter(); | 5793 size_t start = heap->NewSpaceAllocationCounter(); |
| 5794 for (int i = 0; i < 20; i++) { | 5794 for (int i = 0; i < 20; i++) { |
| 5795 AllocateInSpace(isolate, kSize, NEW_SPACE); | 5795 AllocateInSpace(isolate, kSize, NEW_SPACE); |
| 5796 size_t counter = heap->NewSpaceAllocationCounter(); | 5796 size_t counter = heap->NewSpaceAllocationCounter(); |
| 5797 CHECK_EQ(kSize, counter - start); | 5797 CHECK_EQ(kSize, counter - start); |
| 5798 start = counter; | 5798 start = counter; |
| 5799 } | 5799 } |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5953 size_t counter2 = 2000; | 5953 size_t counter2 = 2000; |
| 5954 tracer->SampleAllocation(time2, counter2, counter2); | 5954 tracer->SampleAllocation(time2, counter2, counter2); |
| 5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5955 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5956 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
| 5957 int time3 = 1000; | 5957 int time3 = 1000; |
| 5958 size_t counter3 = 30000; | 5958 size_t counter3 = 30000; |
| 5959 tracer->SampleAllocation(time3, counter3, counter3); | 5959 tracer->SampleAllocation(time3, counter3, counter3); |
| 5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5960 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
| 5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5961 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
| 5962 } | 5962 } |
| OLD | NEW |