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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1284 DCHECK(shared->is_compiled()); | 1284 DCHECK(shared->is_compiled()); |
1285 bool baseline_exists = shared->HasBaselineCode(); | 1285 bool baseline_exists = shared->HasBaselineCode(); |
1286 | 1286 |
1287 { | 1287 { |
1288 // TODO(yangguo): with bytecode, we still walk the heap to find all | 1288 // TODO(yangguo): with bytecode, we still walk the heap to find all |
1289 // optimized code for the function to deoptimize. We can probably be | 1289 // optimized code for the function to deoptimize. We can probably be |
1290 // smarter here and avoid the heap walk. | 1290 // smarter here and avoid the heap walk. |
1291 HeapIterator iterator(isolate_->heap()); | 1291 HeapIterator iterator(isolate_->heap()); |
1292 HeapObject* obj; | 1292 HeapObject* obj; |
1293 | 1293 |
1294 while ((obj = iterator.next())) { | 1294 while ((obj = iterator.next()) != nullptr) { |
1295 if (obj->IsJSFunction()) { | 1295 if (obj->IsJSFunction()) { |
1296 JSFunction* function = JSFunction::cast(obj); | 1296 JSFunction* function = JSFunction::cast(obj); |
1297 if (!function->Inlines(*shared)) continue; | 1297 if (!function->Inlines(*shared)) continue; |
1298 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { | 1298 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { |
1299 Deoptimizer::DeoptimizeFunction(function); | 1299 Deoptimizer::DeoptimizeFunction(function); |
1300 } | 1300 } |
1301 if (baseline_exists && function->shared() == *shared) { | 1301 if (baseline_exists && function->shared() == *shared) { |
1302 functions.Add(handle(function)); | 1302 functions.Add(handle(function)); |
1303 } | 1303 } |
1304 } | 1304 } |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1630 if (!factory->script_list()->IsWeakFixedArray()) { | 1630 if (!factory->script_list()->IsWeakFixedArray()) { |
1631 return factory->empty_fixed_array(); | 1631 return factory->empty_fixed_array(); |
1632 } | 1632 } |
1633 Handle<WeakFixedArray> array = | 1633 Handle<WeakFixedArray> array = |
1634 Handle<WeakFixedArray>::cast(factory->script_list()); | 1634 Handle<WeakFixedArray>::cast(factory->script_list()); |
1635 Handle<FixedArray> results = factory->NewFixedArray(array->Length()); | 1635 Handle<FixedArray> results = factory->NewFixedArray(array->Length()); |
1636 int length = 0; | 1636 int length = 0; |
1637 { | 1637 { |
1638 Script::Iterator iterator(isolate_); | 1638 Script::Iterator iterator(isolate_); |
1639 Script* script; | 1639 Script* script; |
1640 while ((script = iterator.Next())) { | 1640 while ((script = iterator.Next()) != nullptr) { |
1641 if (script->HasValidSource()) results->set(length++, script); | 1641 if (script->HasValidSource()) results->set(length++, script); |
1642 } | 1642 } |
1643 } | 1643 } |
1644 results->Shrink(length); | 1644 results->Shrink(length); |
1645 return results; | 1645 return results; |
1646 } | 1646 } |
1647 | 1647 |
1648 | 1648 |
1649 MaybeHandle<Object> Debug::MakeExecutionState() { | 1649 MaybeHandle<Object> Debug::MakeExecutionState() { |
1650 // Create the execution state object. | 1650 // Create the execution state object. |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2456 isolate_->Throw(*isolate_->factory()->NewEvalError( | 2456 isolate_->Throw(*isolate_->factory()->NewEvalError( |
2457 MessageTemplate::kNoSideEffectDebugEvaluate)); | 2457 MessageTemplate::kNoSideEffectDebugEvaluate)); |
2458 } | 2458 } |
2459 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); | 2459 isolate_->set_needs_side_effect_check(old_needs_side_effect_check_); |
2460 isolate_->debug()->UpdateHookOnFunctionCall(); | 2460 isolate_->debug()->UpdateHookOnFunctionCall(); |
2461 isolate_->debug()->side_effect_check_failed_ = false; | 2461 isolate_->debug()->side_effect_check_failed_ = false; |
2462 } | 2462 } |
2463 | 2463 |
2464 } // namespace internal | 2464 } // namespace internal |
2465 } // namespace v8 | 2465 } // namespace v8 |
OLD | NEW |