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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "src/api.h" | 9 #include "src/api.h" |
10 #include "src/arguments.h" | 10 #include "src/arguments.h" |
(...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 DCHECK(shared->is_compiled()); | 1287 DCHECK(shared->is_compiled()); |
1288 bool baseline_exists = shared->HasBaselineCode(); | 1288 bool baseline_exists = shared->HasBaselineCode(); |
1289 | 1289 |
1290 { | 1290 { |
1291 // TODO(yangguo): with bytecode, we still walk the heap to find all | 1291 // TODO(yangguo): with bytecode, we still walk the heap to find all |
1292 // optimized code for the function to deoptimize. We can probably be | 1292 // optimized code for the function to deoptimize. We can probably be |
1293 // smarter here and avoid the heap walk. | 1293 // smarter here and avoid the heap walk. |
1294 HeapIterator iterator(isolate_->heap()); | 1294 HeapIterator iterator(isolate_->heap()); |
1295 HeapObject* obj; | 1295 HeapObject* obj; |
1296 // Continuation from old-style generators need to be recomputed. | 1296 // Continuation from old-style generators need to be recomputed. |
1297 bool find_resumables = baseline_exists && shared->is_resumable(); | 1297 bool find_resumables = |
| 1298 baseline_exists && IsResumableFunction(shared->kind()); |
1298 | 1299 |
1299 while ((obj = iterator.next())) { | 1300 while ((obj = iterator.next())) { |
1300 if (obj->IsJSFunction()) { | 1301 if (obj->IsJSFunction()) { |
1301 JSFunction* function = JSFunction::cast(obj); | 1302 JSFunction* function = JSFunction::cast(obj); |
1302 if (!function->Inlines(*shared)) continue; | 1303 if (!function->Inlines(*shared)) continue; |
1303 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { | 1304 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { |
1304 Deoptimizer::DeoptimizeFunction(function); | 1305 Deoptimizer::DeoptimizeFunction(function); |
1305 } | 1306 } |
1306 if (baseline_exists && function->shared() == *shared) { | 1307 if (baseline_exists && function->shared() == *shared) { |
1307 functions.Add(handle(function)); | 1308 functions.Add(handle(function)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1346 // Update PCs on the stack to point to recompiled code. | 1347 // Update PCs on the stack to point to recompiled code. |
1347 RedirectActiveFunctions redirect_visitor(*shared); | 1348 RedirectActiveFunctions redirect_visitor(*shared); |
1348 redirect_visitor.VisitThread(isolate_, isolate_->thread_local_top()); | 1349 redirect_visitor.VisitThread(isolate_, isolate_->thread_local_top()); |
1349 isolate_->thread_manager()->IterateArchivedThreads(&redirect_visitor); | 1350 isolate_->thread_manager()->IterateArchivedThreads(&redirect_visitor); |
1350 | 1351 |
1351 return true; | 1352 return true; |
1352 } | 1353 } |
1353 | 1354 |
1354 void Debug::RecordAsyncFunction(Handle<JSGeneratorObject> generator_object) { | 1355 void Debug::RecordAsyncFunction(Handle<JSGeneratorObject> generator_object) { |
1355 if (last_step_action() <= StepOut) return; | 1356 if (last_step_action() <= StepOut) return; |
1356 if (!generator_object->function()->shared()->is_async()) return; | 1357 if (!IsAsyncFunction(generator_object->function()->shared()->kind())) return; |
1357 DCHECK(!has_suspended_generator()); | 1358 DCHECK(!has_suspended_generator()); |
1358 thread_local_.suspended_generator_ = *generator_object; | 1359 thread_local_.suspended_generator_ = *generator_object; |
1359 ClearStepping(); | 1360 ClearStepping(); |
1360 } | 1361 } |
1361 | 1362 |
1362 class SharedFunctionInfoFinder { | 1363 class SharedFunctionInfoFinder { |
1363 public: | 1364 public: |
1364 explicit SharedFunctionInfoFinder(int target_position) | 1365 explicit SharedFunctionInfoFinder(int target_position) |
1365 : current_candidate_(NULL), | 1366 : current_candidate_(NULL), |
1366 current_candidate_closure_(NULL), | 1367 current_candidate_closure_(NULL), |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2557 } | 2558 } |
2558 | 2559 |
2559 | 2560 |
2560 void LockingCommandMessageQueue::Clear() { | 2561 void LockingCommandMessageQueue::Clear() { |
2561 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2562 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2562 queue_.Clear(); | 2563 queue_.Clear(); |
2563 } | 2564 } |
2564 | 2565 |
2565 } // namespace internal | 2566 } // namespace internal |
2566 } // namespace v8 | 2567 } // namespace v8 |
OLD | NEW |