OLD | NEW |
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/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/debug/debug-coverage.h" | 9 #include "src/debug/debug-coverage.h" |
10 #include "src/debug/debug-evaluate.h" | 10 #include "src/debug/debug-evaluate.h" |
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1305 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); | 1305 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); |
1306 CHECK(max_references >= 0); | 1306 CHECK(max_references >= 0); |
1307 | 1307 |
1308 List<Handle<JSObject> > instances; | 1308 List<Handle<JSObject> > instances; |
1309 Heap* heap = isolate->heap(); | 1309 Heap* heap = isolate->heap(); |
1310 { | 1310 { |
1311 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); | 1311 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); |
1312 // Get the constructor function for context extension and arguments array. | 1312 // Get the constructor function for context extension and arguments array. |
1313 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor(); | 1313 Object* arguments_fun = isolate->sloppy_arguments_map()->GetConstructor(); |
1314 HeapObject* heap_obj; | 1314 HeapObject* heap_obj; |
1315 while ((heap_obj = iterator.next())) { | 1315 while ((heap_obj = iterator.next()) != nullptr) { |
1316 if (!heap_obj->IsJSObject()) continue; | 1316 if (!heap_obj->IsJSObject()) continue; |
1317 JSObject* obj = JSObject::cast(heap_obj); | 1317 JSObject* obj = JSObject::cast(heap_obj); |
1318 if (obj->IsJSContextExtensionObject()) continue; | 1318 if (obj->IsJSContextExtensionObject()) continue; |
1319 if (obj->map()->GetConstructor() == arguments_fun) continue; | 1319 if (obj->map()->GetConstructor() == arguments_fun) continue; |
1320 if (!obj->ReferencesObject(*target)) continue; | 1320 if (!obj->ReferencesObject(*target)) continue; |
1321 // Check filter if supplied. This is normally used to avoid | 1321 // Check filter if supplied. This is normally used to avoid |
1322 // references from mirror objects. | 1322 // references from mirror objects. |
1323 if (!filter->IsUndefined(isolate) && | 1323 if (!filter->IsUndefined(isolate) && |
1324 HasInPrototypeChainIgnoringProxies(isolate, obj, *filter)) { | 1324 HasInPrototypeChainIgnoringProxies(isolate, obj, *filter)) { |
1325 continue; | 1325 continue; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1358 DCHECK_EQ(2, args.length()); | 1358 DCHECK_EQ(2, args.length()); |
1359 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); | 1359 CONVERT_ARG_HANDLE_CHECKED(JSFunction, constructor, 0); |
1360 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); | 1360 CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[1]); |
1361 CHECK(max_references >= 0); | 1361 CHECK(max_references >= 0); |
1362 | 1362 |
1363 List<Handle<JSObject> > instances; | 1363 List<Handle<JSObject> > instances; |
1364 Heap* heap = isolate->heap(); | 1364 Heap* heap = isolate->heap(); |
1365 { | 1365 { |
1366 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); | 1366 HeapIterator iterator(heap, HeapIterator::kFilterUnreachable); |
1367 HeapObject* heap_obj; | 1367 HeapObject* heap_obj; |
1368 while ((heap_obj = iterator.next())) { | 1368 while ((heap_obj = iterator.next()) != nullptr) { |
1369 if (!heap_obj->IsJSObject()) continue; | 1369 if (!heap_obj->IsJSObject()) continue; |
1370 JSObject* obj = JSObject::cast(heap_obj); | 1370 JSObject* obj = JSObject::cast(heap_obj); |
1371 if (obj->map()->GetConstructor() != *constructor) continue; | 1371 if (obj->map()->GetConstructor() != *constructor) continue; |
1372 instances.Add(Handle<JSObject>(obj)); | 1372 instances.Add(Handle<JSObject>(obj)); |
1373 if (instances.length() == max_references) break; | 1373 if (instances.length() == max_references) break; |
1374 } | 1374 } |
1375 // Iterate the rest of the heap to satisfy HeapIterator constraints. | 1375 // Iterate the rest of the heap to satisfy HeapIterator constraints. |
1376 while (iterator.next()) { | 1376 while (iterator.next()) { |
1377 } | 1377 } |
1378 } | 1378 } |
(...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1944 | 1944 |
1945 RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) { | 1945 RUNTIME_FUNCTION(Runtime_DebugTogglePreciseCoverage) { |
1946 SealHandleScope shs(isolate); | 1946 SealHandleScope shs(isolate); |
1947 CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); | 1947 CONVERT_BOOLEAN_ARG_CHECKED(enable, 0); |
1948 Coverage::TogglePrecise(isolate, enable); | 1948 Coverage::TogglePrecise(isolate, enable); |
1949 return isolate->heap()->undefined_value(); | 1949 return isolate->heap()->undefined_value(); |
1950 } | 1950 } |
1951 | 1951 |
1952 } // namespace internal | 1952 } // namespace internal |
1953 } // namespace v8 | 1953 } // namespace v8 |
OLD | NEW |