Index: test/mjsunit/debug-stepin-property-function-call.js |
diff --git a/test/mjsunit/debug-stepin-builtin.js b/test/mjsunit/debug-stepin-property-function-call.js |
similarity index 51% |
copy from test/mjsunit/debug-stepin-builtin.js |
copy to test/mjsunit/debug-stepin-property-function-call.js |
index d9c60611049dfff564865148adf62f570fec5964..081fb24fb71ff098054e2a94a950b1f678d8a9fe 100644 |
--- a/test/mjsunit/debug-stepin-builtin.js |
+++ b/test/mjsunit/debug-stepin-property-function-call.js |
@@ -1,4 +1,4 @@ |
-// Copyright 2009 the V8 project authors. All rights reserved. |
+// Copyright 2014 the V8 project authors. All rights reserved. |
// Redistribution and use in source and binary forms, with or without |
// modification, are permitted provided that the following conditions are |
// met: |
@@ -25,33 +25,30 @@ |
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
-// Flags: --expose-debug-as debug |
- |
+// Flags: --expose-debug-as debug --nocrankshaft |
// Get the Debug object exposed from the debug context global object. |
Debug = debug.Debug |
var exception = null; |
var state = 1; |
-var expected_source_line_text = null; |
-var expected_function_name = null; |
// Simple debug event handler which first time will cause 'step in' action |
-// and than check that execution is paused inside function |
-// expected_function_name. |
+// to get into g.call and than check that execution is stopped inside |
+// function 'g'. |
function listener(event, exec_state, event_data, data) { |
try { |
if (event == Debug.DebugEvent.Break) { |
if (state == 1) { |
- exec_state.prepareStep(Debug.StepAction.StepIn, 2); |
+ exec_state.prepareStep(Debug.StepAction.StepIn, 3); |
state = 2; |
} else if (state == 2) { |
- assertEquals(expected_function_name, event_data.func().name()); |
- assertEquals(expected_source_line_text, |
- event_data.sourceLineText()); |
+ assertTrue(event_data.sourceLineText().indexOf("Expected to step") > 0, |
+ "source line: \"" + event_data.sourceLineText() + "\""); |
state = 3; |
} |
} |
} catch(e) { |
+ print("Exception: " + e); |
exception = e; |
} |
}; |
@@ -59,20 +56,98 @@ function listener(event, exec_state, event_data, data) { |
// Add the debug event listener. |
Debug.setListener(listener); |
-var a = [1,2,3,4,5]; |
+var count = 0; |
+var obj = { |
+ fun: function() { |
+ ++count; |
+ return count; // Expected to step |
+ } |
+}; |
+obj.fun2 = obj.fun; |
+ |
+function testCall_Dots() { |
+ debugger; |
+ obj.fun(); |
+} |
+ |
+function testCall_Quotes() { |
+ debugger; |
+ obj["fun"](); |
+} |
+ |
+function testCall_Call() { |
+ debugger; |
+ obj.fun.call(obj); |
+} |
+ |
+function testCall_Apply() { |
+ debugger; |
+ obj.fun.apply(obj); |
+} |
+ |
+function testCall_Variable() { |
+ var functionName = "fun"; |
+ debugger; |
+ obj[functionName](); |
+} |
-// Test step into function call from a function without local variables. |
-function testStepInArraySlice() { |
- expected_function_name = 'testStepInArraySlice'; |
- expected_source_line_text = '} // expected line'; |
+function testCall_Fun2() { |
debugger; |
- var s = Array.prototype.slice.call(a, 2,3); |
-} // expected line |
+ obj.fun2(); |
+} |
+ |
+function testCall_InternStrings() { |
+ var cache = { "fun": "fun" }; |
+ var functionName = "fu" + "n"; |
+ debugger; |
+ obj[cache[functionName]](); |
+} |
+ |
+function testCall_ViaFunRef() { |
+ var functionName = "fu" + "n"; |
+ var funRef = obj[functionName]; |
+ debugger; |
+ funRef(); |
+} |
+ |
+// bug 2888 |
+function testCall_RuntimeVariable1() { |
+ var functionName = "fu" + "n"; |
+ debugger; |
+ obj[functionName](); |
+} |
+ |
+// bug 2888 |
+function testCall_RuntimeVariable2() { |
+ var functionName = "un".replace(/u/, "fu"); |
+ debugger; |
+ obj[functionName](); |
+} |
+ |
+// bug 2888 |
+function testCall_RuntimeVariable3() { |
+ var expr = "fu" + "n"; |
+ const functionName = expr; |
+ assertEquals("fun", functionName); |
+ debugger; |
+ obj[functionName](); |
+} |
+ |
+var functionsCalled = 0; |
+for (var n in this) { |
+ if (n.substr(0, 4) != 'test' || typeof this[n] !== "function") { |
+ continue; |
+ } |
+ state = 1; |
+ print("Running " + n + "..."); |
+ this[n](); |
+ ++functionsCalled; |
+ assertNull(exception, n); |
+ assertEquals(3, state, n); |
+ assertEquals(functionsCalled, count, n); |
+} |
-state = 1; |
-testStepInArraySlice(); |
-assertNull(exception); |
-assertEquals(3, state); |
+assertEquals(11, functionsCalled); |
// Get rid of the debug event listener. |
Debug.setListener(null); |