Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 // NOTE: This code runs while GC is in progress and runs within | |
| 371 // a NoHandleScope block. Hence it is not okay to use regular Zone or | |
| 372 // Scope handles. We use direct stack handles, and so the raw pointers in | |
| 373 // these handles are not traversed. The use of handles is mainly to | |
| 374 // be able to reuse the handle based code and avoid having to add | |
| 375 // helper functions to the raw object interface. | |
| 376 Function fn; | |
| 377 fn = raw_fun; | |
| 378 | |
| 379 Code code; | |
| 380 code = fn.CurrentCode(); | |
| 381 | |
| 382 if (fn.HasCode() && // Not already detached. | |
|
Ivan Posva
2013/11/19 19:24:48
Wouldn't code just be null in this case?
zra
2013/11/22 17:18:54
Changed to !code.IsNull()
| |
| 383 !code.is_optimized() && | |
| 384 !fn.HasBreakpoint() && | |
| 385 (fn.usage_counter() > 0)) { | |
|
Ivan Posva
2013/11/19 19:24:48
Is this still necessary? If it is please comment w
zra
2013/11/22 17:18:54
Changed to >= 0.
| |
| 386 fn.set_usage_counter(fn.usage_counter() / 2); | |
| 387 if (FLAG_always_drop_code || (fn.usage_counter() == 0)) { | |
| 388 return true; | |
| 389 } | |
| 390 } | |
| 391 return false; | |
| 392 } | |
| 393 | |
| 394 | |
| 369 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, | 395 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, |
| 370 ObjectPointerVisitor* visitor) { | 396 ObjectPointerVisitor* visitor) { |
| 371 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 397 if (visitor->visit_function_code() || |
| 398 !RawFunction::MayTrySkippingCode(raw_obj)) { | |
| 399 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | |
| 400 } else { | |
| 401 GrowableArray<RawFunction*>* sfga = visitor->skipped_code_functions(); | |
| 402 ASSERT(sfga != NULL); | |
| 403 sfga->Add(raw_obj); | |
| 404 visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code()); | |
| 405 } | |
| 372 return Function::InstanceSize(); | 406 return Function::InstanceSize(); |
| 373 } | 407 } |
| 374 | 408 |
| 375 | 409 |
| 376 intptr_t RawField::VisitFieldPointers(RawField* raw_obj, | 410 intptr_t RawField::VisitFieldPointers(RawField* raw_obj, |
| 377 ObjectPointerVisitor* visitor) { | 411 ObjectPointerVisitor* visitor) { |
| 378 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 412 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 379 return Field::InstanceSize(); | 413 return Field::InstanceSize(); |
| 380 } | 414 } |
| 381 | 415 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 801 | 835 |
| 802 intptr_t RawMirrorReference::VisitMirrorReferencePointers( | 836 intptr_t RawMirrorReference::VisitMirrorReferencePointers( |
| 803 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { | 837 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { |
| 804 // Make sure that we got here with the tagged pointer as this. | 838 // Make sure that we got here with the tagged pointer as this. |
| 805 ASSERT(raw_obj->IsHeapObject()); | 839 ASSERT(raw_obj->IsHeapObject()); |
| 806 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 840 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 807 return MirrorReference::InstanceSize(); | 841 return MirrorReference::InstanceSize(); |
| 808 } | 842 } |
| 809 | 843 |
| 810 } // namespace dart | 844 } // namespace dart |
| OLD | NEW |