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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 Handle<Script>::cast( | 618 Handle<Script>::cast( |
619 (global_handles->Create(*script))); | 619 (global_handles->Create(*script))); |
620 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), | 620 global_handles->MakeWeak(reinterpret_cast<Object**>(script_.location()), |
621 this, | 621 this, |
622 ScriptCache::HandleWeakScript); | 622 ScriptCache::HandleWeakScript); |
623 entry->value = script_.location(); | 623 entry->value = script_.location(); |
624 } | 624 } |
625 | 625 |
626 | 626 |
627 Handle<FixedArray> ScriptCache::GetScripts() { | 627 Handle<FixedArray> ScriptCache::GetScripts() { |
628 Handle<FixedArray> instances = FACTORY->NewFixedArray(occupancy()); | 628 Factory* factory = Isolate::Current()->factory(); |
| 629 Handle<FixedArray> instances = factory->NewFixedArray(occupancy()); |
629 int count = 0; | 630 int count = 0; |
630 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { | 631 for (HashMap::Entry* entry = Start(); entry != NULL; entry = Next(entry)) { |
631 ASSERT(entry->value != NULL); | 632 ASSERT(entry->value != NULL); |
632 if (entry->value != NULL) { | 633 if (entry->value != NULL) { |
633 instances->set(count, *reinterpret_cast<Script**>(entry->value)); | 634 instances->set(count, *reinterpret_cast<Script**>(entry->value)); |
634 count++; | 635 count++; |
635 } | 636 } |
636 } | 637 } |
637 return instances; | 638 return instances; |
638 } | 639 } |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
780 0, | 781 0, |
781 NULL, | 782 NULL, |
782 &caught_exception); | 783 &caught_exception); |
783 | 784 |
784 // Check for caught exceptions. | 785 // Check for caught exceptions. |
785 if (caught_exception) { | 786 if (caught_exception) { |
786 ASSERT(!isolate->has_pending_exception()); | 787 ASSERT(!isolate->has_pending_exception()); |
787 MessageLocation computed_location; | 788 MessageLocation computed_location; |
788 isolate->ComputeLocation(&computed_location); | 789 isolate->ComputeLocation(&computed_location); |
789 Handle<Object> message = MessageHandler::MakeMessageObject( | 790 Handle<Object> message = MessageHandler::MakeMessageObject( |
790 "error_loading_debugger", &computed_location, | 791 isolate, "error_loading_debugger", &computed_location, |
791 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>()); | 792 Vector<Handle<Object> >::empty(), Handle<String>(), Handle<JSArray>()); |
792 ASSERT(!isolate->has_pending_exception()); | 793 ASSERT(!isolate->has_pending_exception()); |
793 if (!exception.is_null()) { | 794 if (!exception.is_null()) { |
794 isolate->set_pending_exception(*exception); | 795 isolate->set_pending_exception(*exception); |
795 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); | 796 MessageHandler::ReportMessage(Isolate::Current(), NULL, message); |
796 isolate->clear_pending_exception(); | 797 isolate->clear_pending_exception(); |
797 } | 798 } |
798 return false; | 799 return false; |
799 } | 800 } |
800 | 801 |
(...skipping 1418 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2219 } | 2220 } |
2220 } // End while loop. | 2221 } // End while loop. |
2221 | 2222 |
2222 return *target; | 2223 return *target; |
2223 } | 2224 } |
2224 | 2225 |
2225 | 2226 |
2226 // Ensures the debug information is present for shared. | 2227 // Ensures the debug information is present for shared. |
2227 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, | 2228 bool Debug::EnsureDebugInfo(Handle<SharedFunctionInfo> shared, |
2228 Handle<JSFunction> function) { | 2229 Handle<JSFunction> function) { |
| 2230 Isolate* isolate = shared->GetIsolate(); |
| 2231 |
2229 // Return if we already have the debug info for shared. | 2232 // Return if we already have the debug info for shared. |
2230 if (HasDebugInfo(shared)) { | 2233 if (HasDebugInfo(shared)) { |
2231 ASSERT(shared->is_compiled()); | 2234 ASSERT(shared->is_compiled()); |
2232 return true; | 2235 return true; |
2233 } | 2236 } |
2234 | 2237 |
2235 // There will be at least one break point when we are done. | 2238 // There will be at least one break point when we are done. |
2236 has_break_points_ = true; | 2239 has_break_points_ = true; |
2237 | 2240 |
2238 // Ensure function is compiled. Return false if this failed. | 2241 // Ensure function is compiled. Return false if this failed. |
2239 if (!function.is_null() && | 2242 if (!function.is_null() && |
2240 !JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION)) { | 2243 !JSFunction::EnsureCompiled(function, CLEAR_EXCEPTION)) { |
2241 return false; | 2244 return false; |
2242 } | 2245 } |
2243 | 2246 |
2244 // Create the debug info object. | 2247 // Create the debug info object. |
2245 Handle<DebugInfo> debug_info = FACTORY->NewDebugInfo(shared); | 2248 Handle<DebugInfo> debug_info = isolate->factory()->NewDebugInfo(shared); |
2246 | 2249 |
2247 // Add debug info to the list. | 2250 // Add debug info to the list. |
2248 DebugInfoListNode* node = new DebugInfoListNode(*debug_info); | 2251 DebugInfoListNode* node = new DebugInfoListNode(*debug_info); |
2249 node->set_next(debug_info_list_); | 2252 node->set_next(debug_info_list_); |
2250 debug_info_list_ = node; | 2253 debug_info_list_ = node; |
2251 | 2254 |
2252 return true; | 2255 return true; |
2253 } | 2256 } |
2254 | 2257 |
2255 | 2258 |
(...skipping 1539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3795 { | 3798 { |
3796 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3799 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
3797 isolate_->debugger()->CallMessageDispatchHandler(); | 3800 isolate_->debugger()->CallMessageDispatchHandler(); |
3798 } | 3801 } |
3799 } | 3802 } |
3800 } | 3803 } |
3801 | 3804 |
3802 #endif // ENABLE_DEBUGGER_SUPPORT | 3805 #endif // ENABLE_DEBUGGER_SUPPORT |
3803 | 3806 |
3804 } } // namespace v8::internal | 3807 } } // namespace v8::internal |
OLD | NEW |