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

Side by Side Diff: src/debug.cc

Issue 1212253009: Debugger: clear ICs on activating step-in to correctly flood accessor pairs. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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.h ('k') | src/objects.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 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after
1344 i -= 1; 1344 i -= 1;
1345 } 1345 }
1346 } 1346 }
1347 1347
1348 if (fun->IsJSFunction()) { 1348 if (fun->IsJSFunction()) {
1349 Handle<JSFunction> js_function(JSFunction::cast(fun)); 1349 Handle<JSFunction> js_function(JSFunction::cast(fun));
1350 FloodWithOneShotGeneric(js_function); 1350 FloodWithOneShotGeneric(js_function);
1351 } 1351 }
1352 } 1352 }
1353 1353
1354 ActivateStepIn(frame); 1354 ActivateStepIn(function, frame);
1355 } 1355 }
1356 1356
1357 // Fill the current function with one-shot break points even for step in on 1357 // Fill the current function with one-shot break points even for step in on
1358 // a call target as the function called might be a native function for 1358 // a call target as the function called might be a native function for
1359 // which step in will not stop. It also prepares for stepping in 1359 // which step in will not stop. It also prepares for stepping in
1360 // getters/setters. 1360 // getters/setters.
1361 // If we are stepping into another frame, only fill calls and returns. 1361 // If we are stepping into another frame, only fill calls and returns.
1362 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS 1362 FloodWithOneShot(function, step_action == StepFrame ? CALLS_AND_RETURNS
1363 : ALL_BREAK_LOCATIONS); 1363 : ALL_BREAK_LOCATIONS);
1364 1364
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
1448 break; 1448 break;
1449 } 1449 }
1450 for (int j = 0; j < break_points; ++j) locations->set(count++, position); 1450 for (int j = 0; j < break_points; ++j) locations->set(count++, position);
1451 } 1451 }
1452 } 1452 }
1453 return locations; 1453 return locations;
1454 } 1454 }
1455 1455
1456 1456
1457 // Handle stepping into a function. 1457 // Handle stepping into a function.
1458 void Debug::HandleStepIn(Handle<Object> function_obj, Handle<Object> holder, 1458 void Debug::HandleStepIn(Handle<Object> function_obj, bool is_constructor) {
1459 Address fp, bool is_constructor) {
1460 // Flood getter/setter if we either step in or step to another frame. 1459 // Flood getter/setter if we either step in or step to another frame.
1461 bool step_frame = thread_local_.last_step_action_ == StepFrame; 1460 bool step_frame = thread_local_.last_step_action_ == StepFrame;
1462 if (!StepInActive() && !step_frame) return; 1461 if (!StepInActive() && !step_frame) return;
1463 if (!function_obj->IsJSFunction()) return; 1462 if (!function_obj->IsJSFunction()) return;
1464 Handle<JSFunction> function = Handle<JSFunction>::cast(function_obj); 1463 Handle<JSFunction> function = Handle<JSFunction>::cast(function_obj);
1465 Isolate* isolate = function->GetIsolate(); 1464 Isolate* isolate = function->GetIsolate();
1466 // If the frame pointer is not supplied by the caller find it. 1465
1467 if (fp == 0) { 1466 StackFrameIterator it(isolate);
1468 StackFrameIterator it(isolate); 1467 it.Advance();
1468 // For constructor functions skip another frame.
1469 if (is_constructor) {
1470 DCHECK(it.frame()->is_construct());
1469 it.Advance(); 1471 it.Advance();
1470 // For constructor functions skip another frame.
1471 if (is_constructor) {
1472 DCHECK(it.frame()->is_construct());
1473 it.Advance();
1474 }
1475 fp = it.frame()->fp();
1476 } 1472 }
1473 Address fp = it.frame()->fp();
1477 1474
1478 // Flood the function with one-shot break points if it is called from where 1475 // Flood the function with one-shot break points if it is called from where
1479 // step into was requested, or when stepping into a new frame. 1476 // step into was requested, or when stepping into a new frame.
1480 if (fp == thread_local_.step_into_fp_ || step_frame) { 1477 if (fp == thread_local_.step_into_fp_ || step_frame) {
1481 FloodWithOneShotGeneric(function, holder); 1478 FloodWithOneShotGeneric(function, Handle<Object>());
1482 } 1479 }
1483 } 1480 }
1484 1481
1485 1482
1486 void Debug::ClearStepping() { 1483 void Debug::ClearStepping() {
1487 // Clear the various stepping setup. 1484 // Clear the various stepping setup.
1488 ClearOneShot(); 1485 ClearOneShot();
1489 ClearStepIn(); 1486 ClearStepIn();
1490 ClearStepOut(); 1487 ClearStepOut();
1491 ClearStepNext(); 1488 ClearStepNext();
(...skipping 13 matching lines...) Expand all
1505 for (DebugInfoListNode* node = debug_info_list_; node != NULL; 1502 for (DebugInfoListNode* node = debug_info_list_; node != NULL;
1506 node = node->next()) { 1503 node = node->next()) {
1507 for (BreakLocation::Iterator it(node->debug_info(), ALL_BREAK_LOCATIONS); 1504 for (BreakLocation::Iterator it(node->debug_info(), ALL_BREAK_LOCATIONS);
1508 !it.Done(); it.Next()) { 1505 !it.Done(); it.Next()) {
1509 it.GetBreakLocation().ClearOneShot(); 1506 it.GetBreakLocation().ClearOneShot();
1510 } 1507 }
1511 } 1508 }
1512 } 1509 }
1513 1510
1514 1511
1515 void Debug::ActivateStepIn(StackFrame* frame) { 1512 void Debug::ActivateStepIn(Handle<JSFunction> function, StackFrame* frame) {
1516 DCHECK(!StepOutActive()); 1513 DCHECK(!StepOutActive());
1514 // Make sure IC state is clean. This is so that we correct flood
1515 // accessor pairs when stepping in.
1516 function->code()->ClearInlineCaches();
1517 function->shared()->feedback_vector()->ClearICSlots(function->shared());
1517 thread_local_.step_into_fp_ = frame->UnpaddedFP(); 1518 thread_local_.step_into_fp_ = frame->UnpaddedFP();
1518 } 1519 }
1519 1520
1520 1521
1521 void Debug::ClearStepIn() { 1522 void Debug::ClearStepIn() {
1522 thread_local_.step_into_fp_ = 0; 1523 thread_local_.step_into_fp_ = 0;
1523 } 1524 }
1524 1525
1525 1526
1526 void Debug::ActivateStepOut(StackFrame* frame) { 1527 void Debug::ActivateStepOut(StackFrame* frame) {
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
2062 2063
2063 // There will be at least one break point when we are done. 2064 // There will be at least one break point when we are done.
2064 has_break_points_ = true; 2065 has_break_points_ = true;
2065 2066
2066 // Ensure function is compiled. Return false if this failed. 2067 // Ensure function is compiled. Return false if this failed.
2067 if (!function.is_null() && 2068 if (!function.is_null() &&
2068 !Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) { 2069 !Compiler::EnsureCompiled(function, CLEAR_EXCEPTION)) {
2069 return false; 2070 return false;
2070 } 2071 }
2071 2072
2072 // Make sure IC state is clean.
2073 shared->code()->ClearInlineCaches();
2074 shared->feedback_vector()->ClearICSlots(*shared);
2075
2076 // Create the debug info object. 2073 // Create the debug info object.
2077 Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared); 2074 Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared);
2078 2075
2079 // Add debug info to the list. 2076 // Add debug info to the list.
2080 DebugInfoListNode* node = new DebugInfoListNode(*debug_info); 2077 DebugInfoListNode* node = new DebugInfoListNode(*debug_info);
2081 node->set_next(debug_info_list_); 2078 node->set_next(debug_info_list_);
2082 debug_info_list_ = node; 2079 debug_info_list_ = node;
2083 2080
2084 return true; 2081 return true;
2085 } 2082 }
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
3329 } 3326 }
3330 3327
3331 3328
3332 void LockingCommandMessageQueue::Clear() { 3329 void LockingCommandMessageQueue::Clear() {
3333 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3330 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3334 queue_.Clear(); 3331 queue_.Clear();
3335 } 3332 }
3336 3333
3337 } // namespace internal 3334 } // namespace internal
3338 } // namespace v8 3335 } // namespace v8
OLDNEW
« no previous file with comments | « src/debug.h ('k') | src/objects.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698