Index: src/arm/lithium-codegen-arm.cc |
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc |
index 69cccaca07f3ebbe1f3d6bbdb62c7223c99f65a3..74fd53dee4ca60525ee7bf343bfbcbb59824693e 100644 |
--- a/src/arm/lithium-codegen-arm.cc |
+++ b/src/arm/lithium-codegen-arm.cc |
@@ -5569,170 +5569,6 @@ void LCodeGen::DoArrayLiteral(LArrayLiteral* instr) { |
} |
-void LCodeGen::EmitDeepCopy(Handle<JSObject> object, |
- Register result, |
- Register source, |
- int* offset, |
- AllocationSiteMode mode) { |
- ASSERT(!source.is(r2)); |
- ASSERT(!result.is(r2)); |
- |
- bool create_allocation_site_info = mode == TRACK_ALLOCATION_SITE && |
- object->map()->CanTrackAllocationSite(); |
- |
- // Only elements backing stores for non-COW arrays need to be copied. |
- Handle<FixedArrayBase> elements(object->elements()); |
- bool has_elements = elements->length() > 0 && |
- elements->map() != isolate()->heap()->fixed_cow_array_map(); |
- |
- // Increase the offset so that subsequent objects end up right after |
- // this object and its backing store. |
- int object_offset = *offset; |
- int object_size = object->map()->instance_size(); |
- int elements_size = has_elements ? elements->Size() : 0; |
- int elements_offset = *offset + object_size; |
- if (create_allocation_site_info) { |
- elements_offset += AllocationSiteInfo::kSize; |
- *offset += AllocationSiteInfo::kSize; |
- } |
- |
- *offset += object_size + elements_size; |
- |
- // Copy object header. |
- ASSERT(object->properties()->length() == 0); |
- int inobject_properties = object->map()->inobject_properties(); |
- int header_size = object_size - inobject_properties * kPointerSize; |
- for (int i = 0; i < header_size; i += kPointerSize) { |
- if (has_elements && i == JSObject::kElementsOffset) { |
- __ add(r2, result, Operand(elements_offset)); |
- } else { |
- __ ldr(r2, FieldMemOperand(source, i)); |
- } |
- __ str(r2, FieldMemOperand(result, object_offset + i)); |
- } |
- |
- // Copy in-object properties. |
- for (int i = 0; i < inobject_properties; i++) { |
- int total_offset = object_offset + object->GetInObjectPropertyOffset(i); |
- Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i), |
- isolate()); |
- if (value->IsJSObject()) { |
- Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
- __ add(r2, result, Operand(*offset)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- __ LoadHeapObject(source, value_object); |
- EmitDeepCopy(value_object, result, source, offset, |
- DONT_TRACK_ALLOCATION_SITE); |
- } else if (value->IsHeapObject()) { |
- __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- } else { |
- __ mov(r2, Operand(value)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- } |
- } |
- |
- // Build Allocation Site Info if desired |
- if (create_allocation_site_info) { |
- __ mov(r2, Operand(Handle<Map>(isolate()->heap()-> |
- allocation_site_info_map()))); |
- __ str(r2, FieldMemOperand(result, object_size)); |
- __ str(source, FieldMemOperand(result, object_size + kPointerSize)); |
- } |
- |
- if (has_elements) { |
- // Copy elements backing store header. |
- __ LoadHeapObject(source, elements); |
- for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { |
- __ ldr(r2, FieldMemOperand(source, i)); |
- __ str(r2, FieldMemOperand(result, elements_offset + i)); |
- } |
- |
- // Copy elements backing store content. |
- int elements_length = has_elements ? elements->length() : 0; |
- if (elements->IsFixedDoubleArray()) { |
- Handle<FixedDoubleArray> double_array = |
- Handle<FixedDoubleArray>::cast(elements); |
- for (int i = 0; i < elements_length; i++) { |
- int64_t value = double_array->get_representation(i); |
- // We only support little endian mode... |
- int32_t value_low = static_cast<int32_t>(value & 0xFFFFFFFF); |
- int32_t value_high = static_cast<int32_t>(value >> 32); |
- int total_offset = |
- elements_offset + FixedDoubleArray::OffsetOfElementAt(i); |
- __ mov(r2, Operand(value_low)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- __ mov(r2, Operand(value_high)); |
- __ str(r2, FieldMemOperand(result, total_offset + 4)); |
- } |
- } else if (elements->IsFixedArray()) { |
- Handle<FixedArray> fast_elements = Handle<FixedArray>::cast(elements); |
- for (int i = 0; i < elements_length; i++) { |
- int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); |
- Handle<Object> value(fast_elements->get(i), isolate()); |
- if (value->IsJSObject()) { |
- Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
- __ add(r2, result, Operand(*offset)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- __ LoadHeapObject(source, value_object); |
- EmitDeepCopy(value_object, result, source, offset, |
- DONT_TRACK_ALLOCATION_SITE); |
- } else if (value->IsHeapObject()) { |
- __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- } else { |
- __ mov(r2, Operand(value)); |
- __ str(r2, FieldMemOperand(result, total_offset)); |
- } |
- } |
- } else { |
- UNREACHABLE(); |
- } |
- } |
-} |
- |
- |
-void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
- int size = instr->hydrogen()->total_size(); |
- ElementsKind boilerplate_elements_kind = |
- instr->hydrogen()->boilerplate()->GetElementsKind(); |
- |
- // Deopt if the array literal boilerplate ElementsKind is of a type different |
- // than the expected one. The check isn't necessary if the boilerplate has |
- // already been converted to TERMINAL_FAST_ELEMENTS_KIND. |
- if (CanTransitionToMoreGeneralFastElementsKind( |
- boilerplate_elements_kind, true)) { |
- __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
- // Load map into r2. |
- __ ldr(r2, FieldMemOperand(r1, HeapObject::kMapOffset)); |
- // Load the map's "bit field 2". |
- __ ldrb(r2, FieldMemOperand(r2, Map::kBitField2Offset)); |
- // Retrieve elements_kind from bit field 2. |
- __ ubfx(r2, r2, Map::kElementsKindShift, Map::kElementsKindBitCount); |
- __ cmp(r2, Operand(boilerplate_elements_kind)); |
- DeoptimizeIf(ne, instr->environment()); |
- } |
- |
- // Allocate all objects that are part of the literal in one big |
- // allocation. This avoids multiple limit checks. |
- Label allocated, runtime_allocate; |
- __ Allocate(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT); |
- __ jmp(&allocated); |
- |
- __ bind(&runtime_allocate); |
- __ mov(r0, Operand(Smi::FromInt(size))); |
- __ push(r0); |
- CallRuntime(Runtime::kAllocateInNewSpace, 1, instr); |
- |
- __ bind(&allocated); |
- int offset = 0; |
- __ LoadHeapObject(r1, instr->hydrogen()->boilerplate()); |
- EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset, |
- instr->hydrogen()->allocation_site_mode()); |
- ASSERT_EQ(size, offset); |
-} |
- |
- |
void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { |
Handle<FixedArray> literals(instr->environment()->closure()->literals()); |
Handle<FixedArray> constant_properties = |