Reviewers: mvstanton,

Message:
please take a look.

Description:
Debugger: correctly redirect eval code.

This also allows us to not always compile for debugging when debug is active.

Please review this at https://codereview.chromium.org/1258583002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+18, -6 lines):
  M src/compiler.cc
  M src/debug.cc


Index: src/compiler.cc
diff --git a/src/compiler.cc b/src/compiler.cc
index 9ed494378a1177bcd4cf369a6ddd27276665c27c..deb689d3f87b1080c89af557b722a79b3577986b 100644
--- a/src/compiler.cc
+++ b/src/compiler.cc
@@ -112,7 +112,6 @@ CompilationInfo::CompilationInfo(ParseInfo* parse_info)
   // with deoptimization support.
   if (isolate_->serializer_enabled()) EnableDeoptimizationSupport();

-  if (isolate_->debug()->is_active()) MarkAsDebug();
   if (FLAG_context_specialization) MarkAsContextSpecializing();
   if (FLAG_turbo_inlining) MarkAsInliningEnabled();
   if (FLAG_turbo_source_positions) MarkAsSourcePositionsEnabled();
Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 8c937e4902383361dc9ed6ca9445407a2cfbadd6..8ce8242e35a7f48b61e6a88557a3d2fd579155e4 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1332,6 +1332,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,
@@ -1342,8 +1352,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;
@@ -1351,9 +1363,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;
 }




--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to