| 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 5310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5321 int initial_length, | 5321 int initial_length, |
| 5322 int elements_to_trim) { | 5322 int elements_to_trim) { |
| 5323 v8::HandleScope scope(CcTest::isolate()); | 5323 v8::HandleScope scope(CcTest::isolate()); |
| 5324 Isolate* isolate = CcTest::i_isolate(); | 5324 Isolate* isolate = CcTest::i_isolate(); |
| 5325 Factory* factory = isolate->factory(); | 5325 Factory* factory = isolate->factory(); |
| 5326 Heap* heap = isolate->heap(); | 5326 Heap* heap = isolate->heap(); |
| 5327 | 5327 |
| 5328 Handle<FixedTypedArrayBase> array = | 5328 Handle<FixedTypedArrayBase> array = |
| 5329 factory->NewFixedTypedArray(initial_length, type); | 5329 factory->NewFixedTypedArray(initial_length, type); |
| 5330 int old_size = array->size(); | 5330 int old_size = array->size(); |
| 5331 heap->RightTrimFixedArray<Heap::FROM_MUTATOR>(*array, elements_to_trim); | 5331 heap->RightTrimFixedArray<Heap::CONCURRENT_TO_SWEEPER>(*array, |
| 5332 elements_to_trim); |
| 5332 | 5333 |
| 5333 // Check that free space filler is at the right place and did not smash the | 5334 // Check that free space filler is at the right place and did not smash the |
| 5334 // array header. | 5335 // array header. |
| 5335 CHECK(array->IsFixedArrayBase()); | 5336 CHECK(array->IsFixedArrayBase()); |
| 5336 CHECK_EQ(initial_length - elements_to_trim, array->length()); | 5337 CHECK_EQ(initial_length - elements_to_trim, array->length()); |
| 5337 int new_size = array->size(); | 5338 int new_size = array->size(); |
| 5338 if (new_size != old_size) { | 5339 if (new_size != old_size) { |
| 5339 // Free space filler should be created in this case. | 5340 // Free space filler should be created in this case. |
| 5340 Address next_obj_address = array->address() + array->size(); | 5341 Address next_obj_address = array->address() + array->size(); |
| 5341 CHECK(HeapObject::FromAddress(next_obj_address)->IsFiller()); | 5342 CHECK(HeapObject::FromAddress(next_obj_address)->IsFiller()); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 5359 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 8, 6); | 5360 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 8, 6); |
| 5360 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 8 - 1, 6); | 5361 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 8 - 1, 6); |
| 5361 | 5362 |
| 5362 // 32-bit cases. | 5363 // 32-bit cases. |
| 5363 TestRightTrimFixedTypedArray(v8::kExternalUint8Array, 16, 3); | 5364 TestRightTrimFixedTypedArray(v8::kExternalUint8Array, 16, 3); |
| 5364 TestRightTrimFixedTypedArray(v8::kExternalUint8Array, 16 - 3, 3); | 5365 TestRightTrimFixedTypedArray(v8::kExternalUint8Array, 16 - 3, 3); |
| 5365 TestRightTrimFixedTypedArray(v8::kExternalUint16Array, 8, 3); | 5366 TestRightTrimFixedTypedArray(v8::kExternalUint16Array, 8, 3); |
| 5366 TestRightTrimFixedTypedArray(v8::kExternalUint16Array, 8 - 1, 3); | 5367 TestRightTrimFixedTypedArray(v8::kExternalUint16Array, 8 - 1, 3); |
| 5367 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 4, 3); | 5368 TestRightTrimFixedTypedArray(v8::kExternalUint32Array, 4, 3); |
| 5368 } | 5369 } |
| OLD | NEW |