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

Unified Diff: src/debug.h

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/builtins.cc ('k') | src/debug.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.h
diff --git a/src/debug.h b/src/debug.h
index fb9269272f1f2200b00cd9a20c5eba0d2e9f1a40..8aa20aa7d75b5ebf7ac28cc5c11000ef98b5d87d 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -330,6 +330,7 @@ class Debug {
enum AddressId {
k_after_break_target_address,
+ k_restarted_frame_fp_address,
k_debug_break_return_address,
k_debug_break_slot_address,
k_register_address
@@ -340,6 +341,12 @@ class Debug {
return reinterpret_cast<Address*>(&thread_local_.after_break_target_);
}
+ static Address* restarted_frame_fp_address() {
+ return reinterpret_cast<Address*>(&thread_local_.restarted_frame_fp_);
+ }
+
+
+
// Support for saving/restoring registers when handling debug break calls.
static Object** register_address(int r) {
return &registers_[r];
@@ -395,7 +402,25 @@ class Debug {
static void GenerateStubNoRegistersDebugBreak(MacroAssembler* masm);
static void GenerateSlotDebugBreak(MacroAssembler* masm);
static void GeneratePlainReturnLiveEdit(MacroAssembler* masm);
- static void GenerateFrameDropperLiveEdit(MacroAssembler* masm);
+
+ // LiveEdit restarter patch. For javascript stack frames that has to be
+ // restarted. First it is appended at the end of a regular code of javascript
+ // function. Frame PC should be set to the entry point
+ // of the patch. When control finally returns to the frame, restarter resets
+ // registers and jumps to the function entry. Stack analizer sees
+ // the frame as if paused at the very beginning of the function (from source
+ // point of view). Local scope is not available in this state and shouldn't be
+ // accessed.
+ // The patch code starts with NOP instruction. The next byte is a patch
+ // starting point (its offset is typically 1 and is defined
+ // in Debug::kFrameDropperEntryOffset. The NOP instruction is for being
+ // annotated with position-bearing rinfo (in the actual function), because
+ // source position resolver expects position-bearing rinfo exactly before
+ // pc pointer (see Code::SourcePosition).
+ // It also resets the global variable restarter_frame_fp.
+ //
+ static void GenerateRestarterPatchLiveEdit(MacroAssembler* masm);
+
// Called from stub-cache.cc.
static void GenerateCallICDebugBreak(MacroAssembler* masm);
@@ -414,12 +439,19 @@ class Debug {
FRAME_DROPPED_IN_DIRECT_CALL
};
- static void FramesHaveBeenDropped(StackFrame::Id new_break_frame_id,
+ static void FramesHaveBeenDropped(JavaScriptFrame* new_top_js_frame,
FrameDropMode mode);
- static void SetUpFrameDropperFrame(StackFrame* bottom_js_frame,
- Handle<Code> code);
- static const int kFrameDropperFrameSize;
+ // Returns fp of the restarted frame that is currently on the active stack
+ // or NULL.
+ static Address GetRestartedFrameFp();
+
+ // The actual entry point offset in the frame restarter patch.
+ static const int kFrameRestarterEntryOffset;
+
+ // The height (in words) of the restarted JavaScript frame.
+ // A negative value indicates that stack manipulation is not supported.
+ static const int kRestartedFrameHeight;
private:
static bool CompileDebuggerScript(int index);
@@ -486,6 +518,10 @@ class Debug {
// Storage location for jump when exiting debug break calls.
Address after_break_target_;
+ // Stores fp of the restarted frame that is currently on the active stack
+ // or NULL. This variable is reset when that frame gets running.
+ Address restarted_frame_fp_;
+
// Stores the way how LiveEdit has patched the stack. It is used when
// debugger returns control back to user script.
FrameDropMode frame_drop_mode_;
@@ -917,6 +953,10 @@ class Debug_Address {
return Debug_Address(Debug::k_after_break_target_address);
}
+ static Debug_Address RestartedFrameFp() {
+ return Debug_Address(Debug::k_restarted_frame_fp_address);
+ }
+
static Debug_Address DebugBreakReturn() {
return Debug_Address(Debug::k_debug_break_return_address);
}
@@ -929,6 +969,8 @@ class Debug_Address {
switch (id_) {
case Debug::k_after_break_target_address:
return reinterpret_cast<Address>(Debug::after_break_target_address());
+ case Debug::k_restarted_frame_fp_address:
+ return reinterpret_cast<Address>(Debug::restarted_frame_fp_address());
case Debug::k_debug_break_return_address:
return reinterpret_cast<Address>(Debug::debug_break_return_address());
case Debug::k_debug_break_slot_address:
« no previous file with comments | « src/builtins.cc ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698