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

Side by Side Diff: src/debug/debug.cc

Issue 2710953004: [inspector] added restrictToFunction flag for getPossibleBreakpoints (Closed)
Patch Set: addressed comments Created 3 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 unified diff | Download patch
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/debug/debug.h" 5 #include "src/debug/debug.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "src/api.h" 9 #include "src/api.h"
10 #include "src/arguments.h" 10 #include "src/arguments.h"
(...skipping 1324 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 } else { 1335 } else {
1336 DCHECK(debug_info->HasDebugBytecodeArray()); 1336 DCHECK(debug_info->HasDebugBytecodeArray());
1337 BytecodeArrayBreakIterator it(debug_info); 1337 BytecodeArrayBreakIterator it(debug_info);
1338 GetBreakablePositions(&it, start_position, end_position, alignment, 1338 GetBreakablePositions(&it, start_position, end_position, alignment,
1339 positions); 1339 positions);
1340 } 1340 }
1341 } 1341 }
1342 } // namespace 1342 } // namespace
1343 1343
1344 bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position, 1344 bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position,
1345 int end_position, std::set<int>* positions) { 1345 int end_position, bool restrict_to_function,
1346 std::set<int>* positions) {
1347 if (restrict_to_function) {
1348 Handle<Object> result =
1349 FindSharedFunctionInfoInScript(script, start_position);
1350 if (result->IsUndefined(isolate_)) return false;
1351
1352 // Make sure the function has set up the debug info.
1353 Handle<SharedFunctionInfo> shared =
1354 Handle<SharedFunctionInfo>::cast(result);
1355 if (!EnsureDebugInfo(shared)) return false;
1356
1357 Handle<DebugInfo> debug_info(shared->GetDebugInfo());
1358 FindBreakablePositions(debug_info, start_position, end_position,
1359 BREAK_POSITION_ALIGNED, positions);
1360 return true;
1361 }
1362
1346 while (true) { 1363 while (true) {
1347 HandleScope scope(isolate_); 1364 HandleScope scope(isolate_);
1348 List<Handle<SharedFunctionInfo>> candidates; 1365 List<Handle<SharedFunctionInfo>> candidates;
1349 SharedFunctionInfo::ScriptIterator iterator(script); 1366 SharedFunctionInfo::ScriptIterator iterator(script);
1350 for (SharedFunctionInfo* info = iterator.Next(); info != nullptr; 1367 for (SharedFunctionInfo* info = iterator.Next(); info != nullptr;
1351 info = iterator.Next()) { 1368 info = iterator.Next()) {
1352 if (info->end_position() < start_position || 1369 if (info->end_position() < start_position ||
1353 info->start_position() >= end_position) { 1370 info->start_position() >= end_position) {
1354 continue; 1371 continue;
1355 } 1372 }
(...skipping 1052 matching lines...) Expand 10 before | Expand all | Expand 10 after
2408 isolate_->Throw(*isolate_->factory()->NewEvalError( 2425 isolate_->Throw(*isolate_->factory()->NewEvalError(
2409 MessageTemplate::kNoSideEffectDebugEvaluate)); 2426 MessageTemplate::kNoSideEffectDebugEvaluate));
2410 } 2427 }
2411 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); 2428 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_);
2412 isolate_->debug()->UpdateHookOnFunctionCall(); 2429 isolate_->debug()->UpdateHookOnFunctionCall();
2413 isolate_->debug()->side_effect_check_failed_ = false; 2430 isolate_->debug()->side_effect_check_failed_ = false;
2414 } 2431 }
2415 2432
2416 } // namespace internal 2433 } // namespace internal
2417 } // namespace v8 2434 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-interface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698