Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1071)

Side by Side Diff: src/frames.cc

Issue 2943002: Reimplement stack manipulations for LiveEdit (Closed)
Patch Set: follow codereview Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/frames.h ('k') | src/heap.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 14 matching lines...) Expand all
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "frames-inl.h" 30 #include "frames-inl.h"
31 #include "mark-compact.h" 31 #include "mark-compact.h"
32 #include "scopeinfo.h" 32 #include "scopeinfo.h"
33 #include "string-stream.h" 33 #include "string-stream.h"
34 #include "top.h" 34 #include "top.h"
35 #include "liveedit.h"
35 36
36 namespace v8 { 37 namespace v8 {
37 namespace internal { 38 namespace internal {
38 39
39 // Iterator that supports traversing the stack handlers of a 40 // Iterator that supports traversing the stack handlers of a
40 // particular frame. Needs to know the top of the handler chain. 41 // particular frame. Needs to know the top of the handler chain.
41 class StackHandlerIterator BASE_EMBEDDED { 42 class StackHandlerIterator BASE_EMBEDDED {
42 public: 43 public:
43 StackHandlerIterator(const StackFrame* frame, StackHandler* handler) 44 StackHandlerIterator(const StackFrame* frame, StackHandler* handler)
44 : limit_(frame->fp()), handler_(handler) { 45 : limit_(frame->fp()), handler_(handler) {
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 int line = GetScriptLineNumberSafe(script, function_start_pos) + 1; 552 int line = GetScriptLineNumberSafe(script, function_start_pos) + 1;
552 accumulator->Add(":~%d", line); 553 accumulator->Add(":~%d", line);
553 } 554 }
554 555
555 accumulator->Add("] "); 556 accumulator->Add("] ");
556 } 557 }
557 } 558 }
558 559
559 accumulator->Add("(this=%o", receiver); 560 accumulator->Add("(this=%o", receiver);
560 561
562 FunctionScopeState scope_state;
563 if (LiveEdit::IsAtFrameResetPatch(this)) {
564 scope_state = FUNCTION_SCOPE_NOT_ENTERED;
565 accumulator->Add(",<no locals -- function is at restarter patch>");
566 } else {
567 scope_state = FUNCTION_SCOPE_NORMAL;
568 }
569
561 // Get scope information for nicer output, if possible. If code is 570 // Get scope information for nicer output, if possible. If code is
562 // NULL, or doesn't contain scope info, info will return 0 for the 571 // NULL, or doesn't contain scope info, info will return 0 for the
563 // number of parameters, stack slots, or context slots. 572 // number of parameters, stack slots, or context slots.
564 ScopeInfo<PreallocatedStorage> info(code); 573 ScopeInfo<PreallocatedStorage> info(code, scope_state);
565 574
566 // Print the parameters. 575 // Print the parameters.
567 int parameters_count = ComputeParametersCount(); 576 int parameters_count = ComputeParametersCount();
568 for (int i = 0; i < parameters_count; i++) { 577 for (int i = 0; i < parameters_count; i++) {
569 accumulator->Add(","); 578 accumulator->Add(",");
570 // If we have a name for the parameter we print it. Nameless 579 // If we have a name for the parameter we print it. Nameless
571 // parameters are either because we have more actual parameters 580 // parameters are either because we have more actual parameters
572 // than formal parameters or because we have no scope information. 581 // than formal parameters or because we have no scope information.
573 if (i < info.number_of_parameters()) { 582 if (i < info.number_of_parameters()) {
574 accumulator->PrintName(*info.parameter_name(i)); 583 accumulator->PrintName(*info.parameter_name(i));
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 const Address address = handler->address(); 722 const Address address = handler->address();
714 v->VisitPointers(base, reinterpret_cast<Object**>(address)); 723 v->VisitPointers(base, reinterpret_cast<Object**>(address));
715 base = reinterpret_cast<Object**>(address + StackHandlerConstants::kSize); 724 base = reinterpret_cast<Object**>(address + StackHandlerConstants::kSize);
716 // Traverse the pointers in the handler itself. 725 // Traverse the pointers in the handler itself.
717 handler->Iterate(v); 726 handler->Iterate(v);
718 } 727 }
719 v->VisitPointers(base, limit); 728 v->VisitPointers(base, limit);
720 } 729 }
721 730
722 731
732 void StandardFrame::SetContext(Context* context) {
733 const int offset = StandardFrameConstants::kContextOffset;
734 Memory::Object_at(fp() + offset) = context;
735 }
736
737
723 void JavaScriptFrame::Iterate(ObjectVisitor* v) const { 738 void JavaScriptFrame::Iterate(ObjectVisitor* v) const {
724 IterateExpressions(v); 739 IterateExpressions(v);
725 740
726 // Traverse callee-saved registers, receiver, and parameters. 741 // Traverse callee-saved registers, receiver, and parameters.
727 const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset; 742 const int kBaseOffset = JavaScriptFrameConstants::kSavedRegistersOffset;
728 const int kLimitOffset = JavaScriptFrameConstants::kReceiverOffset; 743 const int kLimitOffset = JavaScriptFrameConstants::kReceiverOffset;
729 Object** base = &Memory::Object_at(fp() + kBaseOffset); 744 Object** base = &Memory::Object_at(fp() + kBaseOffset);
730 Object** limit = &Memory::Object_at(caller_sp() + kLimitOffset) + 1; 745 Object** limit = &Memory::Object_at(caller_sp() + kLimitOffset) + 1;
731 v->VisitPointers(base, limit); 746 v->VisitPointers(base, limit);
732 } 747 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 827
813 Vector<StackFrame*> CreateStackMap() { 828 Vector<StackFrame*> CreateStackMap() {
814 ZoneList<StackFrame*> list(10); 829 ZoneList<StackFrame*> list(10);
815 for (StackFrameIterator it; !it.done(); it.Advance()) { 830 for (StackFrameIterator it; !it.done(); it.Advance()) {
816 StackFrame* frame = AllocateFrameCopy(it.frame()); 831 StackFrame* frame = AllocateFrameCopy(it.frame());
817 list.Add(frame); 832 list.Add(frame);
818 } 833 }
819 return list.ToVector(); 834 return list.ToVector();
820 } 835 }
821 836
837 int GetStackFrameObjectSize(StackFrame* frame) {
838 #define FRAME_TYPE_CASE(type, field) \
839 case StackFrame::type: return sizeof(field);
840
841 switch (frame->type()) {
842 STACK_FRAME_TYPE_LIST(FRAME_TYPE_CASE)
843 default: UNREACHABLE();
844 }
845 #undef FRAME_TYPE_CASE
846 return 0;
847 }
848
822 849
823 } } // namespace v8::internal 850 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/frames.h ('k') | src/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698