| 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 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1120 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { | 1120 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
| 1121 DCHECK(shared->is_compiled()); | 1121 DCHECK(shared->is_compiled()); |
| 1122 | 1122 |
| 1123 if (isolate_->concurrent_recompilation_enabled()) { | 1123 if (isolate_->concurrent_recompilation_enabled()) { |
| 1124 isolate_->optimizing_compile_dispatcher()->Flush(); | 1124 isolate_->optimizing_compile_dispatcher()->Flush(); |
| 1125 } | 1125 } |
| 1126 | 1126 |
| 1127 List<Handle<JSFunction> > functions; | 1127 List<Handle<JSFunction> > functions; |
| 1128 List<Handle<JSGeneratorObject> > suspended_generators; | 1128 List<Handle<JSGeneratorObject> > suspended_generators; |
| 1129 | 1129 |
| 1130 // Flush all optimized code. Note that the below heap iteration does not | 1130 // Flush all optimized code maps. Note that the below heap iteration does not |
| 1131 // cover this, because the given function might have been inlined into code | 1131 // cover this, because the given function might have been inlined into code |
| 1132 // for which no JSFunction exists. | 1132 // for which no JSFunction exists. |
| 1133 { | 1133 { |
| 1134 SharedFunctionInfo::Iterator iterator(isolate_); | 1134 SharedFunctionInfo::Iterator iterator(isolate_); |
| 1135 while (SharedFunctionInfo* shared = iterator.Next()) { | 1135 while (SharedFunctionInfo* shared = iterator.Next()) { |
| 1136 shared->ClearCodeFromOptimizedCodeMap(); | 1136 if (!shared->OptimizedCodeMapIsCleared()) { |
| 1137 shared->ClearOptimizedCodeMap(); |
| 1138 } |
| 1137 } | 1139 } |
| 1138 } | 1140 } |
| 1139 | 1141 |
| 1140 // Make sure we abort incremental marking. | 1142 // Make sure we abort incremental marking. |
| 1141 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1143 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
| 1142 "prepare for break points"); | 1144 "prepare for break points"); |
| 1143 | 1145 |
| 1144 { | 1146 { |
| 1145 HeapIterator iterator(isolate_->heap()); | 1147 HeapIterator iterator(isolate_->heap()); |
| 1146 HeapObject* obj; | 1148 HeapObject* obj; |
| (...skipping 21 matching lines...) Expand all Loading... |
| 1168 } | 1170 } |
| 1169 } | 1171 } |
| 1170 | 1172 |
| 1171 if (!shared->HasDebugCode()) { | 1173 if (!shared->HasDebugCode()) { |
| 1172 DCHECK(functions.length() > 0); | 1174 DCHECK(functions.length() > 0); |
| 1173 if (!Compiler::CompileDebugCode(functions.first())) return false; | 1175 if (!Compiler::CompileDebugCode(functions.first())) return false; |
| 1174 } | 1176 } |
| 1175 | 1177 |
| 1176 for (Handle<JSFunction> const function : functions) { | 1178 for (Handle<JSFunction> const function : functions) { |
| 1177 function->ReplaceCode(shared->code()); | 1179 function->ReplaceCode(shared->code()); |
| 1178 JSFunction::EnsureLiterals(function); | |
| 1179 } | 1180 } |
| 1180 | 1181 |
| 1181 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { | 1182 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { |
| 1182 int index = generator_obj->continuation(); | 1183 int index = generator_obj->continuation(); |
| 1183 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); | 1184 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); |
| 1184 generator_obj->set_continuation(pc_offset); | 1185 generator_obj->set_continuation(pc_offset); |
| 1185 } | 1186 } |
| 1186 | 1187 |
| 1187 // Update PCs on the stack to point to recompiled code. | 1188 // Update PCs on the stack to point to recompiled code. |
| 1188 RedirectActiveFunctions redirect_visitor(*shared); | 1189 RedirectActiveFunctions redirect_visitor(*shared); |
| (...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2426 } | 2427 } |
| 2427 | 2428 |
| 2428 | 2429 |
| 2429 void LockingCommandMessageQueue::Clear() { | 2430 void LockingCommandMessageQueue::Clear() { |
| 2430 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2431 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
| 2431 queue_.Clear(); | 2432 queue_.Clear(); |
| 2432 } | 2433 } |
| 2433 | 2434 |
| 2434 } // namespace internal | 2435 } // namespace internal |
| 2435 } // namespace v8 | 2436 } // namespace v8 |
| OLD | NEW |