| 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 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 | 794 |
| 795 static void ArrayBufferWeakCallback(v8::Isolate* external_isolate, | 795 static void ArrayBufferWeakCallback(v8::Isolate* external_isolate, |
| 796 Persistent<Value> object, | 796 Persistent<Value> object, |
| 797 void* data) { | 797 void* data) { |
| 798 Isolate* isolate = reinterpret_cast<Isolate*>(external_isolate); | 798 Isolate* isolate = reinterpret_cast<Isolate*>(external_isolate); |
| 799 HandleScope scope(isolate); | 799 HandleScope scope(isolate); |
| 800 Handle<Object> internal_object = Utils::OpenHandle(*object); | 800 Handle<Object> internal_object = Utils::OpenHandle(*object); |
| 801 | 801 |
| 802 size_t allocated_length = ArrayBufferAllocatedLength( | 802 size_t allocated_length = ArrayBufferAllocatedLength( |
| 803 isolate, JSArrayBuffer::cast(*internal_object)); | 803 isolate, JSArrayBuffer::cast(*internal_object)); |
| 804 isolate->heap()->AdjustAmountOfExternalAllocatedMemory(-allocated_length); | 804 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( |
| 805 -static_cast<intptr_t>(allocated_length)); |
| 805 if (data != NULL) | 806 if (data != NULL) |
| 806 free(data); | 807 free(data); |
| 807 object.Dispose(external_isolate); | 808 object.Dispose(external_isolate); |
| 808 } | 809 } |
| 809 | 810 |
| 810 | 811 |
| 811 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferInitialize) { | 812 RUNTIME_FUNCTION(MaybeObject*, Runtime_ArrayBufferInitialize) { |
| 812 HandleScope scope(isolate); | 813 HandleScope scope(isolate); |
| 813 ASSERT(args.length() == 2); | 814 ASSERT(args.length() == 2); |
| 814 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, holder, 0); | 815 CONVERT_ARG_HANDLE_CHECKED(JSArrayBuffer, holder, 0); |
| (...skipping 12334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13149 // Handle last resort GC and make sure to allow future allocations | 13150 // Handle last resort GC and make sure to allow future allocations |
| 13150 // to grow the heap without causing GCs (if possible). | 13151 // to grow the heap without causing GCs (if possible). |
| 13151 isolate->counters()->gc_last_resort_from_js()->Increment(); | 13152 isolate->counters()->gc_last_resort_from_js()->Increment(); |
| 13152 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, | 13153 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, |
| 13153 "Runtime::PerformGC"); | 13154 "Runtime::PerformGC"); |
| 13154 } | 13155 } |
| 13155 } | 13156 } |
| 13156 | 13157 |
| 13157 | 13158 |
| 13158 } } // namespace v8::internal | 13159 } } // namespace v8::internal |
| OLD | NEW |