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 1585 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1596 } | 1596 } |
1597 | 1597 |
1598 #ifdef ENABLE_DEBUGGER_SUPPORT | 1598 #ifdef ENABLE_DEBUGGER_SUPPORT |
1599 | 1599 |
1600 DeoptimizedFrameInfo::DeoptimizedFrameInfo( | 1600 DeoptimizedFrameInfo::DeoptimizedFrameInfo( |
1601 Deoptimizer* deoptimizer, int frame_index, bool has_arguments_adaptor) { | 1601 Deoptimizer* deoptimizer, int frame_index, bool has_arguments_adaptor) { |
1602 FrameDescription* output_frame = deoptimizer->output_[frame_index]; | 1602 FrameDescription* output_frame = deoptimizer->output_[frame_index]; |
1603 SetFunction(output_frame->GetFunction()); | 1603 SetFunction(output_frame->GetFunction()); |
1604 expression_count_ = output_frame->GetExpressionCount(); | 1604 expression_count_ = output_frame->GetExpressionCount(); |
1605 expression_stack_ = new Object*[expression_count_]; | 1605 expression_stack_ = new Object*[expression_count_]; |
1606 pc_ = output_frame->GetPc(); | 1606 // Get the source position using the unoptimized code. |
| 1607 Address pc = reinterpret_cast<Address>(output_frame->GetPc()); |
| 1608 Code* code = Code::cast(Isolate::Current()->heap()->FindCodeObject(pc)); |
| 1609 source_position_ = code->SourcePosition(pc); |
| 1610 |
1607 for (int i = 0; i < expression_count_; i++) { | 1611 for (int i = 0; i < expression_count_; i++) { |
1608 SetExpression(i, output_frame->GetExpression(i)); | 1612 SetExpression(i, output_frame->GetExpression(i)); |
1609 } | 1613 } |
1610 | 1614 |
1611 if (has_arguments_adaptor) { | 1615 if (has_arguments_adaptor) { |
1612 output_frame = deoptimizer->output_[frame_index - 1]; | 1616 output_frame = deoptimizer->output_[frame_index - 1]; |
1613 ASSERT(output_frame->GetFrameType() == StackFrame::ARGUMENTS_ADAPTOR); | 1617 ASSERT(output_frame->GetFrameType() == StackFrame::ARGUMENTS_ADAPTOR); |
1614 } | 1618 } |
1615 | 1619 |
1616 parameters_count_ = output_frame->ComputeParametersCount(); | 1620 parameters_count_ = output_frame->ComputeParametersCount(); |
1617 parameters_ = new Object*[parameters_count_]; | 1621 parameters_ = new Object*[parameters_count_]; |
1618 for (int i = 0; i < parameters_count_; i++) { | 1622 for (int i = 0; i < parameters_count_; i++) { |
1619 SetParameter(i, output_frame->GetParameter(i)); | 1623 SetParameter(i, output_frame->GetParameter(i)); |
1620 } | 1624 } |
1621 } | 1625 } |
1622 | 1626 |
1623 | 1627 |
1624 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() { | 1628 DeoptimizedFrameInfo::~DeoptimizedFrameInfo() { |
1625 delete[] expression_stack_; | 1629 delete[] expression_stack_; |
1626 delete[] parameters_; | 1630 delete[] parameters_; |
1627 } | 1631 } |
1628 | 1632 |
| 1633 |
1629 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { | 1634 void DeoptimizedFrameInfo::Iterate(ObjectVisitor* v) { |
1630 v->VisitPointer(BitCast<Object**>(&function_)); | 1635 v->VisitPointer(BitCast<Object**>(&function_)); |
1631 v->VisitPointers(parameters_, parameters_ + parameters_count_); | 1636 v->VisitPointers(parameters_, parameters_ + parameters_count_); |
1632 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); | 1637 v->VisitPointers(expression_stack_, expression_stack_ + expression_count_); |
1633 } | 1638 } |
1634 | 1639 |
1635 #endif // ENABLE_DEBUGGER_SUPPORT | 1640 #endif // ENABLE_DEBUGGER_SUPPORT |
1636 | 1641 |
1637 } } // namespace v8::internal | 1642 } } // namespace v8::internal |
OLD | NEW |