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

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

Issue 1992913004: [heap] Do not invoke GC to make heap iterable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months 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/profiler/heap-snapshot-generator.cc ('k') | test/cctest/heap/test-heap.cc » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/runtime/runtime-utils.h" 5 #include "src/runtime/runtime-utils.h"
6 6
7 #include "src/arguments.h" 7 #include "src/arguments.h"
8 #include "src/debug/debug-evaluate.h" 8 #include "src/debug/debug-evaluate.h"
9 #include "src/debug/debug-frames.h" 9 #include "src/debug/debug-frames.h"
10 #include "src/debug/debug-scopes.h" 10 #include "src/debug/debug-scopes.h"
(...skipping 1213 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 DCHECK(args.length() == 3); 1224 DCHECK(args.length() == 3);
1225 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); 1225 CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0);
1226 CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1); 1226 CONVERT_ARG_HANDLE_CHECKED(Object, filter, 1);
1227 RUNTIME_ASSERT(filter->IsUndefined() || filter->IsJSObject()); 1227 RUNTIME_ASSERT(filter->IsUndefined() || filter->IsJSObject());
1228 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); 1228 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]);
1229 RUNTIME_ASSERT(max_references >= 0); 1229 RUNTIME_ASSERT(max_references >= 0);
1230 1230
1231 List<Handle<JSObject> > instances; 1231 List<Handle<JSObject> > instances;
1232 Heap* heap = isolate->heap(); 1232 Heap* heap = isolate->heap();
1233 { 1233 {
1234 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); 1234 HeapIterator iterator(heap, HeapObjectsFiltering::kFilterUnreachable);
1235 // Get the constructor function for context extension and arguments array. 1235 // Get the constructor function for context extension and arguments array.
1236 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor(); 1236 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor();
1237 HeapObject* heap_obj; 1237 HeapObject* heap_obj;
1238 while ((heap_obj = iterator.next())) { 1238 while ((heap_obj = iterator.next())) {
1239 if (!heap_obj->IsJSObject()) continue; 1239 if (!heap_obj->IsJSObject()) continue;
1240 JSObject* obj = JSObject::cast(heap_obj); 1240 JSObject* obj = JSObject::cast(heap_obj);
1241 if (obj->IsJSContextExtensionObject()) continue; 1241 if (obj->IsJSContextExtensionObject()) continue;
1242 if (obj->map()->GetConstructor() == arguments_fun) continue; 1242 if (obj->map()->GetConstructor() == arguments_fun) continue;
1243 if (!obj->ReferencesObject(*target)) continue; 1243 if (!obj->ReferencesObject(*target)) continue;
1244 // Check filter if supplied. This is normally used to avoid 1244 // Check filter if supplied. This is normally used to avoid
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 RUNTIME_FUNCTION(Runtime_DebugConstructedBy) { 1279 RUNTIME_FUNCTION(Runtime_DebugConstructedBy) {
1280 HandleScope scope(isolate); 1280 HandleScope scope(isolate);
1281 DCHECK(args.length() == 2); 1281 DCHECK(args.length() == 2);
1282 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); 1282 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0);
1283 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); 1283 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]);
1284 RUNTIME_ASSERT(max_references >= 0); 1284 RUNTIME_ASSERT(max_references >= 0);
1285 1285
1286 List<Handle<JSObject> > instances; 1286 List<Handle<JSObject> > instances;
1287 Heap* heap = isolate->heap(); 1287 Heap* heap = isolate->heap();
1288 { 1288 {
1289 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); 1289 HeapIterator iterator(heap, HeapObjectsFiltering::kFilterUnreachable);
1290 HeapObject* heap_obj; 1290 HeapObject* heap_obj;
1291 while ((heap_obj = iterator.next())) { 1291 while ((heap_obj = iterator.next())) {
1292 if (!heap_obj->IsJSObject()) continue; 1292 if (!heap_obj->IsJSObject()) continue;
1293 JSObject* obj = JSObject::cast(heap_obj); 1293 JSObject* obj = JSObject::cast(heap_obj);
1294 if (obj->map()->GetConstructor() != *constructor) continue; 1294 if (obj->map()->GetConstructor() != *constructor) continue;
1295 instances.Add(Handle<JSObject>(obj)); 1295 instances.Add(Handle<JSObject>(obj));
1296 if (instances.length() == max_references) break; 1296 if (instances.length() == max_references) break;
1297 } 1297 }
1298 // Iterate the rest of the heap to satisfy HeapIterator constraints. 1298 // Iterate the rest of the heap to satisfy HeapIterator constraints.
1299 while (iterator.next()) { 1299 while (iterator.next()) {
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 return Smi::FromInt(isolate->debug()->is_active()); 1548 return Smi::FromInt(isolate->debug()->is_active());
1549 } 1549 }
1550 1550
1551 1551
1552 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) { 1552 RUNTIME_FUNCTION(Runtime_DebugBreakInOptimizedCode) {
1553 UNIMPLEMENTED(); 1553 UNIMPLEMENTED();
1554 return NULL; 1554 return NULL;
1555 } 1555 }
1556 } // namespace internal 1556 } // namespace internal
1557 } // namespace v8 1557 } // namespace v8
OLDNEW
« no previous file with comments | « src/profiler/heap-snapshot-generator.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698