| 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 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 // Skip the words containing the register values. | 669 // Skip the words containing the register values. |
| 670 parameters_base += kNumSafepointRegisters; | 670 parameters_base += kNumSafepointRegisters; |
| 671 } | 671 } |
| 672 | 672 |
| 673 // We're done dealing with the register bits. | 673 // We're done dealing with the register bits. |
| 674 uint8_t* safepoint_bits = safepoint_entry.bits(); | 674 uint8_t* safepoint_bits = safepoint_entry.bits(); |
| 675 safepoint_bits += kNumSafepointRegisters >> kBitsPerByteLog2; | 675 safepoint_bits += kNumSafepointRegisters >> kBitsPerByteLog2; |
| 676 | 676 |
| 677 // Visit the rest of the parameters. | 677 // Visit the rest of the parameters and the exception handlers. |
| 678 v->VisitPointers(parameters_base, parameters_limit); | 678 StackHandlerIterator handler_iterator(this, top_handler()); |
| 679 Object** next_parameter = parameters_base; |
| 680 while (!handler_iterator.done()) { |
| 681 // For each handler, visit the parameters down to the top of the handler |
| 682 // and the handler itself. |
| 683 StackHandler* handler = handler_iterator.handler(); |
| 684 Address handler_top = handler->address(); |
| 685 v->VisitPointers(next_parameter, reinterpret_cast<Object**>(handler_top)); |
| 686 handler->Iterate(v, code); |
| 687 next_parameter = |
| 688 reinterpret_cast<Object**>(handler_top + StackHandlerConstants::kSize); |
| 689 handler_iterator.Advance(); |
| 690 } |
| 691 // And visit all remaining parameters. |
| 692 v->VisitPointers(next_parameter, parameters_limit); |
| 679 | 693 |
| 680 // Visit pointer spill slots and locals. | 694 // Visit pointer spill slots and locals. |
| 681 for (unsigned index = 0; index < stack_slots; index++) { | 695 for (unsigned index = 0; index < stack_slots; index++) { |
| 682 int byte_index = index >> kBitsPerByteLog2; | 696 int byte_index = index >> kBitsPerByteLog2; |
| 683 int bit_index = index & (kBitsPerByte - 1); | 697 int bit_index = index & (kBitsPerByte - 1); |
| 684 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) { | 698 if ((safepoint_bits[byte_index] & (1U << bit_index)) != 0) { |
| 685 v->VisitPointer(parameters_limit + index); | 699 v->VisitPointer(parameters_limit + index); |
| 686 } | 700 } |
| 687 } | 701 } |
| 688 | 702 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 712 return fp() + ExitFrameConstants::kCallerSPDisplacement; | 726 return fp() + ExitFrameConstants::kCallerSPDisplacement; |
| 713 } | 727 } |
| 714 | 728 |
| 715 | 729 |
| 716 int StubFrame::GetNumberOfIncomingArguments() const { | 730 int StubFrame::GetNumberOfIncomingArguments() const { |
| 717 return 0; | 731 return 0; |
| 718 } | 732 } |
| 719 | 733 |
| 720 | 734 |
| 721 void OptimizedFrame::Iterate(ObjectVisitor* v) const { | 735 void OptimizedFrame::Iterate(ObjectVisitor* v) const { |
| 722 #ifdef DEBUG | |
| 723 // Make sure that optimized frames do not contain any stack handlers. | |
| 724 StackHandlerIterator it(this, top_handler()); | |
| 725 ASSERT(it.done()); | |
| 726 #endif | |
| 727 | |
| 728 IterateCompiledFrame(v); | 736 IterateCompiledFrame(v); |
| 729 } | 737 } |
| 730 | 738 |
| 731 | 739 |
| 732 void JavaScriptFrame::SetParameterValue(int index, Object* value) const { | 740 void JavaScriptFrame::SetParameterValue(int index, Object* value) const { |
| 733 Memory::Object_at(GetParameterSlot(index)) = value; | 741 Memory::Object_at(GetParameterSlot(index)) = value; |
| 734 } | 742 } |
| 735 | 743 |
| 736 | 744 |
| 737 bool JavaScriptFrame::IsConstructor() const { | 745 bool JavaScriptFrame::IsConstructor() const { |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 980 // in the deoptimization translation are ordered bottom-to-top. | 988 // in the deoptimization translation are ordered bottom-to-top. |
| 981 bool is_constructor = IsConstructor(); | 989 bool is_constructor = IsConstructor(); |
| 982 int i = jsframe_count; | 990 int i = jsframe_count; |
| 983 while (i > 0) { | 991 while (i > 0) { |
| 984 opcode = static_cast<Translation::Opcode>(it.Next()); | 992 opcode = static_cast<Translation::Opcode>(it.Next()); |
| 985 if (opcode == Translation::JS_FRAME) { | 993 if (opcode == Translation::JS_FRAME) { |
| 986 i--; | 994 i--; |
| 987 BailoutId ast_id = BailoutId(it.Next()); | 995 BailoutId ast_id = BailoutId(it.Next()); |
| 988 JSFunction* function = LiteralAt(literal_array, it.Next()); | 996 JSFunction* function = LiteralAt(literal_array, it.Next()); |
| 989 it.Next(); // Skip height. | 997 it.Next(); // Skip height. |
| 998 it.Next(); // Skip handler count. |
| 990 | 999 |
| 991 // The translation commands are ordered and the receiver is always | 1000 // The translation commands are ordered and the receiver is always |
| 992 // at the first position. Since we are always at a call when we need | 1001 // at the first position. Since we are always at a call when we need |
| 993 // to construct a stack trace, the receiver is always in a stack slot. | 1002 // to construct a stack trace, the receiver is always in a stack slot. |
| 994 opcode = static_cast<Translation::Opcode>(it.Next()); | 1003 opcode = static_cast<Translation::Opcode>(it.Next()); |
| 995 ASSERT(opcode == Translation::STACK_SLOT || | 1004 ASSERT(opcode == Translation::STACK_SLOT || |
| 996 opcode == Translation::LITERAL); | 1005 opcode == Translation::LITERAL); |
| 997 int index = it.Next(); | 1006 int index = it.Next(); |
| 998 | 1007 |
| 999 // Get the correct receiver in the optimized frame. | 1008 // Get the correct receiver in the optimized frame. |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 | 1113 |
| 1105 // We insert the frames in reverse order because the frames | 1114 // We insert the frames in reverse order because the frames |
| 1106 // in the deoptimization translation are ordered bottom-to-top. | 1115 // in the deoptimization translation are ordered bottom-to-top. |
| 1107 while (jsframe_count > 0) { | 1116 while (jsframe_count > 0) { |
| 1108 opcode = static_cast<Translation::Opcode>(it.Next()); | 1117 opcode = static_cast<Translation::Opcode>(it.Next()); |
| 1109 if (opcode == Translation::JS_FRAME) { | 1118 if (opcode == Translation::JS_FRAME) { |
| 1110 jsframe_count--; | 1119 jsframe_count--; |
| 1111 it.Next(); // Skip ast id. | 1120 it.Next(); // Skip ast id. |
| 1112 JSFunction* function = LiteralAt(literal_array, it.Next()); | 1121 JSFunction* function = LiteralAt(literal_array, it.Next()); |
| 1113 it.Next(); // Skip height. | 1122 it.Next(); // Skip height. |
| 1123 it.Next(); // Skip handler count; |
| 1114 functions->Add(function); | 1124 functions->Add(function); |
| 1115 } else { | 1125 } else { |
| 1116 // Skip over operands to advance to the next opcode. | 1126 // Skip over operands to advance to the next opcode. |
| 1117 it.Skip(Translation::NumberOfOperandsFor(opcode)); | 1127 it.Skip(Translation::NumberOfOperandsFor(opcode)); |
| 1118 } | 1128 } |
| 1119 } | 1129 } |
| 1120 } | 1130 } |
| 1121 | 1131 |
| 1122 | 1132 |
| 1123 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { | 1133 int ArgumentsAdaptorFrame::GetNumberOfIncomingArguments() const { |
| (...skipping 512 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1636 ZoneList<StackFrame*> list(10, zone); | 1646 ZoneList<StackFrame*> list(10, zone); |
| 1637 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1647 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1638 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1648 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1639 list.Add(frame, zone); | 1649 list.Add(frame, zone); |
| 1640 } | 1650 } |
| 1641 return list.ToVector(); | 1651 return list.ToVector(); |
| 1642 } | 1652 } |
| 1643 | 1653 |
| 1644 | 1654 |
| 1645 } } // namespace v8::internal | 1655 } } // namespace v8::internal |
| OLD | NEW |