Reviewers: aandrey, wingo,

Description:
Support stepping into generator function.

[email protected], [email protected]
BUG=v8:3572
LOG=Y

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

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+14, -4 lines):
  M src/generator.js
  M src/runtime.cc


Index: src/generator.js
diff --git a/src/generator.js b/src/generator.js
index c94c4ff0db1d1fe59e9bdbd932e935e69a1d2d91..8e7bd2fc84acc689415a3fe400b27f3487d52f45 100644
--- a/src/generator.js
+++ b/src/generator.js
@@ -20,6 +20,7 @@ function GeneratorObjectNext(value) {
                         ['[Generator].prototype.next', this]);
   }

+  if (DEBUG_IS_ACTIVE) %DebugPrepareStepInIfStepping(this);
   return %_GeneratorNext(this, value);
 }

Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index dd0884b25dfe8d74c769520860d14f58622778fd..330225dfa205d26ed637918e829bdd2493fddc26 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -5524,13 +5524,22 @@ RUNTIME_FUNCTION(Runtime_DebugPrepareStepInIfStepping) {
   DCHECK(args.length() == 1);
   Debug* debug = isolate->debug();
   if (!debug->IsStepping()) return isolate->heap()->undefined_value();
-  CONVERT_ARG_HANDLE_CHECKED(JSFunction, callback, 0);
+
   HandleScope scope(isolate);
- // When leaving the callback, step out has been activated, but not performed
-  // if we do not leave the builtin.  To be able to step into the callback
+  CONVERT_ARG_HANDLE_CHECKED(Object, object, 0);
+  RUNTIME_ASSERT(object->IsJSFunction() || object->IsJSGeneratorObject());
+  Handle<JSFunction> fun;
+  if (object->IsJSFunction()) {
+    fun = Handle<JSFunction>::cast(object);
+  } else {
+    fun = Handle<JSFunction>(
+        Handle<JSGeneratorObject>::cast(object)->function(), isolate);
+  }
+ // When leaving the function, step out has been activated, but not performed
+  // if we do not leave the builtin.  To be able to step into the function
   // again, we need to clear the step out at this point.
   debug->ClearStepOut();
-  debug->FloodWithOneShot(callback);
+  debug->FloodWithOneShot(fun);
   return isolate->heap()->undefined_value();
 }



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