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 1311 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1322 "prepare for break points"); | 1322 "prepare for break points"); |
1323 | 1323 |
1324 bool is_interpreted = shared->HasBytecodeArray(); | 1324 bool is_interpreted = shared->HasBytecodeArray(); |
1325 | 1325 |
1326 { | 1326 { |
1327 // TODO(yangguo): with bytecode, we still walk the heap to find all | 1327 // TODO(yangguo): with bytecode, we still walk the heap to find all |
1328 // optimized code for the function to deoptimize. We can probably be | 1328 // optimized code for the function to deoptimize. We can probably be |
1329 // smarter here and avoid the heap walk. | 1329 // smarter here and avoid the heap walk. |
1330 HeapIterator iterator(isolate_->heap()); | 1330 HeapIterator iterator(isolate_->heap()); |
1331 HeapObject* obj; | 1331 HeapObject* obj; |
1332 bool include_generators = !is_interpreted && shared->is_generator(); | 1332 bool include_generators = !is_interpreted && shared->is_resumable(); |
Yang
2016/05/30 12:32:46
how about we rename "include_generators" to "find_
Dan Ehrenberg
2016/05/31 08:53:37
Good idea, done.
| |
1333 | 1333 |
1334 while ((obj = iterator.next())) { | 1334 while ((obj = iterator.next())) { |
1335 if (obj->IsJSFunction()) { | 1335 if (obj->IsJSFunction()) { |
1336 JSFunction* function = JSFunction::cast(obj); | 1336 JSFunction* function = JSFunction::cast(obj); |
1337 if (!function->Inlines(*shared)) continue; | 1337 if (!function->Inlines(*shared)) continue; |
1338 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { | 1338 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { |
1339 Deoptimizer::DeoptimizeFunction(function); | 1339 Deoptimizer::DeoptimizeFunction(function); |
1340 } | 1340 } |
1341 if (is_interpreted) continue; | 1341 if (is_interpreted) continue; |
1342 if (function->shared() == *shared) functions.Add(handle(function)); | 1342 if (function->shared() == *shared) functions.Add(handle(function)); |
1343 } else if (include_generators && obj->IsJSGeneratorObject()) { | 1343 } else if (include_generators && obj->IsJSGeneratorObject()) { |
1344 // This case handles async functions as well, as they use generator | |
1345 // objects for in-progress async function execution. | |
1344 JSGeneratorObject* generator_obj = JSGeneratorObject::cast(obj); | 1346 JSGeneratorObject* generator_obj = JSGeneratorObject::cast(obj); |
1345 if (!generator_obj->is_suspended()) continue; | 1347 if (!generator_obj->is_suspended()) continue; |
1346 JSFunction* function = generator_obj->function(); | 1348 JSFunction* function = generator_obj->function(); |
1347 if (!function->Inlines(*shared)) continue; | 1349 if (!function->Inlines(*shared)) continue; |
1348 int pc_offset = generator_obj->continuation(); | 1350 int pc_offset = generator_obj->continuation(); |
1349 int index = | 1351 int index = |
1350 ComputeContinuationIndexFromPcOffset(function->code(), pc_offset); | 1352 ComputeContinuationIndexFromPcOffset(function->code(), pc_offset); |
1351 generator_obj->set_continuation(index); | 1353 generator_obj->set_continuation(index); |
1352 suspended_generators.Add(handle(generator_obj)); | 1354 suspended_generators.Add(handle(generator_obj)); |
1353 } | 1355 } |
(...skipping 1231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2585 } | 2587 } |
2586 | 2588 |
2587 | 2589 |
2588 void LockingCommandMessageQueue::Clear() { | 2590 void LockingCommandMessageQueue::Clear() { |
2589 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2591 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2590 queue_.Clear(); | 2592 queue_.Clear(); |
2591 } | 2593 } |
2592 | 2594 |
2593 } // namespace internal | 2595 } // namespace internal |
2594 } // namespace v8 | 2596 } // namespace v8 |
OLD | NEW |