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 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1150 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { | 1150 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
1151 DCHECK(shared->is_compiled()); | 1151 DCHECK(shared->is_compiled()); |
1152 | 1152 |
1153 if (isolate_->concurrent_recompilation_enabled()) { | 1153 if (isolate_->concurrent_recompilation_enabled()) { |
1154 isolate_->optimizing_compile_dispatcher()->Flush(); | 1154 isolate_->optimizing_compile_dispatcher()->Flush(); |
1155 } | 1155 } |
1156 | 1156 |
1157 List<Handle<JSFunction> > functions; | 1157 List<Handle<JSFunction> > functions; |
1158 List<Handle<JSGeneratorObject> > suspended_generators; | 1158 List<Handle<JSGeneratorObject> > suspended_generators; |
1159 | 1159 |
1160 // Flush all optimized code. Note that the below heap iteration does not | 1160 // Flush all optimized code maps. Note that the below heap iteration does not |
1161 // cover this, because the given function might have been inlined into code | 1161 // cover this, because the given function might have been inlined into code |
1162 // for which no JSFunction exists. | 1162 // for which no JSFunction exists. |
1163 { | 1163 { |
1164 SharedFunctionInfo::Iterator iterator(isolate_); | 1164 SharedFunctionInfo::Iterator iterator(isolate_); |
1165 while (SharedFunctionInfo* shared = iterator.Next()) { | 1165 while (SharedFunctionInfo* shared = iterator.Next()) { |
1166 shared->ClearCodeFromOptimizedCodeMap(); | 1166 if (!shared->OptimizedCodeMapIsCleared()) { |
| 1167 shared->ClearOptimizedCodeMap(); |
| 1168 } |
1167 } | 1169 } |
1168 } | 1170 } |
1169 | 1171 |
1170 // Make sure we abort incremental marking. | 1172 // Make sure we abort incremental marking. |
1171 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1173 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
1172 "prepare for break points"); | 1174 "prepare for break points"); |
1173 | 1175 |
1174 { | 1176 { |
1175 HeapIterator iterator(isolate_->heap()); | 1177 HeapIterator iterator(isolate_->heap()); |
1176 HeapObject* obj; | 1178 HeapObject* obj; |
(...skipping 21 matching lines...) Expand all Loading... |
1198 } | 1200 } |
1199 } | 1201 } |
1200 | 1202 |
1201 if (!shared->HasDebugCode()) { | 1203 if (!shared->HasDebugCode()) { |
1202 DCHECK(functions.length() > 0); | 1204 DCHECK(functions.length() > 0); |
1203 if (!Compiler::CompileDebugCode(functions.first())) return false; | 1205 if (!Compiler::CompileDebugCode(functions.first())) return false; |
1204 } | 1206 } |
1205 | 1207 |
1206 for (Handle<JSFunction> const function : functions) { | 1208 for (Handle<JSFunction> const function : functions) { |
1207 function->ReplaceCode(shared->code()); | 1209 function->ReplaceCode(shared->code()); |
1208 JSFunction::EnsureLiterals(function); | |
1209 } | 1210 } |
1210 | 1211 |
1211 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { | 1212 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { |
1212 int index = generator_obj->continuation(); | 1213 int index = generator_obj->continuation(); |
1213 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); | 1214 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); |
1214 generator_obj->set_continuation(pc_offset); | 1215 generator_obj->set_continuation(pc_offset); |
1215 } | 1216 } |
1216 | 1217 |
1217 // Update PCs on the stack to point to recompiled code. | 1218 // Update PCs on the stack to point to recompiled code. |
1218 RedirectActiveFunctions redirect_visitor(*shared); | 1219 RedirectActiveFunctions redirect_visitor(*shared); |
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2460 } | 2461 } |
2461 | 2462 |
2462 | 2463 |
2463 void LockingCommandMessageQueue::Clear() { | 2464 void LockingCommandMessageQueue::Clear() { |
2464 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2465 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2465 queue_.Clear(); | 2466 queue_.Clear(); |
2466 } | 2467 } |
2467 | 2468 |
2468 } // namespace internal | 2469 } // namespace internal |
2469 } // namespace v8 | 2470 } // namespace v8 |
OLD | NEW |