Reviewers: Yang,

Message:
Corresponding Chrome bug:
https://code.google.com/p/chromium/issues/detail?id=275672

Description:
Support stepin for combination of apply and bound function

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

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

Affected files (+18, -4 lines):
  M src/debug.cc
  M test/mjsunit/debug-stepin-function-call.js


Index: src/debug.cc
diff --git a/src/debug.cc b/src/debug.cc
index 7624f26d7ad9490b58fceef330095b8b15f0ca11..07b4a935259cb813e887b98ea6a3e617e4bdb0ff 100644
--- a/src/debug.cc
+++ b/src/debug.cc
@@ -1793,10 +1793,14 @@ void Debug::HandleStepIn(Handle<JSFunction> function, // function to be called and not the code for Builtins::FunctionApply or
         // Builtins::FunctionCall. The receiver of call/apply is the target
         // function.
-        if (!holder.is_null() && holder->IsJSFunction() &&
-            !JSFunction::cast(*holder)->IsBuiltin()) {
+        if (!holder.is_null() && holder->IsJSFunction()) {
Handle<JSFunction> js_function = Handle<JSFunction>::cast(holder);
-          Debug::FloodWithOneShot(js_function);
+          if (!js_function->IsBuiltin()) {
+            Debug::FloodWithOneShot(js_function);
+          } else if (js_function->shared()->bound()) {
+            // Handle Function.prototype.bind
+            Debug::FloodBoundFunctionWithOneShot(js_function);
+          }
         }
       } else {
         Debug::FloodWithOneShot(function);
Index: test/mjsunit/debug-stepin-function-call.js
diff --git a/test/mjsunit/debug-stepin-function-call.js b/test/mjsunit/debug-stepin-function-call.js index 3b5240c9337da878527f414d7edba7c0e9f3a779..6c6d635003d7c2754415582bc8283d5e18cf21c3 100644
--- a/test/mjsunit/debug-stepin-function-call.js
+++ b/test/mjsunit/debug-stepin-function-call.js
@@ -142,8 +142,18 @@ function bind1() {
   bound();
 }

+// Test step into apply of bound function.
+function applyAndBind1() {
+  var bound = g.bind(null, 3);
+  debugger;
+  bound.apply(null, [3]);
+  var aLocalVar = 'test';
+  var anotherLocalVar  = g(aLocalVar) + 's';
+  var yetAnotherLocal = 10;
+}
+
 var testFunctions =
-    [call1, call2, call3, call4, apply1, apply2, apply3, apply4, bind1];
+ [call1, call2, call3, call4, apply1, apply2, apply3, apply4, bind1, applyAndBind1];

 for (var i = 0; i < testFunctions.length; i++) {
   state = 0;


--
--
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/groups/opt_out.

Reply via email to