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

Side by Side Diff: src/runtime.cc

Issue 310393003: Move most of the implementation of AdjustAmountOfExternalMemory to v8.h (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: updates Created 6 years, 6 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/isolate.cc ('k') | no next file » | 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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <stdlib.h> 5 #include <stdlib.h>
6 #include <limits> 6 #include <limits>
7 7
8 #include "src/v8.h" 8 #include "src/v8.h"
9 9
10 #include "src/accessors.h" 10 #include "src/accessors.h"
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 JSArrayBuffer* phantom_array_buffer) { 757 JSArrayBuffer* phantom_array_buffer) {
758 if (phantom_array_buffer->should_be_freed()) { 758 if (phantom_array_buffer->should_be_freed()) {
759 ASSERT(phantom_array_buffer->is_external()); 759 ASSERT(phantom_array_buffer->is_external());
760 free(phantom_array_buffer->backing_store()); 760 free(phantom_array_buffer->backing_store());
761 } 761 }
762 if (phantom_array_buffer->is_external()) return; 762 if (phantom_array_buffer->is_external()) return;
763 763
764 size_t allocated_length = NumberToSize( 764 size_t allocated_length = NumberToSize(
765 isolate, phantom_array_buffer->byte_length()); 765 isolate, phantom_array_buffer->byte_length());
766 766
767 isolate->heap()->AdjustAmountOfExternalAllocatedMemory( 767 reinterpret_cast<v8::Isolate*>(isolate)
768 -static_cast<int64_t>(allocated_length)); 768 ->AdjustAmountOfExternalAllocatedMemory(
769 -static_cast<int64_t>(allocated_length));
769 CHECK(V8::ArrayBufferAllocator() != NULL); 770 CHECK(V8::ArrayBufferAllocator() != NULL);
770 V8::ArrayBufferAllocator()->Free( 771 V8::ArrayBufferAllocator()->Free(
771 phantom_array_buffer->backing_store(), 772 phantom_array_buffer->backing_store(),
772 allocated_length); 773 allocated_length);
773 } 774 }
774 775
775 776
776 void Runtime::SetupArrayBuffer(Isolate* isolate, 777 void Runtime::SetupArrayBuffer(Isolate* isolate,
777 Handle<JSArrayBuffer> array_buffer, 778 Handle<JSArrayBuffer> array_buffer,
778 bool is_external, 779 bool is_external,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 data = 813 data =
813 V8::ArrayBufferAllocator()->AllocateUninitialized(allocated_length); 814 V8::ArrayBufferAllocator()->AllocateUninitialized(allocated_length);
814 } 815 }
815 if (data == NULL) return false; 816 if (data == NULL) return false;
816 } else { 817 } else {
817 data = NULL; 818 data = NULL;
818 } 819 }
819 820
820 SetupArrayBuffer(isolate, array_buffer, false, data, allocated_length); 821 SetupArrayBuffer(isolate, array_buffer, false, data, allocated_length);
821 822
822 isolate->heap()->AdjustAmountOfExternalAllocatedMemory(allocated_length); 823 reinterpret_cast<v8::Isolate*>(isolate)
824 ->AdjustAmountOfExternalAllocatedMemory(allocated_length);
823 825
824 return true; 826 return true;
825 } 827 }
826 828
827 829
828 void Runtime::NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer) { 830 void Runtime::NeuterArrayBuffer(Handle<JSArrayBuffer> array_buffer) {
829 Isolate* isolate = array_buffer->GetIsolate(); 831 Isolate* isolate = array_buffer->GetIsolate();
830 for (Handle<Object> view_obj(array_buffer->weak_first_view(), isolate); 832 for (Handle<Object> view_obj(array_buffer->weak_first_view(), isolate);
831 !view_obj->IsUndefined();) { 833 !view_obj->IsUndefined();) {
832 Handle<JSArrayBufferView> view(JSArrayBufferView::cast(*view_obj)); 834 Handle<JSArrayBufferView> view(JSArrayBufferView::cast(*view_obj));
(...skipping 14303 matching lines...) Expand 10 before | Expand all | Expand 10 after
15136 } 15138 }
15137 return NULL; 15139 return NULL;
15138 } 15140 }
15139 15141
15140 15142
15141 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 15143 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
15142 return &(kIntrinsicFunctions[static_cast<int>(id)]); 15144 return &(kIntrinsicFunctions[static_cast<int>(id)]);
15143 } 15145 }
15144 15146
15145 } } // namespace v8::internal 15147 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/isolate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698