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

Side by Side Diff: src/debug.cc

Issue 1268463002: Debugger: skip function prologue when computing redirect PC. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 4 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 | no next file » | 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 1293 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 } 1304 }
1305 1305
1306 1306
1307 void Debug::ClearStepNext() { 1307 void Debug::ClearStepNext() {
1308 thread_local_.last_step_action_ = StepNone; 1308 thread_local_.last_step_action_ = StepNone;
1309 thread_local_.last_statement_position_ = RelocInfo::kNoPosition; 1309 thread_local_.last_statement_position_ = RelocInfo::kNoPosition;
1310 thread_local_.last_fp_ = 0; 1310 thread_local_.last_fp_ = 0;
1311 } 1311 }
1312 1312
1313 1313
1314 // We start counting call sites from the stack check because the declaration
1315 // code at the start of the function may have changed on recompile.
1316 static void SkipToStackCheck(Isolate* isolate, RelocIterator* it) {
1317 while (Code::GetCodeFromTargetAddress(it->rinfo()->target_address()) !=
1318 *isolate->builtins()->StackCheck()) {
1319 it->next();
1320 }
1321 }
1322
1323
1314 // Count the number of calls before the current frame PC to find the 1324 // Count the number of calls before the current frame PC to find the
1315 // corresponding PC in the newly recompiled code. 1325 // corresponding PC in the newly recompiled code.
1316 static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code, 1326 static Address ComputeNewPcForRedirect(Code* new_code, Code* old_code,
1317 Address old_pc) { 1327 Address old_pc) {
1318 DCHECK_EQ(old_code->kind(), Code::FUNCTION); 1328 DCHECK_EQ(old_code->kind(), Code::FUNCTION);
1319 DCHECK_EQ(new_code->kind(), Code::FUNCTION); 1329 DCHECK_EQ(new_code->kind(), Code::FUNCTION);
1320 DCHECK(new_code->has_debug_break_slots()); 1330 DCHECK(new_code->has_debug_break_slots());
1321 int mask = RelocInfo::kCodeTargetMask; 1331 int mask = RelocInfo::kCodeTargetMask;
1322 int index = 0; 1332 int index = 0;
1323 intptr_t delta = 0; 1333 intptr_t delta = 0;
1324 for (RelocIterator it(old_code, mask); !it.done(); it.next()) { 1334 Isolate* isolate = new_code->GetIsolate();
1325 RelocInfo* rinfo = it.rinfo(); 1335 RelocIterator old_it(old_code, mask);
1336 for (SkipToStackCheck(isolate, &old_it); !old_it.done(); old_it.next()) {
1337 RelocInfo* rinfo = old_it.rinfo();
1326 Address current_pc = rinfo->pc(); 1338 Address current_pc = rinfo->pc();
1327 // The frame PC is behind the call instruction by the call instruction size. 1339 // The frame PC is behind the call instruction by the call instruction size.
1328 if (current_pc > old_pc) break; 1340 if (current_pc > old_pc) break;
1329 index++; 1341 index++;
1330 delta = old_pc - current_pc; 1342 delta = old_pc - current_pc;
1331 } 1343 }
1332 1344
1333 RelocIterator it(new_code, mask); 1345 RelocIterator new_it(new_code, mask);
1334 for (int i = 1; i < index; i++) it.next(); 1346 SkipToStackCheck(isolate, &new_it);
1335 return it.rinfo()->pc() + delta; 1347 for (int i = 1; i < index; i++) new_it.next();
1348 return new_it.rinfo()->pc() + delta;
1336 } 1349 }
1337 1350
1338 1351
1339 // Count the number of continuations at which the current pc offset is at. 1352 // Count the number of continuations at which the current pc offset is at.
1340 static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) { 1353 static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) {
1341 DCHECK_EQ(code->kind(), Code::FUNCTION); 1354 DCHECK_EQ(code->kind(), Code::FUNCTION);
1342 Address pc = code->instruction_start() + pc_offset; 1355 Address pc = code->instruction_start() + pc_offset;
1343 int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION); 1356 int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION);
1344 int index = 0; 1357 int index = 0;
1345 for (RelocIterator it(code, mask); !it.done(); it.next()) { 1358 for (RelocIterator it(code, mask); !it.done(); it.next()) {
(...skipping 1428 matching lines...) Expand 10 before | Expand all | Expand 10 after
2774 } 2787 }
2775 2788
2776 2789
2777 void LockingCommandMessageQueue::Clear() { 2790 void LockingCommandMessageQueue::Clear() {
2778 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2791 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2779 queue_.Clear(); 2792 queue_.Clear();
2780 } 2793 }
2781 2794
2782 } // namespace internal 2795 } // namespace internal
2783 } // namespace v8 2796 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698