| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/frames.h" | 5 #include "src/frames.h" |
| 6 | 6 |
| 7 #include <sstream> | 7 #include <sstream> |
| 8 | 8 |
| 9 #include "src/ast.h" | 9 #include "src/ast.h" |
| 10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
| (...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 } | 749 } |
| 750 | 750 |
| 751 | 751 |
| 752 bool JavaScriptFrame::HasInlinedFrames() const { | 752 bool JavaScriptFrame::HasInlinedFrames() const { |
| 753 List<JSFunction*> functions(1); | 753 List<JSFunction*> functions(1); |
| 754 GetFunctions(&functions); | 754 GetFunctions(&functions); |
| 755 return functions.length() > 1; | 755 return functions.length() > 1; |
| 756 } | 756 } |
| 757 | 757 |
| 758 | 758 |
| 759 Object* JavaScriptFrame::GetNewTarget() const { | |
| 760 DCHECK(!HasInlinedFrames()); | |
| 761 Address fp = caller_fp(); | |
| 762 if (has_adapted_arguments()) { | |
| 763 // Skip the arguments adaptor frame and look at the real caller. | |
| 764 fp = Memory::Address_at(fp + StandardFrameConstants::kCallerFPOffset); | |
| 765 } | |
| 766 DCHECK(IsConstructFrame(fp)); | |
| 767 STATIC_ASSERT(ConstructFrameConstants::kNewTargetOffset == | |
| 768 StandardFrameConstants::kExpressionsOffset - 3 * kPointerSize); | |
| 769 return GetExpression(fp, 3); | |
| 770 } | |
| 771 | |
| 772 | |
| 773 int JavaScriptFrame::GetArgumentsLength() const { | 759 int JavaScriptFrame::GetArgumentsLength() const { |
| 774 // If there is an arguments adaptor frame get the arguments length from it. | 760 // If there is an arguments adaptor frame get the arguments length from it. |
| 775 if (has_adapted_arguments()) { | 761 if (has_adapted_arguments()) { |
| 776 STATIC_ASSERT(ArgumentsAdaptorFrameConstants::kLengthOffset == | 762 STATIC_ASSERT(ArgumentsAdaptorFrameConstants::kLengthOffset == |
| 777 StandardFrameConstants::kExpressionsOffset); | 763 StandardFrameConstants::kExpressionsOffset); |
| 778 return Smi::cast(GetExpression(caller_fp(), 0))->value(); | 764 return Smi::cast(GetExpression(caller_fp(), 0))->value(); |
| 779 } else { | 765 } else { |
| 780 return GetNumberOfIncomingArguments(); | 766 return GetNumberOfIncomingArguments(); |
| 781 } | 767 } |
| 782 } | 768 } |
| (...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { | 1577 for (StackFrameIterator it(isolate); !it.done(); it.Advance()) { |
| 1592 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); | 1578 StackFrame* frame = AllocateFrameCopy(it.frame(), zone); |
| 1593 list.Add(frame, zone); | 1579 list.Add(frame, zone); |
| 1594 } | 1580 } |
| 1595 return list.ToVector(); | 1581 return list.ToVector(); |
| 1596 } | 1582 } |
| 1597 | 1583 |
| 1598 | 1584 |
| 1599 } // namespace internal | 1585 } // namespace internal |
| 1600 } // namespace v8 | 1586 } // namespace v8 |
| OLD | NEW |