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 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 HandleScope scope(isolate); | 687 HandleScope scope(isolate); |
688 ASSERT(args.length() == 1); | 688 ASSERT(args.length() == 1); |
689 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); | 689 CONVERT_ARG_HANDLE_CHECKED(JSProxy, proxy, 0); |
690 JSProxy::Fix(proxy); | 690 JSProxy::Fix(proxy); |
691 return isolate->heap()->undefined_value(); | 691 return isolate->heap()->undefined_value(); |
692 } | 692 } |
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->should_be_freed()) { |
| 698 ASSERT(phantom_array_buffer->is_external()); |
| 699 free(phantom_array_buffer->backing_store()); |
| 700 } |
697 if (phantom_array_buffer->is_external()) return; | 701 if (phantom_array_buffer->is_external()) return; |
698 | 702 |
699 size_t allocated_length = NumberToSize( | 703 size_t allocated_length = NumberToSize( |
700 isolate, phantom_array_buffer->byte_length()); | 704 isolate, phantom_array_buffer->byte_length()); |
701 | 705 |
702 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( | 706 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
703 -static_cast<int64_t>(allocated_length)); | 707 -static_cast<int64_t>(allocated_length)); |
704 CHECK(V8::ArrayBufferAllocator() != NULL); | 708 CHECK(V8::ArrayBufferAllocator() != NULL); |
705 V8::ArrayBufferAllocator()->Free( | 709 V8::ArrayBufferAllocator()->Free( |
706 phantom_array_buffer->backing_store(), | 710 phantom_array_buffer->backing_store(), |
(...skipping 14181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14888 // Handle last resort GC and make sure to allow future allocations | 14892 // Handle last resort GC and make sure to allow future allocations |
14889 // to grow the heap without causing GCs (if possible). | 14893 // to grow the heap without causing GCs (if possible). |
14890 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14894 isolate->counters()->gc_last_resort_from_js()->Increment(); |
14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14895 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
14892 "Runtime::PerformGC"); | 14896 "Runtime::PerformGC"); |
14893 } | 14897 } |
14894 } | 14898 } |
14895 | 14899 |
14896 | 14900 |
14897 } } // namespace v8::internal | 14901 } } // namespace v8::internal |
OLD | NEW |