OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
610 | 610 |
611 bool StandardFrame::IsExpressionInsideHandler(int n) const { | 611 bool StandardFrame::IsExpressionInsideHandler(int n) const { |
612 Address address = GetExpressionAddress(n); | 612 Address address = GetExpressionAddress(n); |
613 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { | 613 for (StackHandlerIterator it(this, top_handler()); !it.done(); it.Advance()) { |
614 if (it.handler()->includes(address)) return true; | 614 if (it.handler()->includes(address)) return true; |
615 } | 615 } |
616 return false; | 616 return false; |
617 } | 617 } |
618 | 618 |
619 | 619 |
620 void CompiledFrame::Iterate(ObjectVisitor* v) const { | 620 void IterateCompiledFrame(const StandardFrame* frame, ObjectVisitor* v) { |
621 #ifdef DEBUG | |
622 // Make sure that optimized frames do not contain any stack handlers. | |
623 StackHandlerIterator it(this, top_handler()); | |
624 ASSERT(it.done()); | |
625 #endif | |
626 | |
627 // Make sure that we're not doing "safe" stack frame iteration. We cannot | 621 // Make sure that we're not doing "safe" stack frame iteration. We cannot |
628 // possibly find pointers in optimized frames in that state. | 622 // possibly find pointers in optimized frames in that state. |
629 ASSERT(!SafeStackFrameIterator::is_active(isolate())); | 623 ASSERT(!SafeStackFrameIterator::is_active(frame->isolate())); |
630 | 624 |
631 // Compute the safepoint information. | 625 // Compute the safepoint information. |
632 unsigned stack_slots = 0; | 626 unsigned stack_slots = 0; |
633 SafepointEntry safepoint_entry; | 627 SafepointEntry safepoint_entry; |
634 Code* code = StackFrame::GetSafepointData( | 628 Code* code = StackFrame::GetSafepointData( |
635 isolate(), pc(), &safepoint_entry, &stack_slots); | 629 frame->isolate(), frame->pc(), &safepoint_entry, &stack_slots); |
636 unsigned slot_space = stack_slots * kPointerSize; | 630 unsigned slot_space = stack_slots * kPointerSize; |
637 | 631 |
638 // Visit the outgoing parameters. | 632 // Visit the outgoing parameters. |
639 Object** parameters_base = &Memory::Object_at(sp()); | 633 Object** parameters_base = &Memory::Object_at(frame->sp()); |
640 Object** parameters_limit = &Memory::Object_at( | 634 Object** parameters_limit = &Memory::Object_at( |
641 fp() + JavaScriptFrameConstants::kFunctionOffset - slot_space); | 635 frame->fp() + JavaScriptFrameConstants::kFunctionOffset - slot_space); |
642 | 636 |
643 // Visit the parameters that may be on top of the saved registers. | 637 // Visit the parameters that may be on top of the saved registers. |
644 if (safepoint_entry.argument_count() > 0) { | 638 if (safepoint_entry.argument_count() > 0) { |
645 v->VisitPointers(parameters_base, | 639 v->VisitPointers(parameters_base, |
646 parameters_base + safepoint_entry.argument_count()); | 640 parameters_base + safepoint_entry.argument_count()); |
647 parameters_base += safepoint_entry.argument_count(); | 641 parameters_base += safepoint_entry.argument_count(); |
648 } | 642 } |
649 | 643 |
650 // Skip saved double registers. | 644 // Skip saved double registers. |
651 if (safepoint_entry.has_doubles()) { | 645 if (safepoint_entry.has_doubles()) { |
(...skipping 23 matching lines...) Expand all Loading... |
675 // Visit pointer spill slots and locals. | 669 // Visit pointer spill slots and locals. |
676 for (unsigned index = 0; index < stack_slots; index++) { | 670 for (unsigned index = 0; index < stack_slots; index++) { |
677 int byte_index = index >> kBitsPerByteLog2; | 671 int byte_index = index >> kBitsPerByteLog2; |
678 int bit_index = index & (kBitsPerByte - 1); | 672 int bit_index = index & (kBitsPerByte - 1); |
679 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) { | 673 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) { |
680 v->VisitPointer(parameters_limit + index); | 674 v->VisitPointer(parameters_limit + index); |
681 } | 675 } |
682 } | 676 } |
683 | 677 |
684 // Visit the return address in the callee and incoming arguments. | 678 // Visit the return address in the callee and incoming arguments. |
685 IteratePc(v, pc_address(), code); | 679 frame->IteratePc(v, frame->pc_address(), code); |
686 } | 680 } |
687 | 681 |
688 | 682 |
689 void StubFrame::Iterate(ObjectVisitor* v) const { | 683 void StubFrame::Iterate(ObjectVisitor* v) const { |
690 CompiledFrame::Iterate(v); | 684 IterateCompiledFrame(this, v); |
| 685 } |
| 686 |
| 687 |
| 688 Code* StubFrame::unchecked_code() const { |
| 689 return static_cast<Code*>(isolate()->heap()->FindCodeObject(pc())); |
| 690 } |
| 691 |
| 692 |
| 693 Address StubFrame::GetCallerStackPointer() const { |
| 694 return fp() + ExitFrameConstants::kCallerSPDisplacement; |
| 695 } |
| 696 |
| 697 |
| 698 int StubFrame::GetNumberOfIncomingArguments() const { |
| 699 return 0; |
691 } | 700 } |
692 | 701 |
693 | 702 |
694 void OptimizedFrame::Iterate(ObjectVisitor* v) const { | 703 void OptimizedFrame::Iterate(ObjectVisitor* v) const { |
695 CompiledFrame::Iterate(v); | 704 #ifdef DEBUG |
| 705 // Make sure that optimized frames do not contain any stack handlers. |
| 706 StackHandlerIterator it(this, top_handler()); |
| 707 ASSERT(it.done()); |
| 708 #endif |
| 709 |
| 710 IterateCompiledFrame(this, v); |
696 | 711 |
697 // Visit the context and the function. | 712 // Visit the context and the function. |
698 Object** fixed_base = &Memory::Object_at( | 713 Object** fixed_base = &Memory::Object_at( |
699 fp() + JavaScriptFrameConstants::kFunctionOffset); | 714 fp() + JavaScriptFrameConstants::kFunctionOffset); |
700 Object** fixed_limit = &Memory::Object_at(fp()); | 715 Object** fixed_limit = &Memory::Object_at(fp()); |
701 v->VisitPointers(fixed_base, fixed_limit); | 716 v->VisitPointers(fixed_base, fixed_limit); |
702 } | 717 } |
703 | 718 |
704 | 719 |
705 bool JavaScriptFrame::IsConstructor() const { | 720 bool JavaScriptFrame::IsConstructor() const { |
(...skipping 740 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1446 ZoneList<StackFrame*> list(10, zone); | 1461 ZoneList<StackFrame*> list(10, zone); |
1447 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1462 for (StackFrameIterator it; !it.done(); it.Advance()) { |
1448 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1463 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
1449 list.Add(frame, zone); | 1464 list.Add(frame, zone); |
1450 } | 1465 } |
1451 return list.ToVector(); | 1466 return list.ToVector(); |
1452 } | 1467 } |
1453 | 1468 |
1454 | 1469 |
1455 } } // namespace v8::internal | 1470 } } // namespace v8::internal |
OLD | NEW |