| 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 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 // Restore the code in the break slot. | 383 // Restore the code in the break slot. |
| 384 ClearDebugBreakAtSlot(); | 384 ClearDebugBreakAtSlot(); |
| 385 } else { | 385 } else { |
| 386 // Patch the IC call. | 386 // Patch the IC call. |
| 387 ClearDebugBreakAtIC(); | 387 ClearDebugBreakAtIC(); |
| 388 } | 388 } |
| 389 ASSERT(!IsDebugBreak()); | 389 ASSERT(!IsDebugBreak()); |
| 390 } | 390 } |
| 391 | 391 |
| 392 | 392 |
| 393 bool BreakLocationIterator::IsStepInLocation(Isolate* isolate) { |
| 394 if (RelocInfo::IsConstructCall(rmode())) { |
| 395 return true; |
| 396 } else if (RelocInfo::IsCodeTarget(rmode())) { |
| 397 HandleScope scope(debug_info_->GetIsolate()); |
| 398 Address target = rinfo()->target_address(); |
| 399 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); |
| 400 return target_code->is_call_stub() || target_code->is_keyed_call_stub(); |
| 401 } else { |
| 402 return false; |
| 403 } |
| 404 } |
| 405 |
| 406 |
| 393 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { | 407 void BreakLocationIterator::PrepareStepIn(Isolate* isolate) { |
| 394 HandleScope scope(isolate); | 408 HandleScope scope(isolate); |
| 395 | 409 |
| 396 // Step in can only be prepared if currently positioned on an IC call, | 410 // Step in can only be prepared if currently positioned on an IC call, |
| 397 // construct call or CallFunction stub call. | 411 // construct call or CallFunction stub call. |
| 398 Address target = rinfo()->target_address(); | 412 Address target = rinfo()->target_address(); |
| 399 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); | 413 Handle<Code> target_code(Code::GetCodeFromTargetAddress(target)); |
| 400 if (target_code->is_call_stub() || target_code->is_keyed_call_stub()) { | 414 if (target_code->is_call_stub() || target_code->is_keyed_call_stub()) { |
| 401 // Step in through IC call is handled by the runtime system. Therefore make | 415 // Step in through IC call is handled by the runtime system. Therefore make |
| 402 // sure that the any current IC is cleared and the runtime system is | 416 // sure that the any current IC is cleared and the runtime system is |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 return reinterpret_cast<Object**>(&Memory::Object_at( | 613 return reinterpret_cast<Object**>(&Memory::Object_at( |
| 600 fp + StandardFrameConstants::kContextOffset)); | 614 fp + StandardFrameConstants::kContextOffset)); |
| 601 } | 615 } |
| 602 | 616 |
| 603 const int Debug::kFrameDropperFrameSize = 4; | 617 const int Debug::kFrameDropperFrameSize = 4; |
| 604 | 618 |
| 605 | 619 |
| 606 void ScriptCache::Add(Handle<Script> script) { | 620 void ScriptCache::Add(Handle<Script> script) { |
| 607 GlobalHandles* global_handles = Isolate::Current()->global_handles(); | 621 GlobalHandles* global_handles = Isolate::Current()->global_handles(); |
| 608 // Create an entry in the hash map for the script. | 622 // Create an entry in the hash map for the script. |
| 609 int id = Smi::cast(script->id())->value(); | 623 int id = script->id()->value(); |
| 610 HashMap::Entry* entry = | 624 HashMap::Entry* entry = |
| 611 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); | 625 HashMap::Lookup(reinterpret_cast<void*>(id), Hash(id), true); |
| 612 if (entry->value != NULL) { | 626 if (entry->value != NULL) { |
| 613 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); | 627 ASSERT(*script == *reinterpret_cast<Script**>(entry->value)); |
| 614 return; | 628 return; |
| 615 } | 629 } |
| 616 // Globalize the script object, make it weak and use the location of the | 630 // Globalize the script object, make it weak and use the location of the |
| 617 // global handle as the value in the hash map. | 631 // global handle as the value in the hash map. |
| 618 Handle<Script> script_ = | 632 Handle<Script> script_ = |
| 619 Handle<Script>::cast( | 633 Handle<Script>::cast( |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 667 void ScriptCache::HandleWeakScript(v8::Isolate* isolate, | 681 void ScriptCache::HandleWeakScript(v8::Isolate* isolate, |
| 668 v8::Persistent<v8::Value>* obj, | 682 v8::Persistent<v8::Value>* obj, |
| 669 void* data) { | 683 void* data) { |
| 670 ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data); | 684 ScriptCache* script_cache = reinterpret_cast<ScriptCache*>(data); |
| 671 // Find the location of the global handle. | 685 // Find the location of the global handle. |
| 672 Script** location = | 686 Script** location = |
| 673 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location()); | 687 reinterpret_cast<Script**>(Utils::OpenPersistent(*obj).location()); |
| 674 ASSERT((*location)->IsScript()); | 688 ASSERT((*location)->IsScript()); |
| 675 | 689 |
| 676 // Remove the entry from the cache. | 690 // Remove the entry from the cache. |
| 677 int id = Smi::cast((*location)->id())->value(); | 691 int id = (*location)->id()->value(); |
| 678 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); | 692 script_cache->Remove(reinterpret_cast<void*>(id), Hash(id)); |
| 679 script_cache->collected_scripts_.Add(id); | 693 script_cache->collected_scripts_.Add(id); |
| 680 | 694 |
| 681 // Clear the weak handle. | 695 // Clear the weak handle. |
| 682 obj->Dispose(isolate); | 696 obj->Dispose(isolate); |
| 683 } | 697 } |
| 684 | 698 |
| 685 | 699 |
| 686 void Debug::SetUp(bool create_heap_objects) { | 700 void Debug::SetUp(bool create_heap_objects) { |
| 687 ThreadInit(); | 701 ThreadInit(); |
| (...skipping 3112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3800 { | 3814 { |
| 3801 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3815 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3802 isolate_->debugger()->CallMessageDispatchHandler(); | 3816 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3803 } | 3817 } |
| 3804 } | 3818 } |
| 3805 } | 3819 } |
| 3806 | 3820 |
| 3807 #endif // ENABLE_DEBUGGER_SUPPORT | 3821 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3808 | 3822 |
| 3809 } } // namespace v8::internal | 3823 } } // namespace v8::internal |
| OLD | NEW |