OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 |
11 // with the distribution. | 11 // with the distribution. |
(...skipping 723 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 int ast_id = it.Next(); | 735 int ast_id = it.Next(); |
736 int function_id = it.Next(); | 736 int function_id = it.Next(); |
737 it.Next(); // Skip height. | 737 it.Next(); // Skip height. |
738 JSFunction* function = | 738 JSFunction* function = |
739 JSFunction::cast(data->LiteralArray()->get(function_id)); | 739 JSFunction::cast(data->LiteralArray()->get(function_id)); |
740 | 740 |
741 // The translation commands are ordered and the receiver is always | 741 // The translation commands are ordered and the receiver is always |
742 // at the first position. Since we are always at a call when we need | 742 // at the first position. Since we are always at a call when we need |
743 // to construct a stack trace, the receiver is always in a stack slot. | 743 // to construct a stack trace, the receiver is always in a stack slot. |
744 opcode = static_cast<Translation::Opcode>(it.Next()); | 744 opcode = static_cast<Translation::Opcode>(it.Next()); |
745 ASSERT(opcode == Translation::STACK_SLOT); | 745 ASSERT(opcode == Translation::STACK_SLOT || |
746 int input_slot_index = it.Next(); | 746 opcode == Translation::LITERAL); |
| 747 int index = it.Next(); |
747 | 748 |
748 // Get the correct receiver in the optimized frame. | 749 // Get the correct receiver in the optimized frame. |
749 Object* receiver = NULL; | 750 Object* receiver = NULL; |
750 // Positive index means the value is spilled to the locals area. Negative | 751 if (opcode == Translation::LITERAL) { |
751 // means it is stored in the incoming parameter area. | 752 receiver = data->LiteralArray()->get(index); |
752 if (input_slot_index >= 0) { | |
753 receiver = GetExpression(input_slot_index); | |
754 } else { | 753 } else { |
755 // Index -1 overlaps with last parameter, -n with the first parameter, | 754 // Positive index means the value is spilled to the locals |
756 // (-n - 1) with the receiver with n being the number of parameters | 755 // area. Negative means it is stored in the incoming parameter |
757 // of the outermost, optimized frame. | 756 // area. |
758 int parameter_count = ComputeParametersCount(); | 757 if (index >= 0) { |
759 int parameter_index = input_slot_index + parameter_count; | 758 receiver = GetExpression(index); |
760 receiver = (parameter_index == -1) | 759 } else { |
761 ? this->receiver() | 760 // Index -1 overlaps with last parameter, -n with the first parameter, |
762 : this->GetParameter(parameter_index); | 761 // (-n - 1) with the receiver with n being the number of parameters |
| 762 // of the outermost, optimized frame. |
| 763 int parameter_count = ComputeParametersCount(); |
| 764 int parameter_index = index + parameter_count; |
| 765 receiver = (parameter_index == -1) |
| 766 ? this->receiver() |
| 767 : this->GetParameter(parameter_index); |
| 768 } |
763 } | 769 } |
764 | 770 |
765 Code* code = function->shared()->code(); | 771 Code* code = function->shared()->code(); |
766 DeoptimizationOutputData* output_data = | 772 DeoptimizationOutputData* output_data = |
767 DeoptimizationOutputData::cast(code->deoptimization_data()); | 773 DeoptimizationOutputData::cast(code->deoptimization_data()); |
768 unsigned entry = Deoptimizer::GetOutputInfo(output_data, | 774 unsigned entry = Deoptimizer::GetOutputInfo(output_data, |
769 ast_id, | 775 ast_id, |
770 function->shared()); | 776 function->shared()); |
771 unsigned pc_offset = | 777 unsigned pc_offset = |
772 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize; | 778 FullCodeGenerator::PcField::decode(entry) + Code::kHeaderSize; |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1228 ZoneList<StackFrame*> list(10); | 1234 ZoneList<StackFrame*> list(10); |
1229 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1235 for (StackFrameIterator it; !it.done(); it.Advance()) { |
1230 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1236 StackFrame* frame = AllocateFrameCopy(it.frame()); |
1231 list.Add(frame); | 1237 list.Add(frame); |
1232 } | 1238 } |
1233 return list.ToVector(); | 1239 return list.ToVector(); |
1234 } | 1240 } |
1235 | 1241 |
1236 | 1242 |
1237 } } // namespace v8::internal | 1243 } } // namespace v8::internal |
OLD | NEW |