Commit 33ebf6a9 authored by Yang Guo's avatar Yang Guo Committed by Commit Bot

[debug] add more tests for break points for builtin constructors.

This has been made possible when custom builtin constructors were
removed.

R=jgruber@chromium.org

Bug: v8:178, v8:7518
Change-Id: I7ee064c3b899732ebe9381ea004f231fa6c0cef0
Reviewed-on: https://chromium-review.googlesource.com/975541
Commit-Queue: Yang Guo <yangguo@chromium.org>
Reviewed-by: 's avatarJakob Gruber <jgruber@chromium.org>
Cr-Commit-Position: refs/heads/master@{#52229}
parent 1d249631
...@@ -1149,7 +1149,7 @@ TEST(BreakPointConstructorBuiltin) { ...@@ -1149,7 +1149,7 @@ TEST(BreakPointConstructorBuiltin) {
v8::Local<v8::Function> builtin; v8::Local<v8::Function> builtin;
i::Handle<i::BreakPoint> bp; i::Handle<i::BreakPoint> bp;
// === Test constructor builtin (for ones with normal construct stubs) === // === Test Promise constructor ===
break_point_hit_count = 0; break_point_hit_count = 0;
builtin = CompileRun("Promise").As<v8::Function>(); builtin = CompileRun("Promise").As<v8::Function>();
ExpectString("(new Promise(()=>{})).toString()", "[object Promise]"); ExpectString("(new Promise(()=>{})).toString()", "[object Promise]");
...@@ -1165,6 +1165,38 @@ TEST(BreakPointConstructorBuiltin) { ...@@ -1165,6 +1165,38 @@ TEST(BreakPointConstructorBuiltin) {
ExpectString("(new Promise(()=>{})).toString()", "[object Promise]"); ExpectString("(new Promise(()=>{})).toString()", "[object Promise]");
CHECK_EQ(1, break_point_hit_count); CHECK_EQ(1, break_point_hit_count);
// === Test Object constructor ===
break_point_hit_count = 0;
builtin = CompileRun("Object").As<v8::Function>();
CompileRun("new Object()");
CHECK_EQ(0, break_point_hit_count);
// Run with breakpoint.
bp = SetBreakPoint(builtin, 0);
CompileRun("new Object()");
CHECK_EQ(1, break_point_hit_count);
// Run without breakpoints.
ClearBreakPoint(bp);
CompileRun("new Object()");
CHECK_EQ(1, break_point_hit_count);
// === Test Number constructor ===
break_point_hit_count = 0;
builtin = CompileRun("Number").As<v8::Function>();
CompileRun("new Number()");
CHECK_EQ(0, break_point_hit_count);
// Run with breakpoint.
bp = SetBreakPoint(builtin, 0);
CompileRun("new Number()");
CHECK_EQ(1, break_point_hit_count);
// Run without breakpoints.
ClearBreakPoint(bp);
CompileRun("new Number()");
CHECK_EQ(1, break_point_hit_count);
SetDebugEventListener(env->GetIsolate(), nullptr); SetDebugEventListener(env->GetIsolate(), nullptr);
CheckDebuggerUnloaded(); CheckDebuggerUnloaded();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment