| 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 661 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 bool Runtime::SetupArrayBuffer(Isolate* isolate, | 672 bool Runtime::SetupArrayBuffer(Isolate* isolate, |
| 673 Handle<JSArrayBuffer> array_buffer, | 673 Handle<JSArrayBuffer> array_buffer, |
| 674 void* data, | 674 void* data, |
| 675 size_t allocated_length) { | 675 size_t allocated_length) { |
| 676 array_buffer->set_backing_store(data); | 676 array_buffer->set_backing_store(data); |
| 677 | 677 |
| 678 Handle<Object> byte_length = | 678 Handle<Object> byte_length = |
| 679 isolate->factory()->NewNumberFromSize(allocated_length); | 679 isolate->factory()->NewNumberFromSize(allocated_length); |
| 680 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); | 680 CHECK(byte_length->IsSmi() || byte_length->IsHeapNumber()); |
| 681 array_buffer->set_byte_length(*byte_length); | 681 array_buffer->set_byte_length(*byte_length); |
| 682 array_buffer->set_next(Smi::FromInt(0)); |
| 683 array_buffer->set_first_array(Smi::FromInt(0)); |
| 682 return true; | 684 return true; |
| 683 } | 685 } |
| 684 | 686 |
| 685 | 687 |
| 686 bool Runtime::SetupArrayBufferAllocatingData( | 688 bool Runtime::SetupArrayBufferAllocatingData( |
| 687 Isolate* isolate, | 689 Isolate* isolate, |
| 688 Handle<JSArrayBuffer> array_buffer, | 690 Handle<JSArrayBuffer> array_buffer, |
| 689 size_t allocated_length) { | 691 size_t allocated_length) { |
| 690 void* data; | 692 void* data; |
| 691 if (allocated_length != 0) { | 693 if (allocated_length != 0) { |
| (...skipping 12803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13495 // Handle last resort GC and make sure to allow future allocations | 13497 // Handle last resort GC and make sure to allow future allocations |
| 13496 // to grow the heap without causing GCs (if possible). | 13498 // to grow the heap without causing GCs (if possible). |
| 13497 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13499 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13498 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13500 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13499 "Runtime::PerformGC"); | 13501 "Runtime::PerformGC"); |
| 13500 } | 13502 } |
| 13501 } | 13503 } |
| 13502 | 13504 |
| 13503 | 13505 |
| 13504 } } // namespace v8::internal | 13506 } } // namespace v8::internal |
| OLD | NEW |