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 1160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1171 if (index == 0) return rinfo->pc() + delta; | 1171 if (index == 0) return rinfo->pc() + delta; |
1172 } | 1172 } |
1173 | 1173 |
1174 UNREACHABLE(); | 1174 UNREACHABLE(); |
1175 return NULL; | 1175 return NULL; |
1176 } | 1176 } |
1177 | 1177 |
1178 | 1178 |
1179 // Count the number of continuations at which the current pc offset is at. | 1179 // Count the number of continuations at which the current pc offset is at. |
1180 static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) { | 1180 static int ComputeContinuationIndexFromPcOffset(Code* code, int pc_offset) { |
1181 DCHECK_EQ(code->kind(), Code::FUNCTION); | 1181 UNREACHABLE(); |
1182 Address pc = code->instruction_start() + pc_offset; | 1182 return 666; |
1183 int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION); | |
1184 int index = 0; | |
1185 for (RelocIterator it(code, mask); !it.done(); it.next()) { | |
1186 index++; | |
1187 RelocInfo* rinfo = it.rinfo(); | |
1188 Address current_pc = rinfo->pc(); | |
1189 if (current_pc == pc) break; | |
1190 DCHECK(current_pc < pc); | |
1191 } | |
1192 return index; | |
1193 } | 1183 } |
1194 | 1184 |
1195 | 1185 |
1196 // Find the pc offset for the given continuation index. | 1186 // Find the pc offset for the given continuation index. |
1197 static int ComputePcOffsetFromContinuationIndex(Code* code, int index) { | 1187 static int ComputePcOffsetFromContinuationIndex(Code* code, int index) { |
1198 DCHECK_EQ(code->kind(), Code::FUNCTION); | 1188 UNREACHABLE(); |
1199 DCHECK(code->has_debug_break_slots()); | 1189 return 666; |
1200 int mask = RelocInfo::ModeMask(RelocInfo::GENERATOR_CONTINUATION); | |
1201 RelocIterator it(code, mask); | |
1202 for (int i = 1; i < index; i++) it.next(); | |
1203 return static_cast<int>(it.rinfo()->pc() - code->instruction_start()); | |
1204 } | 1190 } |
1205 | 1191 |
1206 | 1192 |
1207 class RedirectActiveFunctions : public ThreadVisitor { | 1193 class RedirectActiveFunctions : public ThreadVisitor { |
1208 public: | 1194 public: |
1209 explicit RedirectActiveFunctions(SharedFunctionInfo* shared) | 1195 explicit RedirectActiveFunctions(SharedFunctionInfo* shared) |
1210 : shared_(shared) { | 1196 : shared_(shared) { |
1211 DCHECK(shared->HasDebugCode()); | 1197 DCHECK(shared->HasDebugCode()); |
1212 } | 1198 } |
1213 | 1199 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 DCHECK(shared->is_compiled()); | 1272 DCHECK(shared->is_compiled()); |
1287 bool baseline_exists = shared->HasBaselineCode(); | 1273 bool baseline_exists = shared->HasBaselineCode(); |
1288 | 1274 |
1289 { | 1275 { |
1290 // TODO(yangguo): with bytecode, we still walk the heap to find all | 1276 // TODO(yangguo): with bytecode, we still walk the heap to find all |
1291 // optimized code for the function to deoptimize. We can probably be | 1277 // optimized code for the function to deoptimize. We can probably be |
1292 // smarter here and avoid the heap walk. | 1278 // smarter here and avoid the heap walk. |
1293 HeapIterator iterator(isolate_->heap()); | 1279 HeapIterator iterator(isolate_->heap()); |
1294 HeapObject* obj; | 1280 HeapObject* obj; |
1295 // Continuation from old-style generators need to be recomputed. | 1281 // Continuation from old-style generators need to be recomputed. |
| 1282 // TODO(yangguo): Remove code for old-style generators. |
1296 bool find_resumables = | 1283 bool find_resumables = |
1297 baseline_exists && IsResumableFunction(shared->kind()); | 1284 baseline_exists && IsResumableFunction(shared->kind()); |
1298 | 1285 |
1299 while ((obj = iterator.next())) { | 1286 while ((obj = iterator.next())) { |
1300 if (obj->IsJSFunction()) { | 1287 if (obj->IsJSFunction()) { |
1301 JSFunction* function = JSFunction::cast(obj); | 1288 JSFunction* function = JSFunction::cast(obj); |
1302 if (!function->Inlines(*shared)) continue; | 1289 if (!function->Inlines(*shared)) continue; |
1303 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { | 1290 if (function->code()->kind() == Code::OPTIMIZED_FUNCTION) { |
1304 Deoptimizer::DeoptimizeFunction(function); | 1291 Deoptimizer::DeoptimizeFunction(function); |
1305 } | 1292 } |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2624 } | 2611 } |
2625 | 2612 |
2626 | 2613 |
2627 void LockingCommandMessageQueue::Clear() { | 2614 void LockingCommandMessageQueue::Clear() { |
2628 base::LockGuard<base::Mutex> lock_guard(&mutex_); | 2615 base::LockGuard<base::Mutex> lock_guard(&mutex_); |
2629 queue_.Clear(); | 2616 queue_.Clear(); |
2630 } | 2617 } |
2631 | 2618 |
2632 } // namespace internal | 2619 } // namespace internal |
2633 } // namespace v8 | 2620 } // namespace v8 |
OLD | NEW |