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 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
437 | 437 |
438 | 438 |
439 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, | 439 intptr_t RawFunction::VisitFunctionPointers(RawFunction* raw_obj, |
440 ObjectPointerVisitor* visitor) { | 440 ObjectPointerVisitor* visitor) { |
441 if (visitor->visit_function_code() || !CheckUsageCounter(raw_obj)) { | 441 if (visitor->visit_function_code() || !CheckUsageCounter(raw_obj)) { |
442 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 442 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
443 return Function::InstanceSize(); | 443 return Function::InstanceSize(); |
444 } | 444 } |
445 visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code()); | 445 visitor->VisitPointers(raw_obj->from(), raw_obj->to_no_code()); |
446 | 446 |
447 if (ShouldVisitCode(raw_obj->ptr()->instructions_->ptr()->code_)) { | 447 if (ShouldVisitCode(raw_obj->ptr()->code_)) { |
448 visitor->VisitPointer( | 448 visitor->VisitPointer( |
449 reinterpret_cast<RawObject**>(&raw_obj->ptr()->instructions_)); | 449 reinterpret_cast<RawObject**>(&raw_obj->ptr()->code_)); |
450 } else { | 450 } else { |
451 visitor->skipped_code_functions()->Add(raw_obj); | 451 visitor->skipped_code_functions()->Add(raw_obj); |
452 } | 452 } |
453 | 453 |
454 if (ShouldVisitCode(raw_obj->ptr()->unoptimized_code_)) { | 454 if (ShouldVisitCode(raw_obj->ptr()->unoptimized_code_)) { |
455 visitor->VisitPointer( | 455 visitor->VisitPointer( |
456 reinterpret_cast<RawObject**>(&raw_obj->ptr()->unoptimized_code_)); | 456 reinterpret_cast<RawObject**>(&raw_obj->ptr()->unoptimized_code_)); |
457 } else { | 457 } else { |
458 visitor->skipped_code_functions()->Add(raw_obj); | 458 visitor->skipped_code_functions()->Add(raw_obj); |
459 } | 459 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
503 } | 503 } |
504 | 504 |
505 | 505 |
506 intptr_t RawNamespace::VisitNamespacePointers( | 506 intptr_t RawNamespace::VisitNamespacePointers( |
507 RawNamespace* raw_obj, ObjectPointerVisitor* visitor) { | 507 RawNamespace* raw_obj, ObjectPointerVisitor* visitor) { |
508 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 508 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
509 return Namespace::InstanceSize(); | 509 return Namespace::InstanceSize(); |
510 } | 510 } |
511 | 511 |
512 | 512 |
| 513 bool RawCode::ContainsPC(RawObject* raw_obj, uword pc) { |
| 514 uword tags = raw_obj->ptr()->tags_; |
| 515 if (RawObject::ClassIdTag::decode(tags) == kCodeCid) { |
| 516 RawCode* raw_code = reinterpret_cast<RawCode*>(raw_obj); |
| 517 return RawInstructions::ContainsPC(raw_code->ptr()->instructions_, pc); |
| 518 } |
| 519 return false; |
| 520 } |
| 521 |
| 522 |
513 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, | 523 intptr_t RawCode::VisitCodePointers(RawCode* raw_obj, |
514 ObjectPointerVisitor* visitor) { | 524 ObjectPointerVisitor* visitor) { |
515 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 525 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
516 | 526 |
517 RawCode* obj = raw_obj->ptr(); | 527 RawCode* obj = raw_obj->ptr(); |
518 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); | 528 intptr_t length = Code::PtrOffBits::decode(obj->state_bits_); |
519 if (Code::AliveBit::decode(obj->state_bits_)) { | 529 if (Code::AliveBit::decode(obj->state_bits_)) { |
520 // Also visit all the embedded pointers in the corresponding instructions. | 530 // Also visit all the embedded pointers in the corresponding instructions. |
521 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + | 531 uword entry_point = reinterpret_cast<uword>(obj->instructions_->ptr()) + |
522 Instructions::HeaderSize(); | 532 Instructions::HeaderSize(); |
(...skipping 21 matching lines...) Expand all Loading... |
544 visitor->VisitPointer(&(first + i)->raw_obj_); | 554 visitor->VisitPointer(&(first + i)->raw_obj_); |
545 } | 555 } |
546 } | 556 } |
547 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); | 557 return ObjectPool::InstanceSize(raw_obj->ptr()->length_); |
548 } | 558 } |
549 | 559 |
550 | 560 |
551 intptr_t RawInstructions::VisitInstructionsPointers( | 561 intptr_t RawInstructions::VisitInstructionsPointers( |
552 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { | 562 RawInstructions* raw_obj, ObjectPointerVisitor* visitor) { |
553 RawInstructions* obj = raw_obj->ptr(); | 563 RawInstructions* obj = raw_obj->ptr(); |
554 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | |
555 return Instructions::InstanceSize(obj->size_); | 564 return Instructions::InstanceSize(obj->size_); |
556 } | 565 } |
557 | 566 |
558 | 567 |
559 bool RawInstructions::ContainsPC(RawObject* raw_obj, uword pc) { | 568 bool RawInstructions::ContainsPC(RawObject* raw_obj, uword pc) { |
560 uword tags = raw_obj->ptr()->tags_; | 569 uword tags = raw_obj->ptr()->tags_; |
561 if (RawObject::ClassIdTag::decode(tags) == kInstructionsCid) { | 570 if (RawObject::ClassIdTag::decode(tags) == kInstructionsCid) { |
562 RawInstructions* raw_instr = reinterpret_cast<RawInstructions*>(raw_obj); | 571 RawInstructions* raw_instr = reinterpret_cast<RawInstructions*>(raw_obj); |
563 uword start_pc = | 572 uword start_pc = |
564 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); | 573 reinterpret_cast<uword>(raw_instr->ptr()) + Instructions::HeaderSize(); |
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 intptr_t RawUserTag::VisitUserTagPointers( | 946 intptr_t RawUserTag::VisitUserTagPointers( |
938 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 947 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
939 // Make sure that we got here with the tagged pointer as this. | 948 // Make sure that we got here with the tagged pointer as this. |
940 ASSERT(raw_obj->IsHeapObject()); | 949 ASSERT(raw_obj->IsHeapObject()); |
941 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 950 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
942 return UserTag::InstanceSize(); | 951 return UserTag::InstanceSize(); |
943 } | 952 } |
944 | 953 |
945 | 954 |
946 } // namespace dart | 955 } // namespace dart |
OLD | NEW |