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

Side by Side Diff: src/runtime.cc

Issue 21803002: Add size_t length argument to v8::ArrayBuffer::Allocator::Free. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Shared buold fixed Created 7 years, 4 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 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(phantom_array_buffer->backing_store()); 692 V8::ArrayBufferAllocator()->Free(
693 phantom_array_buffer->backing_store(),
694 allocated_length);
693 } 695 }
694 696
695 697
696 void Runtime::SetupArrayBuffer(Isolate* isolate, 698 void Runtime::SetupArrayBuffer(Isolate* isolate,
697 Handle<JSArrayBuffer> array_buffer, 699 Handle<JSArrayBuffer> array_buffer,
698 bool is_external, 700 bool is_external,
699 void* data, 701 void* data,
700 size_t allocated_length) { 702 size_t allocated_length) {
701 ASSERT(array_buffer->GetInternalFieldCount() == 703 ASSERT(array_buffer->GetInternalFieldCount() ==
702 v8::ArrayBuffer::kInternalFieldCount); 704 v8::ArrayBuffer::kInternalFieldCount);
(...skipping 13453 matching lines...) Expand 10 before | Expand all | Expand 10 after
14156 // Handle last resort GC and make sure to allow future allocations 14158 // Handle last resort GC and make sure to allow future allocations
14157 // to grow the heap without causing GCs (if possible). 14159 // to grow the heap without causing GCs (if possible).
14158 isolate->counters()->gc_last_resort_from_js()->Increment(); 14160 isolate->counters()->gc_last_resort_from_js()->Increment();
14159 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags, 14161 isolate->heap()->CollectAllGarbage(Heap::kNoGCFlags,
14160 "Runtime::PerformGC"); 14162 "Runtime::PerformGC");
14161 } 14163 }
14162 } 14164 }
14163 14165
14164 14166
14165 } } // namespace v8::internal 14167 } } // 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