Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: test/cctest/test-debug.cc

Issue 2238893002: [debugger] separate break point info from code instrumentation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-debug.cc
diff --git a/test/cctest/test-debug.cc b/test/cctest/test-debug.cc
index 8935d8da70ef9a747bd75f6da5a7f3f189150713..925eaf4c27e39ecb3a4a6caa2cece4f9369db728 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -7978,19 +7978,12 @@ static void NoInterruptsOnDebugEvent(
--after_compile_handler_depth;
}
-
TEST(NoInterruptsInDebugListener) {
DebugLocalContext env;
v8::Debug::SetDebugEventListener(env->GetIsolate(), NoInterruptsOnDebugEvent);
CompileRun("void(0);");
}
-class TestBreakLocation : public i::BreakLocation {
- public:
- using i::BreakLocation::GetIterator;
- using i::BreakLocation::Iterator;
-};
-
TEST(BreakLocationIterator) {
DebugLocalContext env;
v8::Isolate* isolate = env->GetIsolate();
@@ -8012,53 +8005,40 @@ TEST(BreakLocationIterator) {
CHECK(i_isolate->debug()->EnsureDebugInfo(shared, function));
Handle<i::DebugInfo> debug_info(shared->GetDebugInfo());
- int code_size = debug_info->abstract_code()->Size();
-
- bool found_return = false;
- bool found_call = false;
- bool found_debugger = false;
-
- // Test public interface.
- for (int i = 0; i < code_size; i++) {
- i::BreakLocation location = i::BreakLocation::FromCodeOffset(debug_info, i);
- if (location.IsCall()) found_call = true;
- if (location.IsReturn()) found_return = true;
- if (location.IsDebuggerStatement()) found_debugger = true;
+ Handle<i::AbstractCode> abstract_code(shared->abstract_code());
+
+ {
+ auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code,
+ i::ALL_BREAK_LOCATIONS);
+ CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
+ CHECK_EQ(17, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsDebugBreakSlot());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsCall());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
+ CHECK_EQ(47, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsReturn());
+ CHECK_EQ(60, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->Done());
+ }
+
+ {
+ auto iterator = i::BreakIterator::GetIterator(debug_info, abstract_code,
+ i::CALLS_AND_RETURNS);
+ CHECK(iterator->GetBreakLocation().IsCall());
+ CHECK_EQ(32, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->GetBreakLocation().IsReturn());
+ CHECK_EQ(60, iterator->GetBreakLocation().position());
+ iterator->Next();
+ CHECK(iterator->Done());
}
- CHECK(found_call);
- CHECK(found_return);
- CHECK(found_debugger);
-
- // Test underlying implementation.
- TestBreakLocation::Iterator* iterator =
- TestBreakLocation::GetIterator(debug_info, i::ALL_BREAK_LOCATIONS);
- CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
- CHECK_EQ(17, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->GetBreakLocation().IsDebugBreakSlot());
- CHECK_EQ(32, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->GetBreakLocation().IsCall());
- CHECK_EQ(32, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->GetBreakLocation().IsDebuggerStatement());
- CHECK_EQ(47, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->GetBreakLocation().IsReturn());
- CHECK_EQ(60, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->Done());
- delete iterator;
-
- iterator = TestBreakLocation::GetIterator(debug_info, i::CALLS_AND_RETURNS);
- CHECK(iterator->GetBreakLocation().IsCall());
- CHECK_EQ(32, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->GetBreakLocation().IsReturn());
- CHECK_EQ(60, iterator->GetBreakLocation().position());
- iterator->Next();
- CHECK(iterator->Done());
- delete iterator;
DisableDebugger(isolate);
}
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698