| 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 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 693 | 693 |
| 694 | 694 |
| 695 void Runtime::FreeArrayBuffer(Isolate* isolate, | 695 void Runtime::FreeArrayBuffer(Isolate* isolate, |
| 696 JSArrayBuffer* phantom_array_buffer) { | 696 JSArrayBuffer* phantom_array_buffer) { |
| 697 if (phantom_array_buffer->is_external()) return; | 697 if (phantom_array_buffer->is_external()) return; |
| 698 | 698 |
| 699 size_t allocated_length = NumberToSize( | 699 size_t allocated_length = NumberToSize( |
| 700 isolate, phantom_array_buffer->byte_length()); | 700 isolate, phantom_array_buffer->byte_length()); |
| 701 | 701 |
| 702 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( | 702 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
| 703 -static_cast<intptr_t>(allocated_length)); | 703 -static_cast<int64_t>(allocated_length)); |
| 704 CHECK(V8::ArrayBufferAllocator() != NULL); | 704 CHECK(V8::ArrayBufferAllocator() != NULL); |
| 705 V8::ArrayBufferAllocator()->Free( | 705 V8::ArrayBufferAllocator()->Free( |
| 706 phantom_array_buffer->backing_store(), | 706 phantom_array_buffer->backing_store(), |
| 707 allocated_length); | 707 allocated_length); |
| 708 } | 708 } |
| 709 | 709 |
| 710 | 710 |
| 711 void Runtime::SetupArrayBuffer(Isolate* isolate, | 711 void Runtime::SetupArrayBuffer(Isolate* isolate, |
| 712 Handle<JSArrayBuffer> array_buffer, | 712 Handle<JSArrayBuffer> array_buffer, |
| 713 bool is_external, | 713 bool is_external, |
| (...skipping 14176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14890 // Handle last resort GC and make sure to allow future allocations | 14890 // Handle last resort GC and make sure to allow future allocations |
| 14891 // to grow the heap without causing GCs (if possible). | 14891 // to grow the heap without causing GCs (if possible). |
| 14892 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14892 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14893 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14893 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14894 "Runtime::PerformGC"); | 14894 "Runtime::PerformGC"); |
| 14895 } | 14895 } |
| 14896 } | 14896 } |
| 14897 | 14897 |
| 14898 | 14898 |
| 14899 } } // namespace v8::internal | 14899 } } // namespace v8::internal |
| OLD | NEW |