Lines Matching full:heap
177 return isolate->heap()->undefined_value(); // Make compiler happy.
182 return isolate->heap()->undefined_value();
187 Heap* heap = isolate->heap();
198 { MaybeObject* maybe_obj = heap->AllocateJSObject(constructor);
215 { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(len);
238 { MaybeObject* maybe_obj = heap->AllocateFixedArrayWithHoles(len->value());
258 MUST_USE_RESULT static MaybeObject* AllocateJSArray(Heap* heap) {
260 heap->isolate()->context()->global_context()->array_function();
262 { MaybeObject* maybe_result = heap->AllocateJSObject(array_function);
269 MUST_USE_RESULT static MaybeObject* AllocateEmptyJSArray(Heap* heap) {
271 { MaybeObject* maybe_result = AllocateJSArray(heap);
276 result_array->set_elements(heap->empty_fixed_array());
281 static void CopyElements(Heap* heap,
289 ASSERT(dst->map() != HEAP->fixed_cow_array_map());
296 heap->RecordWrites(dst->address(), dst->OffsetOfElementAt(dst_index), len);
301 static void MoveElements(Heap* heap,
308 ASSERT(dst->map() != HEAP->fixed_cow_array_map());
314 heap->RecordWrites(dst->address(), dst->OffsetOfElementAt(dst_index), len);
319 static void FillWithHoles(Heap* heap, FixedArray* dst, int from, int to) {
320 ASSERT(dst->map() != heap->fixed_cow_array_map());
321 MemsetPointer(dst->data_start() + from, heap->the_hole_value(), to - from);
325 static FixedArray* LeftTrimFixedArray(Heap* heap,
328 ASSERT(elms->map() != HEAP->fixed_cow_array_map());
332 ASSERT(!HEAP->lo_space()->Contains(elms));
343 !heap->new_space()->Contains(elms)) {
354 // debug mode which iterates through the heap), but to play safer
356 heap->CreateFillerObjectAt(elms->address(), to_trim * kPointerSize);
358 former_start[to_trim] = heap->fixed_array_map();
366 static bool ArrayPrototypeHasNoElements(Heap* heap,
371 if (array_proto->elements() != heap->empty_fixed_array()) return false;
374 ASSERT(array_proto->elements() == heap->empty_fixed_array());
377 if (proto == heap->null_value()) return false;
380 if (array_proto->elements() != heap->empty_fixed_array()) return false;
387 Heap* heap, Object* receiver) {
391 if (elms->map() == heap->fixed_array_map()) return elms;
392 if (elms->map() == heap->fixed_cow_array_map()) {
399 static inline bool IsJSArrayFastElementMovingAllowed(Heap* heap,
401 Context* global_context = heap->isolate()->context()->global_context();
405 ArrayPrototypeHasNoElements(heap, global_context, array_proto);
438 Heap* heap = isolate->heap();
442 EnsureJSArrayWithWritableFastElements(heap, receiver);
466 { MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity);
473 heap, &no_gc, new_elms, 0, elms, 0, len);
475 FillWithHoles(heap, new_elms, new_length, capacity);
495 Heap* heap = isolate->heap();
499 EnsureJSArrayWithWritableFastElements(heap, receiver);
507 if (len == 0) return heap->undefined_value();
528 Heap* heap = isolate->heap();
532 EnsureJSArrayWithWritableFastElements(heap, receiver);
537 if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) {
545 if (len == 0) return heap->undefined_value();
550 first = heap->undefined_value();
553 if (!heap->lo_space()->Contains(elms)) {
556 array->set_elements(LeftTrimFixedArray(heap, elms, 1), SKIP_WRITE_BARRIER);
560 MoveElements(heap, &no_gc, elms, 0, elms, 1, len - 1);
561 elms->set(len - 1, heap->the_hole_value());
572 Heap* heap = isolate->heap();
576 EnsureJSArrayWithWritableFastElements(heap, receiver);
581 if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) {
599 { MaybeObject* maybe_obj = heap->AllocateUninitializedFixedArray(capacity);
606 CopyElements(heap, &no_gc, new_elms, to_add, elms, 0, len);
608 FillWithHoles(heap, new_elms, new_length, capacity);
614 MoveElements(heap, &no_gc, elms, to_add, elms, 0, len);
631 Heap* heap = isolate->heap();
638 !IsJSArrayFastElementMovingAllowed(heap, array)) {
659 ->InObjectPropertyAt(Heap::kArgumentsLengthIndex);
668 if (elms->get(i) == heap->the_hole_value()) {
709 return AllocateEmptyJSArray(heap);
713 { MaybeObject* maybe_result = AllocateJSArray(heap);
719 heap->AllocateUninitializedFixedArray(result_len);
725 CopyElements(heap, &no_gc, result_elms, 0, elms, k, result_len);
737 Heap* heap = isolate->heap();
741 EnsureJSArrayWithWritableFastElements(heap, receiver);
746 if (!IsJSArrayFastElementMovingAllowed(heap, JSArray::cast(receiver))) {
794 { MaybeObject* maybe_result = AllocateEmptyJSArray(heap);
801 { MaybeObject* maybe_result = AllocateJSArray(heap);
807 heap->AllocateUninitializedFixedArray(actual_delete_count);
814 CopyElements(heap,
833 const bool trim_array = !heap->lo_space()->Contains(elms) &&
841 MoveElements(heap, &no_gc, elms, delta, elms, 0, actual_start);
844 elms = LeftTrimFixedArray(heap, elms, delta);
848 MoveElements(heap, &no_gc,
852 FillWithHoles(heap, elms, new_length, len);
865 heap->AllocateUninitializedFixedArray(capacity);
873 CopyElements(heap, &no_gc, new_elms, 0, elms, 0, actual_start);
877 CopyElements(heap, &no_gc,
882 FillWithHoles(heap, new_elms, new_length, capacity);
888 MoveElements(heap, &no_gc,
909 Heap* heap = isolate->heap();
913 if (!ArrayPrototypeHasNoElements(heap, global_context, array_proto)) {
943 return AllocateEmptyJSArray(heap);
948 { MaybeObject* maybe_result = AllocateJSArray(heap);
954 heap->AllocateUninitializedFixedArray(result_len);
967 CopyElements(heap, &no_gc, result_elms, start_pos, elms, 0, len);
1018 // with this receiver. Returns Heap::null_value() if the call is
1023 static inline Object* TypeCheck(Heap* heap,
1036 for (; holder != heap->null_value(); holder = holder->GetPrototype()) {
1041 if (holder == heap->null_value()) return holder;
1054 for (; current != heap->null_value(); current = current->GetPrototype()) {
1060 if (current == heap->null_value()) *arg = heap->undefined_value();
1070 Heap* heap = isolate->heap();
1087 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data);
1128 result = heap->undefined_value();
1170 Heap* heap = isolate->heap();
1203 result = heap->undefined_value();
1223 Heap* heap = isolate->heap();
1266 result = heap->undefined_value();
1597 Heap* heap = isolate->heap();
1620 // Move the code into the object heap.
1630 heap->CreateCode(desc, flags, masm.CodeObject());