Reviewers: mvstanton,

Message:
Michael, I thought about this and I think your idea with conditionally compiling
the IC is cleaner. So I implemented it. Please take a look!

Description:
Debugger: do not compile IC for accessors when debugging.

The invariant is that as long as there is a debug info on
the shared function info, no accessor IC is compiled for
its code. That way we can guarantee that stepping into
accessors, which requires a debug info, works for accessors.

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

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

Affected files (+9, -4 lines):
  M src/debug.cc
  M src/ic/ic.cc


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index e952fe7ebb88a9dc07893f4e973be4fc5fc9ffab..8e5cc6d02e0230d4edec153ec1cd1f144eeccc78 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1511,10 +1511,6 @@ void Debug::ClearOneShot() {

void Debug::ActivateStepIn(Handle<JSFunction> function, StackFrame* frame) {
   DCHECK(!StepOutActive());
-  // Make sure IC state is clean. This is so that we correct flood
-  // accessor pairs when stepping in.
-  function->code()->ClearInlineCaches();
-  function->shared()->feedback_vector()->ClearICSlots(function->shared());
   thread_local_.step_into_fp_ = frame->UnpaddedFP();
 }

@@ -2070,6 +2066,11 @@ bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared,
     return false;
   }

+  // Make sure IC state is clean. This is so that we correctly flood
+  // accessor pairs when stepping in.
+  function->code()->ClearInlineCaches();
+  function->shared()->feedback_vector()->ClearICSlots(function->shared());
+
   // Create the debug info object.
   Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);

Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 9f75af8eb3c27be29f79626fe66718d4ad1e5fb0..8977232bd74760eff3421fdebf73b950fd372e22 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -1210,6 +1210,8 @@ Handle<Code> LoadIC::CompileHandler(LookupIterator* lookup,
                               isolate());
         if (!getter->IsJSFunction()) break;
         if (!holder->HasFastProperties()) break;
+ // When debugging we need to go the slow path to flood the accessor.
+        if (!GetSharedFunctionInfo()->debug_info()->IsUndefined()) break;
         Handle<JSFunction> function = Handle<JSFunction>::cast(getter);
         if (!receiver->IsJSObject() && !function->IsBuiltin() &&
             is_sloppy(function->shared()->language_mode())) {
@@ -1786,6 +1788,8 @@ Handle<Code> StoreIC::CompileHandler(LookupIterator* lookup,
           TRACE_GENERIC_IC(isolate(), "StoreIC", "setter not a function");
           break;
         }
+ // When debugging we need to go the slow path to flood the accessor.
+        if (!GetSharedFunctionInfo()->debug_info()->IsUndefined()) break;
         Handle<JSFunction> function = Handle<JSFunction>::cast(setter);
         CallOptimization call_optimization(function);
NamedStoreHandlerCompiler compiler(isolate(), receiver_map(), holder);


--
--
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