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

Side by Side Diff: runtime/vm/dart_api_state.h

Issue 226973003: Simpler, more consistent triggering of old GC; also, use external in policy. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 8 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #ifndef VM_DART_API_STATE_H_ 5 #ifndef VM_DART_API_STATE_H_
6 #define VM_DART_API_STATE_H_ 6 #define VM_DART_API_STATE_H_
7 7
8 #include "include/dart_api.h" 8 #include "include/dart_api.h"
9 9
10 #include "platform/thread.h" 10 #include "platform/thread.h"
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 Dart_WeakPersistentHandle apiHandle() { 208 Dart_WeakPersistentHandle apiHandle() {
209 return reinterpret_cast<Dart_WeakPersistentHandle>(this); 209 return reinterpret_cast<Dart_WeakPersistentHandle>(this);
210 } 210 }
211 211
212 void SetExternalSize(intptr_t size, Isolate* isolate) { 212 void SetExternalSize(intptr_t size, Isolate* isolate) {
213 ASSERT(size >= 0); 213 ASSERT(size >= 0);
214 set_external_size(Utils::RoundUp(size, kObjectAlignment)); 214 set_external_size(Utils::RoundUp(size, kObjectAlignment));
215 if (SpaceForExternal() == Heap::kNew) { 215 if (SpaceForExternal() == Heap::kNew) {
216 SetExternalNewSpaceBit(); 216 SetExternalNewSpaceBit();
217 } 217 }
218 // TODO(koda): On repeated/large external allocations for existing objects,
219 // without any intervening normal allocation, GC will not trigger.
220 isolate->heap()->AllocateExternal(external_size(), SpaceForExternal()); 218 isolate->heap()->AllocateExternal(external_size(), SpaceForExternal());
221 } 219 }
222 220
223 // Called when the referent becomes unreachable. 221 // Called when the referent becomes unreachable.
224 void UpdateUnreachable(Isolate* isolate) { 222 void UpdateUnreachable(Isolate* isolate) {
225 EnsureFreeExternal(isolate); 223 EnsureFreeExternal(isolate);
226 Finalize(isolate, this); 224 Finalize(isolate, this);
227 } 225 }
228 226
229 // Called when the referent has moved, potentially between generations. 227 // Called when the referent has moved, potentially between generations.
230 void UpdateRelocated(Isolate* isolate) { 228 void UpdateRelocated(Isolate* isolate) {
231 if (IsSetNewSpaceBit() && (SpaceForExternal() == Heap::kOld)) { 229 if (IsSetNewSpaceBit() && (SpaceForExternal() == Heap::kOld)) {
232 isolate->heap()->FreeExternal(external_size(), Heap::kNew); 230 isolate->heap()->PromoteExternal(external_size());
233 isolate->heap()->AllocateExternal(external_size(), Heap::kOld);
234 ClearExternalNewSpaceBit(); 231 ClearExternalNewSpaceBit();
235 } 232 }
236 } 233 }
237 234
238 // Idempotent. Called when the handle is explicitly deleted or the 235 // Idempotent. Called when the handle is explicitly deleted or the
239 // referent becomes unreachable. 236 // referent becomes unreachable.
240 void EnsureFreeExternal(Isolate* isolate) { 237 void EnsureFreeExternal(Isolate* isolate) {
241 isolate->heap()->FreeExternal(external_size(), SpaceForExternal()); 238 isolate->heap()->FreeExternal(external_size(), SpaceForExternal());
242 set_external_size(0); 239 set_external_size(0);
243 } 240 }
(...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after
886 ApiNativeScope::Current()->zone()) {} 883 ApiNativeScope::Current()->zone()) {}
887 ApiGrowableArray() 884 ApiGrowableArray()
888 : BaseGrowableArray<T, ValueObject>( 885 : BaseGrowableArray<T, ValueObject>(
889 ApiNativeScope::Current()->zone()) {} 886 ApiNativeScope::Current()->zone()) {}
890 }; 887 };
891 888
892 889
893 } // namespace dart 890 } // namespace dart
894 891
895 #endif // VM_DART_API_STATE_H_ 892 #endif // VM_DART_API_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698