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

Unified Diff: runtime/vm/dart_api_impl.cc

Issue 187113003: Track external allocated memory for weak persistent handles. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: runtime/vm/dart_api_impl.cc
===================================================================
--- runtime/vm/dart_api_impl.cc (revision 33235)
+++ runtime/vm/dart_api_impl.cc (working copy)
@@ -617,6 +617,7 @@
FinalizablePersistentHandles* handles,
Dart_Handle object,
void* peer,
+ intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback) {
ReusableObjectHandleScope reused_obj_handle(isolate);
Object& ref = reused_obj_handle.Handle();
@@ -625,6 +626,8 @@
finalizable_ref->set_raw(ref);
finalizable_ref->set_peer(peer);
finalizable_ref->set_callback(callback);
+ finalizable_ref->SetExternalAllocationSize(external_allocation_size,
+ isolate->heap());
return reinterpret_cast<Dart_WeakPersistentHandle>(finalizable_ref);
}
@@ -632,6 +635,7 @@
DART_EXPORT Dart_WeakPersistentHandle Dart_NewWeakPersistentHandle(
Dart_Handle object,
void* peer,
+ intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
@@ -641,6 +645,7 @@
&state->weak_persistent_handles(),
object,
peer,
+ external_allocation_size,
callback);
}
@@ -648,6 +653,7 @@
DART_EXPORT Dart_WeakPersistentHandle Dart_NewPrologueWeakPersistentHandle(
Dart_Handle object,
void* peer,
+ intptr_t external_allocation_size,
Dart_WeakPersistentHandleFinalizer callback) {
Isolate* isolate = Isolate::Current();
CHECK_ISOLATE(isolate);
@@ -657,6 +663,7 @@
&state->prologue_weak_persistent_handles(),
object,
peer,
+ external_allocation_size,
callback);
}
@@ -1785,6 +1792,7 @@
intptr_t length,
void* peer,
Dart_PeerFinalizer cback) {
+ // TODO(17284): Allocate large external data in old space.
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (latin1_array == NULL && length != 0) {
@@ -1801,6 +1809,7 @@
intptr_t length,
void* peer,
Dart_PeerFinalizer cback) {
+ // TODO(17284): Allocate large external data in old space.
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (utf16_array == NULL && length != 0) {
@@ -2742,6 +2751,7 @@
Dart_TypedData_Type type,
void* data,
intptr_t length) {
+ // TODO(17284): Allocate large external data in old space.
Isolate* isolate = Isolate::Current();
DARTSCOPE(isolate);
if (data == NULL && length != 0) {

Powered by Google App Engine
This is Rietveld 408576698