Chromium Code Reviews| 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 free(phantom_array_buffer->backing_store()); | |
|
Yang
2013/11/22 11:34:43
Please make sure that this returns afterwards, eit
| |
| 699 } | |
| 697 if (phantom_array_buffer->is_external()) return; | 700 if (phantom_array_buffer->is_external()) return; |
| 698 | 701 |
| 699 size_t allocated_length = NumberToSize( | 702 size_t allocated_length = NumberToSize( |
| 700 isolate, phantom_array_buffer->byte_length()); | 703 isolate, phantom_array_buffer->byte_length()); |
| 701 | 704 |
| 702 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( | 705 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
| 703 -static_cast<int64_t>(allocated_length)); | 706 -static_cast<int64_t>(allocated_length)); |
| 704 CHECK(V8::ArrayBufferAllocator() != NULL); | 707 CHECK(V8::ArrayBufferAllocator() != NULL); |
| 705 V8::ArrayBufferAllocator()->Free( | 708 V8::ArrayBufferAllocator()->Free( |
| 706 phantom_array_buffer->backing_store(), | 709 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 | 14891 // Handle last resort GC and make sure to allow future allocations |
| 14889 // to grow the heap without causing GCs (if possible). | 14892 // to grow the heap without causing GCs (if possible). |
| 14890 isolate->counters()->gc_last_resort_from_js()->Increment(); | 14893 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 14891 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 14894 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 14892 "Runtime::PerformGC"); | 14895 "Runtime::PerformGC"); |
| 14893 } | 14896 } |
| 14894 } | 14897 } |
| 14895 | 14898 |
| 14896 | 14899 |
| 14897 } } // namespace v8::internal | 14900 } } // namespace v8::internal |
| OLD | NEW |