| 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 void Runtime::FreeArrayBuffer(Isolate* isolate, | 682 void Runtime::FreeArrayBuffer(Isolate* isolate, |
| 683 JSArrayBuffer* phantom_array_buffer) { | 683 JSArrayBuffer* phantom_array_buffer) { |
| 684 if (phantom_array_buffer->is_external()) return; | 684 if (phantom_array_buffer->is_external()) return; |
| 685 | 685 |
| 686 size_t allocated_length = NumberToSize( | 686 size_t allocated_length = NumberToSize( |
| 687 isolate, phantom_array_buffer->byte_length()); | 687 isolate, phantom_array_buffer->byte_length()); |
| 688 | 688 |
| 689 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( | 689 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
| 690 -static_cast<intptr_t>(allocated_length)); | 690 -static_cast<intptr_t>(allocated_length)); |
| 691 CHECK(V8::ArrayBufferAllocator() != NULL); | 691 CHECK(V8::ArrayBufferAllocator() != NULL); |
| 692 V8::ArrayBufferAllocator()->Free( | 692 V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store()); |
| 693 phantom_array_buffer->backing_store(), | |
| 694 allocated_length); | |
| 695 } | 693 } |
| 696 | 694 |
| 697 | 695 |
| 698 void Runtime::SetupArrayBuffer(Isolate* isolate, | 696 void Runtime::SetupArrayBuffer(Isolate* isolate, |
| 699 Handle<JSArrayBuffer> array_buffer, | 697 Handle<JSArrayBuffer> array_buffer, |
| 700 bool is_external, | 698 bool is_external, |
| 701 void* data, | 699 void* data, |
| 702 size_t allocated_length) { | 700 size_t allocated_length) { |
| 703 ASSERT(array_buffer->GetInternalFieldCount() == | 701 ASSERT(array_buffer->GetInternalFieldCount() == |
| 704 v8::ArrayBuffer::kInternalFieldCount); | 702 v8::ArrayBuffer::kInternalFieldCount); |
| (...skipping 13453 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 14158 // Handle last resort GC and make sure to allow future allocations | 14156 // Handle last resort GC and make sure to allow future allocations |
| 14159 // to grow the heap without causing GCs (if possible). | 14157 // to grow the heap without causing GCs (if possible). |
| 14160 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14158 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14161 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14159 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14162 "Runtime::PerformGC"); | 14160 "Runtime::PerformGC"); |
| 14163 } | 14161 } |
| 14164 } | 14162 } |
| 14165 | 14163 |
| 14166 | 14164 |
| 14167 } } // namespace v8::internal | 14165 } } // namespace v8::internal |
| OLD | NEW |