From 2974f8e3bb66de3c9f9de778d297875bff35a354 Mon Sep 17 00:00:00 2001 From: "prybin@chromium.org" Date: Tue, 17 Sep 2013 17:35:36 +0000 Subject: [PATCH] Support stepin for combination of apply and bound function R=yangguo@chromium.org Review URL: https://codereview.chromium.org/23513023 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16777 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/debug.cc | 10 +++++++--- test/mjsunit/debug-stepin-function-call.js | 15 +++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index 0496b8c..63d33eb 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -1793,10 +1793,14 @@ void Debug::HandleStepIn(Handle 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 js_function = Handle::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); diff --git a/test/mjsunit/debug-stepin-function-call.js b/test/mjsunit/debug-stepin-function-call.js index 3b5240c..eaeebce 100644 --- a/test/mjsunit/debug-stepin-function-call.js +++ b/test/mjsunit/debug-stepin-function-call.js @@ -142,8 +142,19 @@ 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; @@ -161,4 +172,4 @@ assertNull(exception); assertEquals(3, state); // Get rid of the debug event listener. -Debug.setListener(null); \ No newline at end of file +Debug.setListener(null); -- 2.7.4