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

Side by Side Diff: src/debug.cc

Issue 409613002: Store both major and minor key on code stubs. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 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 | Annotate | Revision Log
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 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 366
367 367
368 bool BreakLocationIterator::IsStepInLocation(Isolate* isolate) { 368 bool BreakLocationIterator::IsStepInLocation(Isolate* isolate) {
369 if (RelocInfo::IsConstructCall(original_rmode())) { 369 if (RelocInfo::IsConstructCall(original_rmode())) {
370 return true; 370 return true;
371 } else if (RelocInfo::IsCodeTarget(rmode())) { 371 } else if (RelocInfo::IsCodeTarget(rmode())) {
372 HandleScope scope(debug_info_->GetIsolate()); 372 HandleScope scope(debug_info_->GetIsolate());
373 Address target = original_rinfo()->target_address(); 373 Address target = original_rinfo()->target_address();
374 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); 374 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target));
375 if (target_code->kind() == Code::STUB) { 375 if (target_code->kind() == Code::STUB) {
376 return target_code->major_key() == CodeStub::CallFunction; 376 return CodeStub::GetMajorKey(*target_code) == CodeStub::CallFunction;
377 } 377 }
378 return target_code->is_call_stub(); 378 return target_code->is_call_stub();
379 } 379 }
380 return false; 380 return false;
381 } 381 }
382 382
383 383
384 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { 384 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) {
385 #ifdef DEBUG 385 #ifdef DEBUG
386 HandleScope scope(isolate); 386 HandleScope scope(isolate);
387 // Step in can only be prepared if currently positioned on an IC call, 387 // Step in can only be prepared if currently positioned on an IC call,
388 // construct call or CallFunction stub call. 388 // construct call or CallFunction stub call.
389 Address target = rinfo()->target_address(); 389 Address target = rinfo()->target_address();
390 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); 390 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target));
391 // All the following stuff is needed only for assertion checks so the code 391 // All the following stuff is needed only for assertion checks so the code
392 // is wrapped in ifdef. 392 // is wrapped in ifdef.
393 Handle<Code> maybe_call_function_stub = target_code; 393 Handle<Code> maybe_call_function_stub = target_code;
394 if (IsDebugBreak()) { 394 if (IsDebugBreak()) {
395 Address original_target = original_rinfo()->target_address(); 395 Address original_target = original_rinfo()->target_address();
396 maybe_call_function_stub = 396 maybe_call_function_stub =
397 Handle<Code>(Code::GetCodeFromTargetAddress(original_target)); 397 Handle<Code>(Code::GetCodeFromTargetAddress(original_target));
398 } 398 }
399 bool is_call_function_stub = 399 bool is_call_function_stub =
400 (maybe_call_function_stub->kind() == Code::STUB && 400 (maybe_call_function_stub->kind() == Code::STUB &&
401 maybe_call_function_stub->major_key() == CodeStub::CallFunction); 401 CodeStub::GetMajorKey(*maybe_call_function_stub) ==
402 CodeStub::CallFunction);
402 403
403 // Step in through construct call requires no changes to the running code. 404 // Step in through construct call requires no changes to the running code.
404 // Step in through getters/setters should already be prepared as well 405 // Step in through getters/setters should already be prepared as well
405 // because caller of this function (Debug::PrepareStep) is expected to 406 // because caller of this function (Debug::PrepareStep) is expected to
406 // flood the top frame's function with one shot breakpoints. 407 // flood the top frame's function with one shot breakpoints.
407 // Step in through CallFunction stub should also be prepared by caller of 408 // Step in through CallFunction stub should also be prepared by caller of
408 // this function (Debug::PrepareStep) which should flood target function 409 // this function (Debug::PrepareStep) which should flood target function
409 // with breakpoints. 410 // with breakpoints.
410 ASSERT(RelocInfo::IsConstructCall(rmode()) || 411 ASSERT(RelocInfo::IsConstructCall(rmode()) ||
411 target_code->is_inline_cache_stub() || 412 target_code->is_inline_cache_stub() ||
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
468 } 469 }
469 } 470 }
470 if (RelocInfo::IsConstructCall(mode)) { 471 if (RelocInfo::IsConstructCall(mode)) {
471 if (code->has_function_cache()) { 472 if (code->has_function_cache()) {
472 return isolate->builtins()->CallConstructStub_Recording_DebugBreak(); 473 return isolate->builtins()->CallConstructStub_Recording_DebugBreak();
473 } else { 474 } else {
474 return isolate->builtins()->CallConstructStub_DebugBreak(); 475 return isolate->builtins()->CallConstructStub_DebugBreak();
475 } 476 }
476 } 477 }
477 if (code->kind() == Code::STUB) { 478 if (code->kind() == Code::STUB) {
478 ASSERT(code->major_key() == CodeStub::CallFunction); 479 ASSERT(CodeStub::GetMajorKey(*code) == CodeStub::CallFunction);
479 return isolate->builtins()->CallFunctionStub_DebugBreak(); 480 return isolate->builtins()->CallFunctionStub_DebugBreak();
480 } 481 }
481 482
482 UNREACHABLE(); 483 UNREACHABLE();
483 return Handle<Code>::null(); 484 return Handle<Code>::null();
484 } 485 }
485 486
486 487
487 void BreakLocationIterator::SetDebugBreakAtIC() { 488 void BreakLocationIterator::SetDebugBreakAtIC() {
488 // Patch the original code with the current address as the current address 489 // Patch the original code with the current address as the current address
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after
1412 // Check if target code is CallFunction stub. 1413 // Check if target code is CallFunction stub.
1413 Code* maybe_call_function_stub = code; 1414 Code* maybe_call_function_stub = code;
1414 // If there is a breakpoint at this line look at the original code to 1415 // If there is a breakpoint at this line look at the original code to
1415 // check if it is a CallFunction stub. 1416 // check if it is a CallFunction stub.
1416 if (it.IsDebugBreak()) { 1417 if (it.IsDebugBreak()) {
1417 Address original_target = it.original_rinfo()->target_address(); 1418 Address original_target = it.original_rinfo()->target_address();
1418 maybe_call_function_stub = 1419 maybe_call_function_stub =
1419 Code::GetCodeFromTargetAddress(original_target); 1420 Code::GetCodeFromTargetAddress(original_target);
1420 } 1421 }
1421 if ((maybe_call_function_stub->kind() == Code::STUB && 1422 if ((maybe_call_function_stub->kind() == Code::STUB &&
1422 maybe_call_function_stub->major_key() == CodeStub::CallFunction) || 1423 CodeStub::GetMajorKey(maybe_call_function_stub) ==
1424 CodeStub::CallFunction) ||
1423 maybe_call_function_stub->kind() == Code::CALL_IC) { 1425 maybe_call_function_stub->kind() == Code::CALL_IC) {
1424 // Save reference to the code as we may need it to find out arguments 1426 // Save reference to the code as we may need it to find out arguments
1425 // count for 'step in' later. 1427 // count for 'step in' later.
1426 call_function_stub = Handle<Code>(maybe_call_function_stub); 1428 call_function_stub = Handle<Code>(maybe_call_function_stub);
1427 } 1429 }
1428 } 1430 }
1429 } else { 1431 } else {
1430 is_at_restarted_function = true; 1432 is_at_restarted_function = true;
1431 } 1433 }
1432 1434
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 // Get the STUB key and extract major and minor key. 1494 // Get the STUB key and extract major and minor key.
1493 uint32_t key = Smi::cast(*obj)->value(); 1495 uint32_t key = Smi::cast(*obj)->value();
1494 // Argc in the stub is the number of arguments passed - not the 1496 // Argc in the stub is the number of arguments passed - not the
1495 // expected arguments of the called function. 1497 // expected arguments of the called function.
1496 int call_function_arg_count = is_call_ic 1498 int call_function_arg_count = is_call_ic
1497 ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key)) 1499 ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key))
1498 : CallFunctionStub::ExtractArgcFromMinorKey( 1500 : CallFunctionStub::ExtractArgcFromMinorKey(
1499 CodeStub::MinorKeyFromKey(key)); 1501 CodeStub::MinorKeyFromKey(key));
1500 1502
1501 ASSERT(is_call_ic || 1503 ASSERT(is_call_ic ||
1502 call_function_stub->major_key() == CodeStub::MajorKeyFromKey(key)); 1504 CodeStub::GetMajorKey(*call_function_stub) ==
1505 CodeStub::MajorKeyFromKey(key));
1503 1506
1504 // Find target function on the expression stack. 1507 // Find target function on the expression stack.
1505 // Expression stack looks like this (top to bottom): 1508 // Expression stack looks like this (top to bottom):
1506 // argN 1509 // argN
1507 // ... 1510 // ...
1508 // arg0 1511 // arg0
1509 // Receiver 1512 // Receiver
1510 // Function to call 1513 // Function to call
1511 int expressions_count = frame->ComputeExpressionsCount(); 1514 int expressions_count = frame->ComputeExpressionsCount();
1512 ASSERT(expressions_count - 2 - call_function_arg_count >= 0); 1515 ASSERT(expressions_count - 2 - call_function_arg_count >= 0);
(...skipping 1884 matching lines...) Expand 10 before | Expand all | Expand 10 after
3397 logger_->DebugEvent("Put", message.text()); 3400 logger_->DebugEvent("Put", message.text());
3398 } 3401 }
3399 3402
3400 3403
3401 void LockingCommandMessageQueue::Clear() { 3404 void LockingCommandMessageQueue::Clear() {
3402 base::LockGuard<base::Mutex> lock_guard(&mutex_); 3405 base::LockGuard<base::Mutex> lock_guard(&mutex_);
3403 queue_.Clear(); 3406 queue_.Clear();
3404 } 3407 }
3405 3408
3406 } } // namespace v8::internal 3409 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/code-stubs.cc ('k') | src/deoptimizer.cc » ('j') | src/heap-snapshot-generator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698