OLD | NEW |
---|---|
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/debug/debug.h" | 5 #include "src/debug/debug.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 1287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1298 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { | 1298 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
1299 DCHECK(shared->is_compiled()); | 1299 DCHECK(shared->is_compiled()); |
1300 | 1300 |
1301 if (isolate_->concurrent_recompilation_enabled()) { | 1301 if (isolate_->concurrent_recompilation_enabled()) { |
1302 isolate_->optimizing_compile_dispatcher()->Flush(); | 1302 isolate_->optimizing_compile_dispatcher()->Flush(); |
1303 } | 1303 } |
1304 | 1304 |
1305 List<Handle<JSFunction> > functions; | 1305 List<Handle<JSFunction> > functions; |
1306 List<Handle<JSGeneratorObject> > suspended_generators; | 1306 List<Handle<JSGeneratorObject> > suspended_generators; |
1307 | 1307 |
1308 if (!shared->optimized_code_map()->IsSmi()) { | 1308 // Flush all optimized code maps. Only flushing the optimized code map of the |
1309 shared->ClearOptimizedCodeMap(); | 1309 // give shared function info {shared} is not enough, because other functions |
1310 // might have inlined the given function and don't contain breakpoints. | |
Yang
2015/11/05 18:46:49
See below. We already deal with inlining.
| |
1311 { | |
1312 SharedFunctionInfo::Iterator iterator(isolate_); | |
1313 while (SharedFunctionInfo* shared = iterator.Next()) { | |
1314 if (!shared->optimized_code_map()->IsSmi()) { | |
1315 shared->ClearOptimizedCodeMap(); | |
1316 } | |
1317 } | |
1310 } | 1318 } |
1311 | 1319 |
1312 // Make sure we abort incremental marking. | 1320 // Make sure we abort incremental marking. |
1313 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1321 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
1314 "prepare for break points"); | 1322 "prepare for break points"); |
1315 | 1323 |
1316 { | 1324 { |
1317 HeapIterator iterator(isolate_->heap()); | 1325 HeapIterator iterator(isolate_->heap()); |
1318 HeapObject* obj; | 1326 HeapObject* obj; |
1319 bool include_generators = shared->is_generator(); | 1327 bool include_generators = shared->is_generator(); |
1320 | 1328 |
1321 while ((obj = iterator.next())) { | 1329 while ((obj = iterator.next())) { |
1322 if (obj->IsJSFunction()) { | 1330 if (obj->IsJSFunction()) { |
1323 JSFunction* function = JSFunction::cast(obj); | 1331 JSFunction* function = JSFunction::cast(obj); |
1324 if (!function->Inlines(*shared)) continue; | 1332 if (!function->Inlines(*shared)) continue; |
1325 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { | 1333 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { |
1326 Deoptimizer::DeoptimizeFunction(function); | 1334 Deoptimizer::DeoptimizeFunction(function); |
1327 } | 1335 } |
1328 if (function->shared() == *shared) functions.Add(handle(function)); | 1336 if (function->shared() == *shared) functions.Add(handle(function)); |
1329 } else if (include_generators && obj->IsJSGeneratorObject()) { | 1337 } else if (include_generators && obj->IsJSGeneratorObject()) { |
1330 JSGeneratorObject* generator_obj = JSGeneratorObject::cast(obj); | 1338 JSGeneratorObject* generator_obj = JSGeneratorObject::cast(obj); |
1331 if (!generator_obj->is_suspended()) continue; | 1339 if (!generator_obj->is_suspended()) continue; |
1332 JSFunction* function = generator_obj->function(); | 1340 JSFunction* function = generator_obj->function(); |
1333 if (!function->Inlines(*shared)) continue; | 1341 if (!function->Inlines(*shared)) continue; |
Yang
2015/11/05 18:46:49
We check for functions that inlines this function,
Michael Starzinger
2015/11/05 18:54:35
Yes, but if there is no closure (i.e. JSFunction)
| |
1334 int pc_offset = generator_obj->continuation(); | 1342 int pc_offset = generator_obj->continuation(); |
1335 int index = | 1343 int index = |
1336 ComputeContinuationIndexFromPcOffset(function->code(), pc_offset); | 1344 ComputeContinuationIndexFromPcOffset(function->code(), pc_offset); |
1337 generator_obj->set_continuation(index); | 1345 generator_obj->set_continuation(index); |
1338 suspended_generators.Add(handle(generator_obj)); | 1346 suspended_generators.Add(handle(generator_obj)); |
1339 } | 1347 } |
1340 } | 1348 } |
1341 } | 1349 } |
1342 | 1350 |
1343 if (!shared->HasDebugCode()) { | 1351 if (!shared->HasDebugCode()) { |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2581 } | 2589 } |
2582 | 2590 |
2583 | 2591 |
2584 void LockingCommandMessageQueue::Clear() { | 2592 void LockingCommandMessageQueue::Clear() { |
2585 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2593 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2586 queue_.Clear(); | 2594 queue_.Clear(); |
2587 } | 2595 } |
2588 | 2596 |
2589 } // namespace internal | 2597 } // namespace internal |
2590 } // namespace v8 | 2598 } // namespace v8 |
OLD | NEW |