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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 130 case kTypeArgumentsCid: { | 130 case kTypeArgumentsCid: { |
| 131 const RawTypeArguments* raw_array = | 131 const RawTypeArguments* raw_array = |
| 132 reinterpret_cast<const RawTypeArguments*>(this); | 132 reinterpret_cast<const RawTypeArguments*>(this); |
| 133 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); | 133 intptr_t array_length = Smi::Value(raw_array->ptr()->length_); |
| 134 instance_size = TypeArguments::InstanceSize(array_length); | 134 instance_size = TypeArguments::InstanceSize(array_length); |
| 135 break; | 135 break; |
| 136 } | 136 } |
| 137 case kPcDescriptorsCid: { | 137 case kPcDescriptorsCid: { |
| 138 const RawPcDescriptors* raw_descriptors = | 138 const RawPcDescriptors* raw_descriptors = |
| 139 reinterpret_cast<const RawPcDescriptors*>(this); | 139 reinterpret_cast<const RawPcDescriptors*>(this); |
| 140 intptr_t num_descriptors = Smi::Value(raw_descriptors->ptr()->length_); | 140 intptr_t num_descriptors = raw_descriptors->ptr()->length_; |
| 141 instance_size = PcDescriptors::InstanceSize(num_descriptors); | 141 instance_size = PcDescriptors::InstanceSize(num_descriptors); |
| 142 break; | 142 break; |
| 143 } | 143 } |
| 144 case kStackmapCid: { | 144 case kStackmapCid: { |
| 145 const RawStackmap* map = reinterpret_cast<const RawStackmap*>(this); | 145 const RawStackmap* map = reinterpret_cast<const RawStackmap*>(this); |
| 146 intptr_t length = map->ptr()->length_; | 146 intptr_t length = map->ptr()->length_; |
| 147 instance_size = Stackmap::InstanceSize(length); | 147 instance_size = Stackmap::InstanceSize(length); |
| 148 break; | 148 break; |
| 149 } | 149 } |
| 150 case kLocalVarDescriptorsCid: { | 150 case kLocalVarDescriptorsCid: { |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 // be able to reuse the handle based code and avoid having to add | 366 // be able to reuse the handle based code and avoid having to add |
| 367 // helper functions to the raw object interface. | 367 // helper functions to the raw object interface. |
| 368 Function fn; | 368 Function fn; |
| 369 fn = raw_fun; | 369 fn = raw_fun; |
| 370 | 370 |
| 371 Code code; | 371 Code code; |
| 372 code = fn.CurrentCode(); | 372 code = fn.CurrentCode(); |
| 373 | 373 |
| 374 if (!code.IsNull() && // The function may not have code. | 374 if (!code.IsNull() && // The function may not have code. |
| 375 !code.is_optimized() && | 375 !code.is_optimized() && |
| 376 (fn.CurrentCode() == fn.unoptimized_code()) && | 376 (fn.CurrentCode() == fn.unoptimized_code()) && |
|
zra
2014/03/21 14:44:31
I think you also need to modify this logic, otherw
Florian Schneider
2014/03/21 15:13:58
Yes, thanks. This also means that collection of cl
| |
| 377 !code.HasBreakpoint() && | 377 !code.HasBreakpoint() && |
| 378 (fn.usage_counter() >= 0)) { | 378 (fn.usage_counter() >= 0)) { |
| 379 fn.set_usage_counter(fn.usage_counter() / 2); | 379 fn.set_usage_counter(fn.usage_counter() / 2); |
| 380 if (FLAG_always_drop_code || (fn.usage_counter() == 0)) { | 380 if (FLAG_always_drop_code || (fn.usage_counter() == 0)) { |
| 381 return true; | 381 return true; |
| 382 } | 382 } |
| 383 } | 383 } |
| 384 return false; | 384 return false; |
| 385 } | 385 } |
| 386 | 386 |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 488 if ((pc >= start_pc) && (pc < end_pc)) { | 488 if ((pc >= start_pc) && (pc < end_pc)) { |
| 489 return true; | 489 return true; |
| 490 } | 490 } |
| 491 } | 491 } |
| 492 return false; | 492 return false; |
| 493 } | 493 } |
| 494 | 494 |
| 495 | 495 |
| 496 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( | 496 intptr_t RawPcDescriptors::VisitPcDescriptorsPointers( |
| 497 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 497 RawPcDescriptors* raw_obj, ObjectPointerVisitor* visitor) { |
| 498 RawPcDescriptors* obj = raw_obj->ptr(); | 498 return PcDescriptors::InstanceSize(raw_obj->ptr()->length_); |
| 499 intptr_t length = Smi::Value(obj->length_); | |
| 500 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->length_)); | |
| 501 return PcDescriptors::InstanceSize(length); | |
| 502 } | 499 } |
| 503 | 500 |
| 504 | 501 |
| 505 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, | 502 intptr_t RawStackmap::VisitStackmapPointers(RawStackmap* raw_obj, |
| 506 ObjectPointerVisitor* visitor) { | 503 ObjectPointerVisitor* visitor) { |
| 507 RawStackmap* obj = raw_obj->ptr(); | 504 return Stackmap::InstanceSize(raw_obj->ptr()->length_); |
| 508 intptr_t length = obj->length_; | |
| 509 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->code_)); | |
| 510 return Stackmap::InstanceSize(length); | |
| 511 } | 505 } |
| 512 | 506 |
| 513 | 507 |
| 514 intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( | 508 intptr_t RawLocalVarDescriptors::VisitLocalVarDescriptorsPointers( |
| 515 RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) { | 509 RawLocalVarDescriptors* raw_obj, ObjectPointerVisitor* visitor) { |
| 516 RawLocalVarDescriptors* obj = raw_obj->ptr(); | 510 RawLocalVarDescriptors* obj = raw_obj->ptr(); |
| 517 intptr_t len = obj->length_; | 511 intptr_t len = obj->length_; |
| 518 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->names_)); | 512 visitor->VisitPointer(reinterpret_cast<RawObject**>(&obj->names_)); |
| 519 return LocalVarDescriptors::InstanceSize(len); | 513 return LocalVarDescriptors::InstanceSize(len); |
| 520 } | 514 } |
| (...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 835 | 829 |
| 836 intptr_t RawMirrorReference::VisitMirrorReferencePointers( | 830 intptr_t RawMirrorReference::VisitMirrorReferencePointers( |
| 837 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { | 831 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { |
| 838 // Make sure that we got here with the tagged pointer as this. | 832 // Make sure that we got here with the tagged pointer as this. |
| 839 ASSERT(raw_obj->IsHeapObject()); | 833 ASSERT(raw_obj->IsHeapObject()); |
| 840 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 834 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 841 return MirrorReference::InstanceSize(); | 835 return MirrorReference::InstanceSize(); |
| 842 } | 836 } |
| 843 | 837 |
| 844 } // namespace dart | 838 } // namespace dart |
| OLD | NEW |