libraries/v8/runtime.cc
// Move contents of argument 0 (an array) to argument 1 (an array)
Move contents of argument 0 (an array) to argument 1 (an array)
Move contents of argument 0 ( an array ) to argument 1 ( an array )
RUNTIME_FUNCTION(MaybeObject*, Runtime_MoveArrayContents) {
  SealHandleScope shs(isolate);
  ASSERT(args.length() == 2);
  CONVERT_ARG_CHECKED(JSArray, from, 0);
  CONVERT_ARG_CHECKED(JSArray, to, 1);
  from->ValidateElements();
  to->ValidateElements();
  FixedArrayBase* new_elements = from->elements();
  ElementsKind from_kind = from->GetElementsKind();
  MaybeObject* maybe_new_map;
  maybe_new_map = to->GetElementsTransitionMap(isolate, from_kind);
  Object* new_map;
  if (!maybe_new_map->ToObject(&new_map)) return maybe_new_map;
  to->set_map_and_elements(Map::cast(new_map), new_elements);
  to->set_length(from->length());
  Object* obj;
  { MaybeObject* maybe_obj = from->ResetElements();
    if (!maybe_obj->ToObject(&obj)) return maybe_obj;
  }
  from->set_length(Smi::FromInt(0));
  to->ValidateElements();
  return to;
}
RUNTIME_FUNCTION ( MaybeObject * , Runtime_MoveArrayContents ) { SealHandleScope shs ( isolate ) ; ASSERT ( args . length ( ) == 2 ) ; CONVERT_ARG_CHECKED ( JSArray , from , 0 ) ; CONVERT_ARG_CHECKED ( JSArray , to , 1 ) ; from -> ValidateElements ( ) ; to -> ValidateElements ( ) ; FixedArrayBase * new_elements = from -> elements ( ) ; ElementsKind from_kind = from -> GetElementsKind ( ) ; MaybeObject * maybe_new_map ; maybe_new_map = to -> GetElementsTransitionMap ( isolate , from_kind ) ; Object * new_map ; if ( ! maybe_new_map -> ToObject ( & new_map ) ) return maybe_new_map ; to -> set_map_and_elements ( Map :: cast ( new_map ) , new_elements ) ; to -> set_length ( from -> length ( ) ) ; Object * obj ; { MaybeObject * maybe_obj = from -> ResetElements ( ) ; if ( ! maybe_obj -> ToObject ( & obj ) ) return maybe_obj ; } from -> set_length ( Smi :: FromInt ( 0 ) ) ; to -> ValidateElements ( ) ; return to ; }
Move contents of argument 0 (an array) to argument 1 (an array)
Move contents of argument 0 ( an array ) to argument 1 ( an array )