| 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 BreakLocationIterator::~BreakLocationIterator() { | 115 BreakLocationIterator::~BreakLocationIterator() { |
| 116 ASSERT(reloc_iterator_ != NULL); | 116 ASSERT(reloc_iterator_ != NULL); |
| 117 ASSERT(reloc_iterator_original_ != NULL); | 117 ASSERT(reloc_iterator_original_ != NULL); |
| 118 delete reloc_iterator_; | 118 delete reloc_iterator_; |
| 119 delete reloc_iterator_original_; | 119 delete reloc_iterator_original_; |
| 120 } | 120 } |
| 121 | 121 |
| 122 | 122 |
| 123 void BreakLocationIterator::Next() { | 123 void BreakLocationIterator::Next() { |
| 124 AssertNoAllocation nogc; | 124 DisallowHeapAllocation no_gc; |
| 125 ASSERT(!RinfoDone()); | 125 ASSERT(!RinfoDone()); |
| 126 | 126 |
| 127 // Iterate through reloc info for code and original code stopping at each | 127 // Iterate through reloc info for code and original code stopping at each |
| 128 // breakable code target. | 128 // breakable code target. |
| 129 bool first = break_point_ == -1; | 129 bool first = break_point_ == -1; |
| 130 while (!RinfoDone()) { | 130 while (!RinfoDone()) { |
| 131 if (!first) RinfoNext(); | 131 if (!first) RinfoNext(); |
| 132 first = false; | 132 first = false; |
| 133 if (RinfoDone()) return; | 133 if (RinfoDone()) return; |
| 134 | 134 |
| (...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2018 | 2018 |
| 2019 { | 2019 { |
| 2020 // We are going to iterate heap to find all functions without | 2020 // We are going to iterate heap to find all functions without |
| 2021 // debug break slots. | 2021 // debug break slots. |
| 2022 Heap* heap = isolate_->heap(); | 2022 Heap* heap = isolate_->heap(); |
| 2023 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 2023 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 2024 "preparing for breakpoints"); | 2024 "preparing for breakpoints"); |
| 2025 | 2025 |
| 2026 // Ensure no GC in this scope as we are going to use gc_metadata | 2026 // Ensure no GC in this scope as we are going to use gc_metadata |
| 2027 // field in the Code object to mark active functions. | 2027 // field in the Code object to mark active functions. |
| 2028 AssertNoAllocation no_allocation; | 2028 DisallowHeapAllocation no_allocation; |
| 2029 | 2029 |
| 2030 Object* active_code_marker = heap->the_hole_value(); | 2030 Object* active_code_marker = heap->the_hole_value(); |
| 2031 | 2031 |
| 2032 CollectActiveFunctionsFromThread(isolate_, | 2032 CollectActiveFunctionsFromThread(isolate_, |
| 2033 isolate_->thread_local_top(), | 2033 isolate_->thread_local_top(), |
| 2034 &active_functions, | 2034 &active_functions, |
| 2035 active_code_marker); | 2035 active_code_marker); |
| 2036 ActiveFunctionsCollector active_functions_collector(&active_functions, | 2036 ActiveFunctionsCollector active_functions_collector(&active_functions, |
| 2037 active_code_marker); | 2037 active_code_marker); |
| 2038 isolate_->thread_manager()->IterateArchivedThreads( | 2038 isolate_->thread_manager()->IterateArchivedThreads( |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2133 // will be triggered at points where we do not need a context. | 2133 // will be triggered at points where we do not need a context. |
| 2134 bool done = false; | 2134 bool done = false; |
| 2135 // The current candidate for the source position: | 2135 // The current candidate for the source position: |
| 2136 int target_start_position = RelocInfo::kNoPosition; | 2136 int target_start_position = RelocInfo::kNoPosition; |
| 2137 Handle<JSFunction> target_function; | 2137 Handle<JSFunction> target_function; |
| 2138 Handle<SharedFunctionInfo> target; | 2138 Handle<SharedFunctionInfo> target; |
| 2139 Heap* heap = isolate_->heap(); | 2139 Heap* heap = isolate_->heap(); |
| 2140 while (!done) { | 2140 while (!done) { |
| 2141 { // Extra scope for iterator and no-allocation. | 2141 { // Extra scope for iterator and no-allocation. |
| 2142 heap->EnsureHeapIsIterable(); | 2142 heap->EnsureHeapIsIterable(); |
| 2143 AssertNoAllocation no_alloc_during_heap_iteration; | 2143 DisallowHeapAllocation no_alloc_during_heap_iteration; |
| 2144 HeapIterator iterator(heap); | 2144 HeapIterator iterator(heap); |
| 2145 for (HeapObject* obj = iterator.next(); | 2145 for (HeapObject* obj = iterator.next(); |
| 2146 obj != NULL; obj = iterator.next()) { | 2146 obj != NULL; obj = iterator.next()) { |
| 2147 bool found_next_candidate = false; | 2147 bool found_next_candidate = false; |
| 2148 Handle<JSFunction> function; | 2148 Handle<JSFunction> function; |
| 2149 Handle<SharedFunctionInfo> shared; | 2149 Handle<SharedFunctionInfo> shared; |
| 2150 if (obj->IsJSFunction()) { | 2150 if (obj->IsJSFunction()) { |
| 2151 function = Handle<JSFunction>(JSFunction::cast(obj)); | 2151 function = Handle<JSFunction>(JSFunction::cast(obj)); |
| 2152 shared = Handle<SharedFunctionInfo>(function->shared()); | 2152 shared = Handle<SharedFunctionInfo>(function->shared()); |
| 2153 ASSERT(shared->allows_lazy_compilation() || shared->is_compiled()); | 2153 ASSERT(shared->allows_lazy_compilation() || shared->is_compiled()); |
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2469 heap->CollectAllGarbage(Heap::kNoGCFlags, "Debug::CreateScriptCache"); | 2469 heap->CollectAllGarbage(Heap::kNoGCFlags, "Debug::CreateScriptCache"); |
| 2470 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 2470 heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 2471 "Debug::CreateScriptCache"); | 2471 "Debug::CreateScriptCache"); |
| 2472 | 2472 |
| 2473 ASSERT(script_cache_ == NULL); | 2473 ASSERT(script_cache_ == NULL); |
| 2474 script_cache_ = new ScriptCache(); | 2474 script_cache_ = new ScriptCache(); |
| 2475 | 2475 |
| 2476 // Scan heap for Script objects. | 2476 // Scan heap for Script objects. |
| 2477 int count = 0; | 2477 int count = 0; |
| 2478 HeapIterator iterator(heap); | 2478 HeapIterator iterator(heap); |
| 2479 AssertNoAllocation no_allocation; | 2479 DisallowHeapAllocation no_allocation; |
| 2480 | 2480 |
| 2481 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { | 2481 for (HeapObject* obj = iterator.next(); obj != NULL; obj = iterator.next()) { |
| 2482 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { | 2482 if (obj->IsScript() && Script::cast(obj)->HasValidSource()) { |
| 2483 script_cache_->Add(Handle<Script>(Script::cast(obj))); | 2483 script_cache_->Add(Handle<Script>(Script::cast(obj))); |
| 2484 count++; | 2484 count++; |
| 2485 } | 2485 } |
| 2486 } | 2486 } |
| 2487 } | 2487 } |
| 2488 | 2488 |
| 2489 | 2489 |
| (...skipping 1308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3798 { | 3798 { |
| 3799 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); | 3799 Locker locker(reinterpret_cast<v8::Isolate*>(isolate_)); |
| 3800 isolate_->debugger()->CallMessageDispatchHandler(); | 3800 isolate_->debugger()->CallMessageDispatchHandler(); |
| 3801 } | 3801 } |
| 3802 } | 3802 } |
| 3803 } | 3803 } |
| 3804 | 3804 |
| 3805 #endif // ENABLE_DEBUGGER_SUPPORT | 3805 #endif // ENABLE_DEBUGGER_SUPPORT |
| 3806 | 3806 |
| 3807 } } // namespace v8::internal | 3807 } } // namespace v8::internal |
| OLD | NEW |