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

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

Issue 967323002: Refactor BreakLocationIterator. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: static_cast instead Created 5 years, 10 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 | « src/x87/debug-x87.cc ('k') | test/cctest/test-func-name-inference.cc » ('j') | 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 a4a993ad30c1cd8ea5b75c0e2b062fb0cb651eb1..2bbadc3ec5e27db2864b4be5f0888ac386233a50 100644
--- a/test/cctest/test-debug.cc
+++ b/test/cctest/test-debug.cc
@@ -416,7 +416,7 @@ void CheckDebuggerUnloaded(bool check_functions) {
if (RelocInfo::IsCodeTarget(rmode)) {
CHECK(!Debug::IsDebugBreak(it.rinfo()->target_address()));
} else if (RelocInfo::IsJSReturn(rmode)) {
- CHECK(!Debug::IsDebugBreakAtReturn(it.rinfo()));
+ CHECK(!it.rinfo()->IsPatchedReturnSequence());
}
}
}
@@ -437,47 +437,36 @@ static void CheckDebuggerUnloaded(bool check_functions = false) {
}
-// Inherit from BreakLocationIterator to get access to protected parts for
-// testing.
-class TestBreakLocationIterator: public v8::internal::BreakLocationIterator {
- public:
- explicit TestBreakLocationIterator(Handle<v8::internal::DebugInfo> debug_info)
- : BreakLocationIterator(debug_info, v8::internal::SOURCE_BREAK_LOCATIONS) {}
- v8::internal::RelocIterator* it() { return reloc_iterator_; }
- v8::internal::RelocIterator* it_original() {
- return reloc_iterator_original_;
- }
-};
-
-
// Compile a function, set a break point and check that the call at the break
// location in the code is the expected debug_break function.
void CheckDebugBreakFunction(DebugLocalContext* env,
const char* source, const char* name,
int position, v8::internal::RelocInfo::Mode mode,
Code* debug_break) {
- v8::internal::Debug* debug = CcTest::i_isolate()->debug();
+ i::Debug* debug = CcTest::i_isolate()->debug();
// Create function and set the break point.
- Handle<v8::internal::JSFunction> fun = v8::Utils::OpenHandle(
- *CompileFunction(env, source, name));
+ Handle<i::JSFunction> fun =
+ v8::Utils::OpenHandle(*CompileFunction(env, source, name));
int bp = SetBreakPoint(fun, position);
// Check that the debug break function is as expected.
- Handle<v8::internal::SharedFunctionInfo> shared(fun->shared());
+ Handle<i::SharedFunctionInfo> shared(fun->shared());
CHECK(Debug::HasDebugInfo(shared));
- TestBreakLocationIterator it1(Debug::GetDebugInfo(shared));
- it1.FindBreakLocationFromPosition(position, v8::internal::STATEMENT_ALIGNED);
- v8::internal::RelocInfo::Mode actual_mode = it1.it()->rinfo()->rmode();
- if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) {
- actual_mode = v8::internal::RelocInfo::CODE_TARGET;
+ i::BreakLocation location = i::BreakLocation::FromPosition(
+ Debug::GetDebugInfo(shared), i::SOURCE_BREAK_LOCATIONS, position,
+ i::STATEMENT_ALIGNED);
+ i::RelocInfo::Mode actual_mode = location.rmode();
+ if (actual_mode == i::RelocInfo::CODE_TARGET_WITH_ID) {
+ actual_mode = i::RelocInfo::CODE_TARGET;
}
CHECK_EQ(mode, actual_mode);
- if (mode != v8::internal::RelocInfo::JS_RETURN) {
- CHECK_EQ(debug_break,
- Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address()));
+ if (mode != i::RelocInfo::JS_RETURN) {
+ CHECK_EQ(debug_break, *location.CodeTarget());
} else {
- CHECK(Debug::IsDebugBreakAtReturn(it1.it()->rinfo()));
+ i::RelocInfo rinfo = location.rinfo();
+ CHECK(i::RelocInfo::IsJSReturn(rinfo.rmode()));
+ CHECK(rinfo.IsPatchedReturnSequence());
}
// Clear the break point and check that the debug break function is no longer
@@ -485,15 +474,17 @@ void CheckDebugBreakFunction(DebugLocalContext* env,
ClearBreakPoint(bp);
CHECK(!debug->HasDebugInfo(shared));
CHECK(debug->EnsureDebugInfo(shared, fun));
- TestBreakLocationIterator it2(Debug::GetDebugInfo(shared));
- it2.FindBreakLocationFromPosition(position, v8::internal::STATEMENT_ALIGNED);
- actual_mode = it2.it()->rinfo()->rmode();
- if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) {
- actual_mode = v8::internal::RelocInfo::CODE_TARGET;
+ location = i::BreakLocation::FromPosition(Debug::GetDebugInfo(shared),
+ i::SOURCE_BREAK_LOCATIONS, position,
+ i::STATEMENT_ALIGNED);
+ actual_mode = location.rmode();
+ if (actual_mode == i::RelocInfo::CODE_TARGET_WITH_ID) {
+ actual_mode = i::RelocInfo::CODE_TARGET;
}
CHECK_EQ(mode, actual_mode);
- if (mode == v8::internal::RelocInfo::JS_RETURN) {
- CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo()));
+ if (mode == i::RelocInfo::JS_RETURN) {
+ i::RelocInfo rinfo = location.rinfo();
+ CHECK(!rinfo.IsPatchedReturnSequence());
}
}
« no previous file with comments | « src/x87/debug-x87.cc ('k') | test/cctest/test-func-name-inference.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698