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); |
} |