libraries/v8/runtime.cc
// For a script finds all SharedFunctionInfo's in the heap that points
// to this script. Returns JSArray of SharedFunctionInfo wrapped
// in OpaqueReferences.
For a script finds all SharedFunctionInfo's in the heap that points
to this script.
For a script finds all SharedFunctionInfo ' s in the heap that points to this script .
RUNTIME_FUNCTION(MaybeObject*,
                 Runtime_LiveEditFindSharedFunctionInfosForScript) {
  HandleScope scope(isolate);
  CHECK(isolate->debugger()->live_edit_enabled());
  ASSERT(args.length() == 1);
  CONVERT_ARG_CHECKED(JSValue, script_value, 0);
  RUNTIME_ASSERT(script_value->value()->IsScript());
  Handle<Script> script = Handle<Script>(Script::cast(script_value->value()));
  const int kBufferSize = 32;
  Handle<FixedArray> array;
  array = isolate->factory()->NewFixedArray(kBufferSize);
  int number;
  Heap* heap = isolate->heap();
  {
    heap->EnsureHeapIsIterable();
    DisallowHeapAllocation no_allocation;
    HeapIterator heap_iterator(heap);
    Script* scr = *script;
    FixedArray* arr = *array;
    number = FindSharedFunctionInfosForScript(&heap_iterator, scr, arr);
  }
  if (number > kBufferSize) {
    array = isolate->factory()->NewFixedArray(number);
    heap->EnsureHeapIsIterable();
    DisallowHeapAllocation no_allocation;
    HeapIterator heap_iterator(heap);
    Script* scr = *script;
    FixedArray* arr = *array;
    FindSharedFunctionInfosForScript(&heap_iterator, scr, arr);
  }
  Handle<JSArray> result = isolate->factory()->NewJSArrayWithElements(array);
  result->set_length(Smi::FromInt(number));
  LiveEdit::WrapSharedFunctionInfos(result);
  return *result;
}
RUNTIME_FUNCTION ( MaybeObject * , Runtime_LiveEditFindSharedFunctionInfosForScript ) { HandleScope scope ( isolate ) ; CHECK ( isolate -> debugger ( ) -> live_edit_enabled ( ) ) ; ASSERT ( args . length ( ) == 1 ) ; CONVERT_ARG_CHECKED ( JSValue , script_value , 0 ) ; RUNTIME_ASSERT ( script_value -> value ( ) -> IsScript ( ) ) ; Handle < Script > script = Handle < Script > ( Script :: cast ( script_value -> value ( ) ) ) ; const int kBufferSize = 32 ; Handle < FixedArray > array ; array = isolate -> factory ( ) -> NewFixedArray ( kBufferSize ) ; int number ; Heap * heap = isolate -> heap ( ) ; { heap -> EnsureHeapIsIterable ( ) ; DisallowHeapAllocation no_allocation ; HeapIterator heap_iterator ( heap ) ; Script * scr = * script ; FixedArray * arr = * array ; number = FindSharedFunctionInfosForScript ( & heap_iterator , scr , arr ) ; } if ( number > kBufferSize ) { array = isolate -> factory ( ) -> NewFixedArray ( number ) ; heap -> EnsureHeapIsIterable ( ) ; DisallowHeapAllocation no_allocation ; HeapIterator heap_iterator ( heap ) ; Script * scr = * script ; FixedArray * arr = * array ; FindSharedFunctionInfosForScript ( & heap_iterator , scr , arr ) ; } Handle < JSArray > result = isolate -> factory ( ) -> NewJSArrayWithElements ( array ) ; result -> set_length ( Smi :: FromInt ( number ) ) ; LiveEdit :: WrapSharedFunctionInfos ( result ) ; return * result ; }
For a script finds all SharedFunctionInfo's in the heap that points
to this script.
For a script finds all SharedFunctionInfo ' s in the heap that points to this script .