Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: src/debug/debug.cc

Issue 2578433002: Revert of Store SharedFunctionInfos of a Script in a FixedArray indexed by their ID (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/debug/liveedit.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1226 matching lines...) Expand 10 before | Expand all | Expand 10 after
1237 if (isolate_->concurrent_recompilation_enabled()) { 1237 if (isolate_->concurrent_recompilation_enabled()) {
1238 isolate_->optimizing_compile_dispatcher()->Flush(); 1238 isolate_->optimizing_compile_dispatcher()->Flush();
1239 } 1239 }
1240 1240
1241 List<Handle<JSFunction> > functions; 1241 List<Handle<JSFunction> > functions;
1242 1242
1243 // Flush all optimized code maps. Note that the below heap iteration does not 1243 // Flush all optimized code maps. Note that the below heap iteration does not
1244 // cover this, because the given function might have been inlined into code 1244 // cover this, because the given function might have been inlined into code
1245 // for which no JSFunction exists. 1245 // for which no JSFunction exists.
1246 { 1246 {
1247 SharedFunctionInfo::GlobalIterator iterator(isolate_); 1247 SharedFunctionInfo::Iterator iterator(isolate_);
1248 while (SharedFunctionInfo* shared = iterator.Next()) { 1248 while (SharedFunctionInfo* shared = iterator.Next()) {
1249 shared->ClearCodeFromOptimizedCodeMap(); 1249 shared->ClearCodeFromOptimizedCodeMap();
1250 } 1250 }
1251 } 1251 }
1252 1252
1253 // The native context also has a list of OSR'd optimized code. Clear it. 1253 // The native context also has a list of OSR'd optimized code. Clear it.
1254 isolate_->ClearOSROptimizedCode(); 1254 isolate_->ClearOSROptimizedCode();
1255 1255
1256 // Make sure we abort incremental marking. 1256 // Make sure we abort incremental marking.
1257 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask, 1257 isolate_->heap()->CollectAllGarbage(Heap::kMakeHeapIterableMask,
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 BytecodeArrayBreakIterator it(debug_info, ALL_BREAK_LOCATIONS); 1328 BytecodeArrayBreakIterator it(debug_info, ALL_BREAK_LOCATIONS);
1329 GetBreakablePositions(&it, start_position, end_position, alignment, 1329 GetBreakablePositions(&it, start_position, end_position, alignment,
1330 positions); 1330 positions);
1331 } 1331 }
1332 } 1332 }
1333 } // namespace 1333 } // namespace
1334 1334
1335 bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position, 1335 bool Debug::GetPossibleBreakpoints(Handle<Script> script, int start_position,
1336 int end_position, std::set<int>* positions) { 1336 int end_position, std::set<int>* positions) {
1337 while (true) { 1337 while (true) {
1338 if (!script->shared_function_infos()->IsWeakFixedArray()) return false;
1339
1340 WeakFixedArray* infos =
1341 WeakFixedArray::cast(script->shared_function_infos());
1338 HandleScope scope(isolate_); 1342 HandleScope scope(isolate_);
1339 List<Handle<SharedFunctionInfo>> candidates; 1343 List<Handle<SharedFunctionInfo>> candidates;
1340 SharedFunctionInfo::ScriptIterator iterator(script); 1344 {
1341 for (SharedFunctionInfo* info = iterator.Next(); info != nullptr; 1345 WeakFixedArray::Iterator iterator(infos);
1342 info = iterator.Next()) { 1346 SharedFunctionInfo* info;
1343 if (info->end_position() < start_position || 1347 while ((info = iterator.Next<SharedFunctionInfo>())) {
1344 info->start_position() >= end_position) { 1348 if (info->end_position() < start_position ||
1345 continue; 1349 info->start_position() >= end_position) {
1350 continue;
1351 }
1352 if (!info->IsSubjectToDebugging()) continue;
1353 if (!info->HasDebugCode() && !info->allows_lazy_compilation()) continue;
1354 candidates.Add(i::handle(info));
1346 } 1355 }
1347 if (!info->IsSubjectToDebugging()) continue;
1348 if (!info->HasDebugCode() && !info->allows_lazy_compilation()) continue;
1349 candidates.Add(i::handle(info));
1350 } 1356 }
1351 1357
1352 bool was_compiled = false; 1358 bool was_compiled = false;
1353 for (int i = 0; i < candidates.length(); ++i) { 1359 for (int i = 0; i < candidates.length(); ++i) {
1354 // Code that cannot be compiled lazily are internal and not debuggable. 1360 // Code that cannot be compiled lazily are internal and not debuggable.
1355 DCHECK(candidates[i]->allows_lazy_compilation()); 1361 DCHECK(candidates[i]->allows_lazy_compilation());
1356 if (!candidates[i]->HasDebugCode()) { 1362 if (!candidates[i]->HasDebugCode()) {
1357 if (!Compiler::CompileDebugCode(candidates[i])) { 1363 if (!Compiler::CompileDebugCode(candidates[i])) {
1358 return false; 1364 return false;
1359 } else { 1365 } else {
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1449 // While we are at this, also ensure code with debug break slots so that we do 1455 // While we are at this, also ensure code with debug break slots so that we do
1450 // not have to compile a SFI without JSFunction, which is paifu for those that 1456 // not have to compile a SFI without JSFunction, which is paifu for those that
1451 // cannot be compiled without context (need to find outer compilable SFI etc.) 1457 // cannot be compiled without context (need to find outer compilable SFI etc.)
1452 Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script, 1458 Handle<Object> Debug::FindSharedFunctionInfoInScript(Handle<Script> script,
1453 int position) { 1459 int position) {
1454 for (int iteration = 0;; iteration++) { 1460 for (int iteration = 0;; iteration++) {
1455 // Go through all shared function infos associated with this script to 1461 // Go through all shared function infos associated with this script to
1456 // find the inner most function containing this position. 1462 // find the inner most function containing this position.
1457 // If there is no shared function info for this script at all, there is 1463 // If there is no shared function info for this script at all, there is
1458 // no point in looking for it by walking the heap. 1464 // no point in looking for it by walking the heap.
1465 if (!script->shared_function_infos()->IsWeakFixedArray()) break;
1459 1466
1460 SharedFunctionInfo* shared; 1467 SharedFunctionInfo* shared;
1461 { 1468 {
1462 SharedFunctionInfoFinder finder(position); 1469 SharedFunctionInfoFinder finder(position);
1463 SharedFunctionInfo::ScriptIterator iterator(script); 1470 WeakFixedArray::Iterator iterator(script->shared_function_infos());
1464 for (SharedFunctionInfo* info = iterator.Next(); info != nullptr; 1471 SharedFunctionInfo* candidate;
1465 info = iterator.Next()) { 1472 while ((candidate = iterator.Next<SharedFunctionInfo>())) {
1466 finder.NewCandidate(info); 1473 finder.NewCandidate(candidate);
1467 } 1474 }
1468 shared = finder.Result(); 1475 shared = finder.Result();
1469 if (shared == NULL) break; 1476 if (shared == NULL) break;
1470 // We found it if it's already compiled and has debug code. 1477 // We found it if it's already compiled and has debug code.
1471 if (shared->HasDebugCode()) { 1478 if (shared->HasDebugCode()) {
1472 Handle<SharedFunctionInfo> shared_handle(shared); 1479 Handle<SharedFunctionInfo> shared_handle(shared);
1473 // If the iteration count is larger than 1, we had to compile the outer 1480 // If the iteration count is larger than 1, we had to compile the outer
1474 // function in order to create this shared function info. So there can 1481 // function in order to create this shared function info. So there can
1475 // be no JSFunction referencing it. We can anticipate creating a debug 1482 // be no JSFunction referencing it. We can anticipate creating a debug
1476 // info while bypassing PrepareFunctionForBreakpoints. 1483 // info while bypassing PrepareFunctionForBreakpoints.
(...skipping 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2494 logger_->DebugEvent("Put", message.text()); 2501 logger_->DebugEvent("Put", message.text());
2495 } 2502 }
2496 2503
2497 void LockingCommandMessageQueue::Clear() { 2504 void LockingCommandMessageQueue::Clear() {
2498 base::LockGuard<base::Mutex> lock_guard(&mutex_); 2505 base::LockGuard<base::Mutex> lock_guard(&mutex_);
2499 queue_.Clear(); 2506 queue_.Clear();
2500 } 2507 }
2501 2508
2502 } // namespace internal 2509 } // namespace internal
2503 } // namespace v8 2510 } // namespace v8
OLDNEW
« no previous file with comments | « src/crankshaft/hydrogen.cc ('k') | src/debug/liveedit.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698