Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: src/runtime.cc

Issue 19959006: Pass the ArrayBuffer size to ArrayBuffer::Allocator::Free. Allows (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/d8.cc ('k') | test/cctest/cctest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
668 void Runtime::FreeArrayBuffer(Isolate* isolate, 668 void Runtime::FreeArrayBuffer(Isolate* isolate,
669 JSArrayBuffer* phantom_array_buffer) { 669 JSArrayBuffer* phantom_array_buffer) {
670 if (phantom_array_buffer->is_external()) return; 670 if (phantom_array_buffer->is_external()) return;
671 671
672 size_t allocated_length = NumberToSize( 672 size_t allocated_length = NumberToSize(
673 isolate, phantom_array_buffer->byte_length()); 673 isolate, phantom_array_buffer->byte_length());
674 674
675 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( 675 isolate->heap()->AdjustAmountOfExternalAllocatedMemory(
676 -static_cast<intptr_t>(allocated_length)); 676 -static_cast<intptr_t>(allocated_length));
677 CHECK(V8::ArrayBufferAllocator() != NULL); 677 CHECK(V8::ArrayBufferAllocator() != NULL);
678 V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store()); 678 V8::ArrayBufferAllocator()->Free(phantom_array_buffer->backing_store(),
679 allocated_length);
679 } 680 }
680 681
681 682
682 void Runtime::SetupArrayBuffer(Isolate* isolate, 683 void Runtime::SetupArrayBuffer(Isolate* isolate,
683 Handle<JSArrayBuffer> array_buffer, 684 Handle<JSArrayBuffer> array_buffer,
684 bool is_external, 685 bool is_external,
685 void* data, 686 void* data,
686 size_t allocated_length) { 687 size_t allocated_length) {
687 ASSERT(array_buffer->GetInternalFieldCount() == 688 ASSERT(array_buffer->GetInternalFieldCount() ==
688 v8::ArrayBuffer::kInternalFieldCount); 689 v8::ArrayBuffer::kInternalFieldCount);
(...skipping 13275 matching lines...) Expand 10 before | Expand all | Expand 10 after
13964 // Handle last resort GC and make sure to allow future allocations 13965 // Handle last resort GC and make sure to allow future allocations
13965 // to grow the heap without causing GCs (if possible). 13966 // to grow the heap without causing GCs (if possible).
13966 isolate->counters()->gc_last_resort_from_js()->Increment(); 13967 isolate->counters()->gc_last_resort_from_js()->Increment();
13967 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 13968 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
13968 "Runtime::PerformGC"); 13969 "Runtime::PerformGC");
13969 } 13970 }
13970 } 13971 }
13971 13972
13972 13973
13973 } } // namespace v8::internal 13974 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/d8.cc ('k') | test/cctest/cctest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698