| 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/v8.h" |     5 #include "src/v8.h" | 
|     6  |     6  | 
|     7 #include "src/accessors.h" |     7 #include "src/accessors.h" | 
|     8 #include "src/arguments.h" |     8 #include "src/arguments.h" | 
|     9 #include "src/debug.h" |     9 #include "src/debug.h" | 
|    10 #include "src/deoptimizer.h" |    10 #include "src/deoptimizer.h" | 
| (...skipping 2353 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2364   JSObject* last = NULL; |  2364   JSObject* last = NULL; | 
|  2365   HeapObject* heap_obj = NULL; |  2365   HeapObject* heap_obj = NULL; | 
|  2366   while (((heap_obj = iterator->next()) != NULL) && |  2366   while (((heap_obj = iterator->next()) != NULL) && | 
|  2367          (max_references == 0 || count < max_references)) { |  2367          (max_references == 0 || count < max_references)) { | 
|  2368     // Only look at all JSObjects. |  2368     // Only look at all JSObjects. | 
|  2369     if (heap_obj->IsJSObject()) { |  2369     if (heap_obj->IsJSObject()) { | 
|  2370       // Skip context extension objects and argument arrays as these are |  2370       // Skip context extension objects and argument arrays as these are | 
|  2371       // checked in the context of functions using them. |  2371       // checked in the context of functions using them. | 
|  2372       JSObject* obj = JSObject::cast(heap_obj); |  2372       JSObject* obj = JSObject::cast(heap_obj); | 
|  2373       if (obj->IsJSContextExtensionObject() || |  2373       if (obj->IsJSContextExtensionObject() || | 
|  2374           obj->map()->constructor() == arguments_function) { |  2374           obj->map()->GetConstructor() == arguments_function) { | 
|  2375         continue; |  2375         continue; | 
|  2376       } |  2376       } | 
|  2377  |  2377  | 
|  2378       // Check if the JS object has a reference to the object looked for. |  2378       // Check if the JS object has a reference to the object looked for. | 
|  2379       if (obj->ReferencesObject(target)) { |  2379       if (obj->ReferencesObject(target)) { | 
|  2380         // Check instance filter if supplied. This is normally used to avoid |  2380         // Check instance filter if supplied. This is normally used to avoid | 
|  2381         // references from mirror objects (see Runtime_IsInPrototypeChain). |  2381         // references from mirror objects (see Runtime_IsInPrototypeChain). | 
|  2382         if (!instance_filter->IsUndefined()) { |  2382         if (!instance_filter->IsUndefined()) { | 
|  2383           for (PrototypeIterator iter(isolate, obj); !iter.IsAtEnd(); |  2383           for (PrototypeIterator iter(isolate, obj); !iter.IsAtEnd(); | 
|  2384                iter.Advance()) { |  2384                iter.Advance()) { | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2427   CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); |  2427   CONVERT_ARG_HANDLE_CHECKED(JSObject, target, 0); | 
|  2428   CONVERT_ARG_HANDLE_CHECKED(Object, instance_filter, 1); |  2428   CONVERT_ARG_HANDLE_CHECKED(Object, instance_filter, 1); | 
|  2429   RUNTIME_ASSERT(instance_filter->IsUndefined() || |  2429   RUNTIME_ASSERT(instance_filter->IsUndefined() || | 
|  2430                  instance_filter->IsJSObject()); |  2430                  instance_filter->IsJSObject()); | 
|  2431   CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); |  2431   CONVERT_NUMBER_CHECKED(int32_t, max_references, Int32, args[2]); | 
|  2432   RUNTIME_ASSERT(max_references >= 0); |  2432   RUNTIME_ASSERT(max_references >= 0); | 
|  2433  |  2433  | 
|  2434  |  2434  | 
|  2435   // Get the constructor function for context extension and arguments array. |  2435   // Get the constructor function for context extension and arguments array. | 
|  2436   Handle<JSFunction> arguments_function( |  2436   Handle<JSFunction> arguments_function( | 
|  2437       JSFunction::cast(isolate->sloppy_arguments_map()->constructor())); |  2437       JSFunction::cast(isolate->sloppy_arguments_map()->GetConstructor())); | 
|  2438  |  2438  | 
|  2439   // Get the number of referencing objects. |  2439   // Get the number of referencing objects. | 
|  2440   int count; |  2440   int count; | 
|  2441   // First perform a full GC in order to avoid dead objects and to make the heap |  2441   // First perform a full GC in order to avoid dead objects and to make the heap | 
|  2442   // iterable. |  2442   // iterable. | 
|  2443   Heap* heap = isolate->heap(); |  2443   Heap* heap = isolate->heap(); | 
|  2444   heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "%DebugConstructedBy"); |  2444   heap->CollectAllGarbage(Heap::kMakeHeapIterableMask, "%DebugConstructedBy"); | 
|  2445   { |  2445   { | 
|  2446     HeapIterator heap_iterator(heap); |  2446     HeapIterator heap_iterator(heap); | 
|  2447     count = DebugReferencedBy(&heap_iterator, *target, *instance_filter, |  2447     count = DebugReferencedBy(&heap_iterator, *target, *instance_filter, | 
| (...skipping 27 matching lines...) Expand all  Loading... | 
|  2475   DisallowHeapAllocation no_allocation; |  2475   DisallowHeapAllocation no_allocation; | 
|  2476  |  2476  | 
|  2477   // Iterate the heap. |  2477   // Iterate the heap. | 
|  2478   int count = 0; |  2478   int count = 0; | 
|  2479   HeapObject* heap_obj = NULL; |  2479   HeapObject* heap_obj = NULL; | 
|  2480   while (((heap_obj = iterator->next()) != NULL) && |  2480   while (((heap_obj = iterator->next()) != NULL) && | 
|  2481          (max_references == 0 || count < max_references)) { |  2481          (max_references == 0 || count < max_references)) { | 
|  2482     // Only look at all JSObjects. |  2482     // Only look at all JSObjects. | 
|  2483     if (heap_obj->IsJSObject()) { |  2483     if (heap_obj->IsJSObject()) { | 
|  2484       JSObject* obj = JSObject::cast(heap_obj); |  2484       JSObject* obj = JSObject::cast(heap_obj); | 
|  2485       if (obj->map()->constructor() == constructor) { |  2485       if (obj->map()->GetConstructor() == constructor) { | 
|  2486         // Valid reference found add to instance array if supplied an update |  2486         // Valid reference found add to instance array if supplied an update | 
|  2487         // count. |  2487         // count. | 
|  2488         if (instances != NULL && count < instances_size) { |  2488         if (instances != NULL && count < instances_size) { | 
|  2489           instances->set(count, obj); |  2489           instances->set(count, obj); | 
|  2490         } |  2490         } | 
|  2491         count++; |  2491         count++; | 
|  2492       } |  2492       } | 
|  2493     } |  2493     } | 
|  2494   } |  2494   } | 
|  2495  |  2495  | 
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  2811   return Smi::FromInt(isolate->debug()->is_active()); |  2811   return Smi::FromInt(isolate->debug()->is_active()); | 
|  2812 } |  2812 } | 
|  2813  |  2813  | 
|  2814  |  2814  | 
|  2815 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { |  2815 RUNTIME_FUNCTION(RuntimeReference_DebugBreakInOptimizedCode) { | 
|  2816   UNIMPLEMENTED(); |  2816   UNIMPLEMENTED(); | 
|  2817   return NULL; |  2817   return NULL; | 
|  2818 } |  2818 } | 
|  2819 } |  2819 } | 
|  2820 }  // namespace v8::internal |  2820 }  // namespace v8::internal | 
| OLD | NEW |