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

Unified Diff: src/debug.cc

Issue 1268463002: Debugger: skip function prologue when computing redirect PC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 172ad3e751fd6c8bf5ef1be89481a07d06c4cce3..e6365289fdec37e10afa0496054d73099dcaae9a 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1311,6 +1311,16 @@ void Debug::ClearStepNext() {
}
+// We start counting call sites from the stack check because the declaration
+// code at the start of the function may have changed on recompile.
+static void SkipToStackCheck(Isolate* isolate, RelocIterator* it) {
+ while (Code::GetCodeFromTargetAddress(it->rinfo()->target_address()) !=
+ *isolate->builtins()->StackCheck()) {
+ it->next();
+ }
+}
+
+
// Count the number of calls before the current frame PC to find the
// corresponding PC in the newly recompiled code.
static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code,
@@ -1321,8 +1331,10 @@ static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code,
int mask = RelocInfo::kCodeTargetMask;
int index = 0;
intptr_t delta = 0;
- for (RelocIterator it(old_code, mask); !it.done(); it.next()) {
- RelocInfo* rinfo = it.rinfo();
+ Isolate* isolate = new_code->GetIsolate();
+ RelocIterator old_it(old_code, mask);
+ for (SkipToStackCheck(isolate, &old_it); !old_it.done(); old_it.next()) {
+ RelocInfo* rinfo = old_it.rinfo();
Address current_pc = rinfo->pc();
// The frame PC is behind the call instruction by the call instruction size.
if (current_pc > old_pc) break;
@@ -1330,9 +1342,10 @@ static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code,
delta = old_pc - current_pc;
}
- RelocIterator it(new_code, mask);
- for (int i = 1; i < index; i++) it.next();
- return it.rinfo()->pc() + delta;
+ RelocIterator new_it(new_code, mask);
+ SkipToStackCheck(isolate, &new_it);
+ for (int i = 1; i < index; i++) new_it.next();
+ return new_it.rinfo()->pc() + delta;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698