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 1130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1141 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { | 1141 bool Debug::PrepareFunctionForBreakPoints(Handle<SharedFunctionInfo> shared) { |
1142 DCHECK(shared->is_compiled()); | 1142 DCHECK(shared->is_compiled()); |
1143 | 1143 |
1144 if (isolate_->concurrent_recompilation_enabled()) { | 1144 if (isolate_->concurrent_recompilation_enabled()) { |
1145 isolate_->optimizing_compile_dispatcher()->Flush(); | 1145 isolate_->optimizing_compile_dispatcher()->Flush(); |
1146 } | 1146 } |
1147 | 1147 |
1148 List<Handle<JSFunction> > functions; | 1148 List<Handle<JSFunction> > functions; |
1149 List<Handle<JSGeneratorObject> > suspended_generators; | 1149 List<Handle<JSGeneratorObject> > suspended_generators; |
1150 | 1150 |
1151 // Flush all optimized code. Note that the below heap iteration does not | 1151 // Flush all optimized code maps. Note that the below heap iteration does not |
1152 // cover this, because the given function might have been inlined into code | 1152 // cover this, because the given function might have been inlined into code |
1153 // for which no JSFunction exists. | 1153 // for which no JSFunction exists. |
1154 { | 1154 { |
1155 SharedFunctionInfo::Iterator iterator(isolate_); | 1155 SharedFunctionInfo::Iterator iterator(isolate_); |
1156 while (SharedFunctionInfo* shared = iterator.Next()) { | 1156 while (SharedFunctionInfo* shared = iterator.Next()) { |
1157 shared->ClearCodeFromOptimizedCodeMap(); | 1157 if (!shared->OptimizedCodeMapIsCleared()) { |
| 1158 shared->ClearOptimizedCodeMap(); |
| 1159 } |
1158 } | 1160 } |
1159 } | 1161 } |
1160 | 1162 |
1161 // Make sure we abort incremental marking. | 1163 // Make sure we abort incremental marking. |
1162 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, | 1164 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, |
1163 "prepare for break points"); | 1165 "prepare for break points"); |
1164 | 1166 |
1165 { | 1167 { |
1166 HeapIterator iterator(isolate_->heap()); | 1168 HeapIterator iterator(isolate_->heap()); |
1167 HeapObject* obj; | 1169 HeapObject* obj; |
(...skipping 21 matching lines...) Expand all Loading... |
1189 } | 1191 } |
1190 } | 1192 } |
1191 | 1193 |
1192 if (!shared->HasDebugCode()) { | 1194 if (!shared->HasDebugCode()) { |
1193 DCHECK(functions.length() > 0); | 1195 DCHECK(functions.length() > 0); |
1194 if (!Compiler::CompileDebugCode(functions.first())) return false; | 1196 if (!Compiler::CompileDebugCode(functions.first())) return false; |
1195 } | 1197 } |
1196 | 1198 |
1197 for (Handle<JSFunction> const function : functions) { | 1199 for (Handle<JSFunction> const function : functions) { |
1198 function->ReplaceCode(shared->code()); | 1200 function->ReplaceCode(shared->code()); |
1199 JSFunction::EnsureLiterals(function); | |
1200 } | 1201 } |
1201 | 1202 |
1202 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { | 1203 for (Handle<JSGeneratorObject> const generator_obj : suspended_generators) { |
1203 int index = generator_obj->continuation(); | 1204 int index = generator_obj->continuation(); |
1204 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); | 1205 int pc_offset = ComputePcOffsetFromContinuationIndex(shared->code(), index); |
1205 generator_obj->set_continuation(pc_offset); | 1206 generator_obj->set_continuation(pc_offset); |
1206 } | 1207 } |
1207 | 1208 |
1208 // Update PCs on the stack to point to recompiled code. | 1209 // Update PCs on the stack to point to recompiled code. |
1209 RedirectActiveFunctions redirect_visitor(*shared); | 1210 RedirectActiveFunctions redirect_visitor(*shared); |
(...skipping 1237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2447 } | 2448 } |
2448 | 2449 |
2449 | 2450 |
2450 void LockingCommandMessageQueue::Clear() { | 2451 void LockingCommandMessageQueue::Clear() { |
2451 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2452 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2452 queue_.Clear(); | 2453 queue_.Clear(); |
2453 } | 2454 } |
2454 | 2455 |
2455 } // namespace internal | 2456 } // namespace internal |
2456 } // namespace v8 | 2457 } // namespace v8 |
OLD | NEW |