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

Side by Side Diff: src/debug.cc

Issue 1038613002: [turbofan] Support initial step-in through debugger statement. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Follow-up after rebase. Created 5 years, 9 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 | « no previous file | src/runtime/runtime-debug.cc » ('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/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/arguments.h" 8 #include "src/arguments.h"
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after
1256 if (!frame->function()->IsJSFunction()) { 1256 if (!frame->function()->IsJSFunction()) {
1257 // Step out: Find the calling JavaScript frame and flood it with 1257 // Step out: Find the calling JavaScript frame and flood it with
1258 // breakpoints. 1258 // breakpoints.
1259 frames_it.Advance(); 1259 frames_it.Advance();
1260 // Fill the function to return to with one-shot break points. 1260 // Fill the function to return to with one-shot break points.
1261 JSFunction* function = frames_it.frame()->function(); 1261 JSFunction* function = frames_it.frame()->function();
1262 FloodWithOneShot(Handle<JSFunction>(function)); 1262 FloodWithOneShot(Handle<JSFunction>(function));
1263 return; 1263 return;
1264 } 1264 }
1265 1265
1266 List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
1267 frames_it.frame()->Summarize(&frames);
1268 FrameSummary summary = frames.first();
1269
1266 // Get the debug info (create it if it does not exist). 1270 // Get the debug info (create it if it does not exist).
1267 Handle<JSFunction> function(frame->function()); 1271 Handle<JSFunction> function(summary.function());
1268 Handle<SharedFunctionInfo> shared(function->shared()); 1272 Handle<SharedFunctionInfo> shared(function->shared());
1269 if (!EnsureDebugInfo(shared, function)) { 1273 if (!EnsureDebugInfo(shared, function)) {
1270 // Return if ensuring debug info failed. 1274 // Return if ensuring debug info failed.
1271 return; 1275 return;
1272 } 1276 }
1273 Handle<DebugInfo> debug_info = GetDebugInfo(shared); 1277 Handle<DebugInfo> debug_info = GetDebugInfo(shared);
1274 1278
1275 // Compute whether or not the target is a call target. 1279 // Compute whether or not the target is a call target.
1276 bool is_load_or_store = false; 1280 bool is_load_or_store = false;
1277 bool is_inline_cache_stub = false; 1281 bool is_inline_cache_stub = false;
1278 bool is_at_restarted_function = false; 1282 bool is_at_restarted_function = false;
1279 Handle<Code> call_function_stub; 1283 Handle<Code> call_function_stub;
1280 1284
1281 // PC points to the instruction after the current one, possibly a break 1285 // PC points to the instruction after the current one, possibly a break
1282 // location as well. So the "- 1" to exclude it from the search. 1286 // location as well. So the "- 1" to exclude it from the search.
1283 Address call_pc = frame->pc() - 1; 1287 Address call_pc = summary.pc() - 1;
1284 BreakLocation location = 1288 BreakLocation location =
1285 BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, call_pc); 1289 BreakLocation::FromAddress(debug_info, ALL_BREAK_LOCATIONS, call_pc);
1286 1290
1287 if (thread_local_.restarter_frame_function_pointer_ == NULL) { 1291 if (thread_local_.restarter_frame_function_pointer_ == NULL) {
1288 if (location.IsCodeTarget()) { 1292 if (location.IsCodeTarget()) {
1289 Handle<Code> target_code = location.CodeTarget(); 1293 Handle<Code> target_code = location.CodeTarget();
1290 is_inline_cache_stub = target_code->is_inline_cache_stub(); 1294 is_inline_cache_stub = target_code->is_inline_cache_stub();
1291 is_load_or_store = is_inline_cache_stub && !target_code->is_call_stub(); 1295 is_load_or_store = is_inline_cache_stub && !target_code->is_call_stub();
1292 1296
1293 // Check if target code is CallFunction stub. 1297 // Check if target code is CallFunction stub.
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 step_action == StepNext || step_action == StepMin) { 1344 step_action == StepNext || step_action == StepMin) {
1341 // Step next or step min. 1345 // Step next or step min.
1342 1346
1343 // Fill the current function with one-shot break points. 1347 // Fill the current function with one-shot break points.
1344 // If we are stepping into another frame, only fill calls and returns. 1348 // If we are stepping into another frame, only fill calls and returns.
1345 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS 1349 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS
1346 : ALL_BREAK_LOCATIONS); 1350 : ALL_BREAK_LOCATIONS);
1347 1351
1348 // Remember source position and frame to handle step next. 1352 // Remember source position and frame to handle step next.
1349 thread_local_.last_statement_position_ = 1353 thread_local_.last_statement_position_ =
1350 debug_info->code()->SourceStatementPosition(frame->pc()); 1354 debug_info->code()->SourceStatementPosition(summary.pc());
1351 thread_local_.last_fp_ = frame->UnpaddedFP(); 1355 thread_local_.last_fp_ = frame->UnpaddedFP();
1352 } else { 1356 } else {
1353 // If there's restarter frame on top of the stack, just get the pointer 1357 // If there's restarter frame on top of the stack, just get the pointer
1354 // to function which is going to be restarted. 1358 // to function which is going to be restarted.
1355 if (is_at_restarted_function) { 1359 if (is_at_restarted_function) {
1356 Handle<JSFunction> restarted_function( 1360 Handle<JSFunction> restarted_function(
1357 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); 1361 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_));
1358 FloodWithOneShot(restarted_function); 1362 FloodWithOneShot(restarted_function);
1359 } else if (!call_function_stub.is_null()) { 1363 } else if (!call_function_stub.is_null()) {
1360 // If it's CallFunction stub ensure target function is compiled and flood 1364 // If it's CallFunction stub ensure target function is compiled and flood
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 // If we are stepping into another frame, only fill calls and returns. 1416 // If we are stepping into another frame, only fill calls and returns.
1413 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS 1417 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS
1414 : ALL_BREAK_LOCATIONS); 1418 : ALL_BREAK_LOCATIONS);
1415 1419
1416 if (is_load_or_store) { 1420 if (is_load_or_store) {
1417 // Remember source position and frame to handle step in getter/setter. If 1421 // Remember source position and frame to handle step in getter/setter. If
1418 // there is a custom getter/setter it will be handled in 1422 // there is a custom getter/setter it will be handled in
1419 // Object::Get/SetPropertyWithAccessor, otherwise the step action will be 1423 // Object::Get/SetPropertyWithAccessor, otherwise the step action will be
1420 // propagated on the next Debug::Break. 1424 // propagated on the next Debug::Break.
1421 thread_local_.last_statement_position_ = 1425 thread_local_.last_statement_position_ =
1422 debug_info->code()->SourceStatementPosition(frame->pc()); 1426 debug_info->code()->SourceStatementPosition(summary.pc());
1423 thread_local_.last_fp_ = frame->UnpaddedFP(); 1427 thread_local_.last_fp_ = frame->UnpaddedFP();
1424 } 1428 }
1425 1429
1426 // Step in or Step in min 1430 // Step in or Step in min
1427 // Step in through construct call requires no changes to the running code. 1431 // Step in through construct call requires no changes to the running code.
1428 // Step in through getters/setters should already be prepared as well 1432 // Step in through getters/setters should already be prepared as well
1429 // because caller of this function (Debug::PrepareStep) is expected to 1433 // because caller of this function (Debug::PrepareStep) is expected to
1430 // flood the top frame's function with one shot breakpoints. 1434 // flood the top frame's function with one shot breakpoints.
1431 // Step in through CallFunction stub should also be prepared by caller of 1435 // Step in through CallFunction stub should also be prepared by caller of
1432 // this function (Debug::PrepareStep) which should flood target function 1436 // this function (Debug::PrepareStep) which should flood target function
(...skipping 1957 matching lines...) Expand 10 before | Expand all | Expand 10 after
3390 logger_->DebugEvent("Put", message.text()); 3394 logger_->DebugEvent("Put", message.text());
3391 } 3395 }
3392 3396
3393 3397
3394 void LockingCommandMessageQueue::Clear() { 3398 void LockingCommandMessageQueue::Clear() {
3395 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3399 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3396 queue_.Clear(); 3400 queue_.Clear();
3397 } 3401 }
3398 3402
3399 } } // namespace v8::internal 3403 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/runtime/runtime-debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698