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 5423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5434 | 5434 |
5435 static void TestRightTrimFixedTypedArray(i::ExternalArrayType type, | 5435 static void TestRightTrimFixedTypedArray(i::ExternalArrayType type, |
5436 int initial_length, | 5436 int initial_length, |
5437 int elements_to_trim) { | 5437 int elements_to_trim) { |
5438 v8::HandleScope scope(CcTest::isolate()); | 5438 v8::HandleScope scope(CcTest::isolate()); |
5439 Isolate* isolate = CcTest::i_isolate(); | 5439 Isolate* isolate = CcTest::i_isolate(); |
5440 Factory* factory = isolate->factory(); | 5440 Factory* factory = isolate->factory(); |
5441 Heap* heap = isolate->heap(); | 5441 Heap* heap = isolate->heap(); |
5442 | 5442 |
5443 Handle<FixedTypedArrayBase> array = | 5443 Handle<FixedTypedArrayBase> array = |
5444 factory->NewFixedTypedArray(initial_length, type); | 5444 factory->NewFixedTypedArray(initial_length, type, true); |
5445 int old_size = array->size(); | 5445 int old_size = array->size(); |
5446 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, | 5446 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, |
5447 elements_to_trim); | 5447 elements_to_trim); |
5448 | 5448 |
5449 // Check that free space filler is at the right place and did not smash the | 5449 // Check that free space filler is at the right place and did not smash the |
5450 // array header. | 5450 // array header. |
5451 CHECK(array->IsFixedArrayBase()); | 5451 CHECK(array->IsFixedArrayBase()); |
5452 CHECK_EQ(initial_length - elements_to_trim, array->length()); | 5452 CHECK_EQ(initial_length - elements_to_trim, array->length()); |
5453 int new_size = array->size(); | 5453 int new_size = array->size(); |
5454 if (new_size != old_size) { | 5454 if (new_size != old_size) { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5789 size_t counter2 = 2000; | 5789 size_t counter2 = 2000; |
5790 tracer->SampleAllocation(time2, counter2, counter2); | 5790 tracer->SampleAllocation(time2, counter2, counter2); |
5791 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5791 size_t throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5792 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); | 5792 CHECK_EQ(2 * (counter2 - counter1) / (time2 - time1), throughput); |
5793 int time3 = 1000; | 5793 int time3 = 1000; |
5794 size_t counter3 = 30000; | 5794 size_t counter3 = 30000; |
5795 tracer->SampleAllocation(time3, counter3, counter3); | 5795 tracer->SampleAllocation(time3, counter3, counter3); |
5796 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); | 5796 throughput = tracer->AllocationThroughputInBytesPerMillisecond(100); |
5797 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); | 5797 CHECK_EQ(2 * (counter3 - counter1) / (time3 - time1), throughput); |
5798 } | 5798 } |
OLD | NEW |