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

Side by Side Diff: runtime/vm/raw_object.cc

Issue 70183010: Fixes a couple problems with GC of unoptimized code. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 1 month 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 #include "vm/raw_object.h" 5 #include "vm/raw_object.h"
6 6
7 #include "vm/class_table.h" 7 #include "vm/class_table.h"
8 #include "vm/dart.h" 8 #include "vm/dart.h"
9 #include "vm/freelist.h" 9 #include "vm/freelist.h"
10 #include "vm/isolate.h" 10 #include "vm/isolate.h"
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
359 } 359 }
360 360
361 361
362 intptr_t RawRedirectionData::VisitRedirectionDataPointers( 362 intptr_t RawRedirectionData::VisitRedirectionDataPointers(
363 RawRedirectionData* raw_obj, ObjectPointerVisitor* visitor) { 363 RawRedirectionData* raw_obj, ObjectPointerVisitor* visitor) {
364 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 364 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
365 return RedirectionData::InstanceSize(); 365 return RedirectionData::InstanceSize();
366 } 366 }
367 367
368 368
369 bool RawFunction::MayTrySkippingCode(RawFunction* raw_fun) {
370 Function fn;
371 fn = raw_fun;
372
373 Code code;
374 code = fn.CurrentCode();
375
376 // TODO(zra): If we would return true here, instead halve the usage counter,
377 // and return true only if the counter is then zero. Otherwise
378 // return false. For now, while testing, always skip the function's
379 // code pointer when usage_counter > 0.
380
381 return fn.HasCode() && // Not already detached.
382 !code.is_optimized() &&
383 !fn.HasBreakpoint() &&
384 (fn.usage_counter() > 0);
385 }
386
387
369 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, 388 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj,
370 ObjectPointerVisitor* visitor) { 389 ObjectPointerVisitor* visitor) {
371 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 390 if (visitor->visit_function_code() ||
391 !RawFunction::MayTrySkippingCode(raw_obj)) {
392 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
393 } else {
394 GrowableArray<RawFunction*>* sfga = visitor->skipped_code_functions();
395 ASSERT(sfga != NULL);
396 sfga->Add(raw_obj);
397 visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code());
398 }
372 return Function::InstanceSize(); 399 return Function::InstanceSize();
373 } 400 }
374 401
375 402
376 intptr_t RawField::VisitFieldPointers(RawField* raw_obj, 403 intptr_t RawField::VisitFieldPointers(RawField* raw_obj,
377 ObjectPointerVisitor* visitor) { 404 ObjectPointerVisitor* visitor) {
378 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 405 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
379 return Field::InstanceSize(); 406 return Field::InstanceSize();
380 } 407 }
381 408
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
801 828
802 intptr_t RawMirrorReference::VisitMirrorReferencePointers( 829 intptr_t RawMirrorReference::VisitMirrorReferencePointers(
803 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { 830 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) {
804 // Make sure that we got here with the tagged pointer as this. 831 // Make sure that we got here with the tagged pointer as this.
805 ASSERT(raw_obj->IsHeapObject()); 832 ASSERT(raw_obj->IsHeapObject());
806 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); 833 visitor->VisitPointers(raw_obj->from(), raw_obj->to());
807 return MirrorReference::InstanceSize(); 834 return MirrorReference::InstanceSize();
808 } 835 }
809 836
810 } // namespace dart 837 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698