| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 bool BreakLocationIterator::IsStepInLocation(Isolate* isolate) { | 399 bool BreakLocationIterator::IsStepInLocation(Isolate* isolate) { |
| 400 if (RelocInfo::IsConstructCall(original_rmode())) { | 400 if (RelocInfo::IsConstructCall(original_rmode())) { |
| 401 return true; | 401 return true; |
| 402 } else if (RelocInfo::IsCodeTarget(rmode())) { | 402 } else if (RelocInfo::IsCodeTarget(rmode())) { |
| 403 HandleScope scope(debug_info_->GetIsolate()); | 403 HandleScope scope(debug_info_->GetIsolate()); |
| 404 Address target = original_rinfo()->target_address(); | 404 Address target = original_rinfo()->target_address(); |
| 405 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); | 405 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); |
| 406 if (target_code->kind() == Code::STUB) { | 406 if (target_code->kind() == Code::STUB) { |
| 407 return target_code->major_key() == CodeStub::CallFunction; | 407 return target_code->major_key() == CodeStub::CallFunction; |
| 408 } | 408 } |
| 409 return target_code->is_call_stub(); |
| 409 } | 410 } |
| 410 return false; | 411 return false; |
| 411 } | 412 } |
| 412 | 413 |
| 413 | 414 |
| 414 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { | 415 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { |
| 415 #ifdef DEBUG | 416 #ifdef DEBUG |
| 416 HandleScope scope(isolate); | 417 HandleScope scope(isolate); |
| 417 // Step in can only be prepared if currently positioned on an IC call, | 418 // Step in can only be prepared if currently positioned on an IC call, |
| 418 // construct call or CallFunction stub call. | 419 // construct call or CallFunction stub call. |
| (...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1417 bool is_load_or_store = false; | 1418 bool is_load_or_store = false; |
| 1418 bool is_inline_cache_stub = false; | 1419 bool is_inline_cache_stub = false; |
| 1419 bool is_at_restarted_function = false; | 1420 bool is_at_restarted_function = false; |
| 1420 Handle<Code> call_function_stub; | 1421 Handle<Code> call_function_stub; |
| 1421 | 1422 |
| 1422 if (thread_local_.restarter_frame_function_pointer_ == NULL) { | 1423 if (thread_local_.restarter_frame_function_pointer_ == NULL) { |
| 1423 if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) { | 1424 if (RelocInfo::IsCodeTarget(it.rinfo()->rmode())) { |
| 1424 bool is_call_target = false; | 1425 bool is_call_target = false; |
| 1425 Address target = it.rinfo()->target_address(); | 1426 Address target = it.rinfo()->target_address(); |
| 1426 Code* code = Code::GetCodeFromTargetAddress(target); | 1427 Code* code = Code::GetCodeFromTargetAddress(target); |
| 1428 if (code->is_call_stub()) { |
| 1429 is_call_target = true; |
| 1430 } |
| 1427 if (code->is_inline_cache_stub()) { | 1431 if (code->is_inline_cache_stub()) { |
| 1428 is_inline_cache_stub = true; | 1432 is_inline_cache_stub = true; |
| 1429 is_load_or_store = !is_call_target; | 1433 is_load_or_store = !is_call_target; |
| 1430 } | 1434 } |
| 1431 | 1435 |
| 1432 // Check if target code is CallFunction stub. | 1436 // Check if target code is CallFunction stub. |
| 1433 Code* maybe_call_function_stub = code; | 1437 Code* maybe_call_function_stub = code; |
| 1434 // If there is a breakpoint at this line look at the original code to | 1438 // If there is a breakpoint at this line look at the original code to |
| 1435 // check if it is a CallFunction stub. | 1439 // check if it is a CallFunction stub. |
| 1436 if (it.IsDebugBreak()) { | 1440 if (it.IsDebugBreak()) { |
| 1437 Address original_target = it.original_rinfo()->target_address(); | 1441 Address original_target = it.original_rinfo()->target_address(); |
| 1438 maybe_call_function_stub = | 1442 maybe_call_function_stub = |
| 1439 Code::GetCodeFromTargetAddress(original_target); | 1443 Code::GetCodeFromTargetAddress(original_target); |
| 1440 } | 1444 } |
| 1441 if (maybe_call_function_stub->kind() == Code::STUB && | 1445 if ((maybe_call_function_stub->kind() == Code::STUB && |
| 1442 maybe_call_function_stub->major_key() == CodeStub::CallFunction) { | 1446 maybe_call_function_stub->major_key() == CodeStub::CallFunction) || |
| 1447 maybe_call_function_stub->kind() == Code::CALL_IC) { |
| 1443 // Save reference to the code as we may need it to find out arguments | 1448 // Save reference to the code as we may need it to find out arguments |
| 1444 // count for 'step in' later. | 1449 // count for 'step in' later. |
| 1445 call_function_stub = Handle<Code>(maybe_call_function_stub); | 1450 call_function_stub = Handle<Code>(maybe_call_function_stub); |
| 1446 } | 1451 } |
| 1447 } | 1452 } |
| 1448 } else { | 1453 } else { |
| 1449 is_at_restarted_function = true; | 1454 is_at_restarted_function = true; |
| 1450 } | 1455 } |
| 1451 | 1456 |
| 1452 // If this is the last break code target step out is the only possibility. | 1457 // If this is the last break code target step out is the only possibility. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1488 } else { | 1493 } else { |
| 1489 // If there's restarter frame on top of the stack, just get the pointer | 1494 // If there's restarter frame on top of the stack, just get the pointer |
| 1490 // to function which is going to be restarted. | 1495 // to function which is going to be restarted. |
| 1491 if (is_at_restarted_function) { | 1496 if (is_at_restarted_function) { |
| 1492 Handle<JSFunction> restarted_function( | 1497 Handle<JSFunction> restarted_function( |
| 1493 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); | 1498 JSFunction::cast(*thread_local_.restarter_frame_function_pointer_)); |
| 1494 FloodWithOneShot(restarted_function); | 1499 FloodWithOneShot(restarted_function); |
| 1495 } else if (!call_function_stub.is_null()) { | 1500 } else if (!call_function_stub.is_null()) { |
| 1496 // If it's CallFunction stub ensure target function is compiled and flood | 1501 // If it's CallFunction stub ensure target function is compiled and flood |
| 1497 // it with one shot breakpoints. | 1502 // it with one shot breakpoints. |
| 1503 bool is_call_ic = call_function_stub->kind() == Code::CALL_IC; |
| 1498 | 1504 |
| 1499 // Find out number of arguments from the stub minor key. | 1505 // Find out number of arguments from the stub minor key. |
| 1500 // Reverse lookup required as the minor key cannot be retrieved | 1506 // Reverse lookup required as the minor key cannot be retrieved |
| 1501 // from the code object. | 1507 // from the code object. |
| 1502 Handle<Object> obj( | 1508 Handle<Object> obj( |
| 1503 isolate_->heap()->code_stubs()->SlowReverseLookup( | 1509 isolate_->heap()->code_stubs()->SlowReverseLookup( |
| 1504 *call_function_stub), | 1510 *call_function_stub), |
| 1505 isolate_); | 1511 isolate_); |
| 1506 ASSERT(!obj.is_null()); | 1512 ASSERT(!obj.is_null()); |
| 1507 ASSERT(!(*obj)->IsUndefined()); | 1513 ASSERT(!(*obj)->IsUndefined()); |
| 1508 ASSERT(obj->IsSmi()); | 1514 ASSERT(obj->IsSmi()); |
| 1509 // Get the STUB key and extract major and minor key. | 1515 // Get the STUB key and extract major and minor key. |
| 1510 uint32_t key = Smi::cast(*obj)->value(); | 1516 uint32_t key = Smi::cast(*obj)->value(); |
| 1511 // Argc in the stub is the number of arguments passed - not the | 1517 // Argc in the stub is the number of arguments passed - not the |
| 1512 // expected arguments of the called function. | 1518 // expected arguments of the called function. |
| 1513 int call_function_arg_count = | 1519 int call_function_arg_count = is_call_ic |
| 1514 CallFunctionStub::ExtractArgcFromMinorKey( | 1520 ? CallICStub::ExtractArgcFromMinorKey(CodeStub::MinorKeyFromKey(key)) |
| 1521 : CallFunctionStub::ExtractArgcFromMinorKey( |
| 1515 CodeStub::MinorKeyFromKey(key)); | 1522 CodeStub::MinorKeyFromKey(key)); |
| 1516 ASSERT(call_function_stub->major_key() == | 1523 |
| 1517 CodeStub::MajorKeyFromKey(key)); | 1524 ASSERT(is_call_ic || |
| 1525 call_function_stub->major_key() == CodeStub::MajorKeyFromKey(key)); |
| 1518 | 1526 |
| 1519 // Find target function on the expression stack. | 1527 // Find target function on the expression stack. |
| 1520 // Expression stack looks like this (top to bottom): | 1528 // Expression stack looks like this (top to bottom): |
| 1521 // argN | 1529 // argN |
| 1522 // ... | 1530 // ... |
| 1523 // arg0 | 1531 // arg0 |
| 1524 // Receiver | 1532 // Receiver |
| 1525 // Function to call | 1533 // Function to call |
| 1526 int expressions_count = frame->ComputeExpressionsCount(); | 1534 int expressions_count = frame->ComputeExpressionsCount(); |
| 1527 ASSERT(expressions_count - 2 - call_function_arg_count >= 0); | 1535 ASSERT(expressions_count - 2 - call_function_arg_count >= 0); |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 | 1643 |
| 1636 | 1644 |
| 1637 // Find the builtin to use for invoking the debug break | 1645 // Find the builtin to use for invoking the debug break |
| 1638 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { | 1646 Handle<Code> Debug::FindDebugBreak(Handle<Code> code, RelocInfo::Mode mode) { |
| 1639 Isolate* isolate = code->GetIsolate(); | 1647 Isolate* isolate = code->GetIsolate(); |
| 1640 | 1648 |
| 1641 // Find the builtin debug break function matching the calling convention | 1649 // Find the builtin debug break function matching the calling convention |
| 1642 // used by the call site. | 1650 // used by the call site. |
| 1643 if (code->is_inline_cache_stub()) { | 1651 if (code->is_inline_cache_stub()) { |
| 1644 switch (code->kind()) { | 1652 switch (code->kind()) { |
| 1653 case Code::CALL_IC: |
| 1654 return isolate->builtins()->CallICStub_DebugBreak(); |
| 1655 |
| 1645 case Code::LOAD_IC: | 1656 case Code::LOAD_IC: |
| 1646 return isolate->builtins()->LoadIC_DebugBreak(); | 1657 return isolate->builtins()->LoadIC_DebugBreak(); |
| 1647 | 1658 |
| 1648 case Code::STORE_IC: | 1659 case Code::STORE_IC: |
| 1649 return isolate->builtins()->StoreIC_DebugBreak(); | 1660 return isolate->builtins()->StoreIC_DebugBreak(); |
| 1650 | 1661 |
| 1651 case Code::KEYED_LOAD_IC: | 1662 case Code::KEYED_LOAD_IC: |
| 1652 return isolate->builtins()->KeyedLoadIC_DebugBreak(); | 1663 return isolate->builtins()->KeyedLoadIC_DebugBreak(); |
| 1653 | 1664 |
| 1654 case Code::KEYED_STORE_IC: | 1665 case Code::KEYED_STORE_IC: |
| (...skipping 2148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3803 { | 3814 { |
| 3804 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3815 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3805 isolate_->debugger()->CallMessageDispatchHandler(); | 3816 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3806 } | 3817 } |
| 3807 } | 3818 } |
| 3808 } | 3819 } |
| 3809 | 3820 |
| 3810 #endif // ENABLE_DEBUGGER_SUPPORT | 3821 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3811 | 3822 |
| 3812 } } // namespace v8::internal | 3823 } } // namespace v8::internal |
| OLD | NEW |