OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 4443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4454 __ LoadHeapObject(source, value_object); | 4454 __ LoadHeapObject(source, value_object); |
4455 EmitDeepCopy(value_object, result, source, offset); | 4455 EmitDeepCopy(value_object, result, source, offset); |
4456 } else if (value->IsHeapObject()) { | 4456 } else if (value->IsHeapObject()) { |
4457 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | 4457 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
4458 __ mov(FieldOperand(result, total_offset), ecx); | 4458 __ mov(FieldOperand(result, total_offset), ecx); |
4459 } else { | 4459 } else { |
4460 __ mov(FieldOperand(result, total_offset), Immediate(value)); | 4460 __ mov(FieldOperand(result, total_offset), Immediate(value)); |
4461 } | 4461 } |
4462 } | 4462 } |
4463 | 4463 |
4464 // Copy elements backing store header. | |
4465 ASSERT(!has_elements || elements->IsFixedArray()); | |
4466 if (has_elements) { | 4464 if (has_elements) { |
| 4465 // Copy elements backing store header. |
4467 __ LoadHeapObject(source, elements); | 4466 __ LoadHeapObject(source, elements); |
4468 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { | 4467 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { |
4469 __ mov(ecx, FieldOperand(source, i)); | 4468 __ mov(ecx, FieldOperand(source, i)); |
4470 __ mov(FieldOperand(result, elements_offset + i), ecx); | 4469 __ mov(FieldOperand(result, elements_offset + i), ecx); |
4471 } | 4470 } |
4472 } | |
4473 | 4471 |
4474 // Copy elements backing store content. | 4472 // Copy elements backing store content. |
4475 ASSERT(!has_elements || elements->IsFixedArray()); | 4473 int elements_length = elements->length(); |
4476 int elements_length = has_elements ? elements->length() : 0; | 4474 if (elements->IsFixedDoubleArray()) { |
4477 for (int i = 0; i < elements_length; i++) { | 4475 Handle<FixedDoubleArray> double_array = |
4478 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); | 4476 Handle<FixedDoubleArray>::cast(elements); |
4479 Handle<Object> value = JSObject::GetElement(object, i); | 4477 for (int i = 0; i < elements_length; i++) { |
4480 if (value->IsJSObject()) { | 4478 int64_t value = double_array->get_representation(i); |
4481 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 4479 int32_t value_low = value & 0xFFFFFFFF; |
4482 __ lea(ecx, Operand(result, *offset)); | 4480 int32_t value_high = value >> 32; |
4483 __ mov(FieldOperand(result, total_offset), ecx); | 4481 int total_offset = |
4484 __ LoadHeapObject(source, value_object); | 4482 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); |
4485 EmitDeepCopy(value_object, result, source, offset); | 4483 __ mov(FieldOperand(result, total_offset), Immediate(value_low)); |
4486 } else if (value->IsHeapObject()) { | 4484 __ mov(FieldOperand(result, total_offset + 4), Immediate(value_high)); |
4487 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | 4485 } |
4488 __ mov(FieldOperand(result, total_offset), ecx); | 4486 } else if (elements->IsFixedArray()) { |
| 4487 for (int i = 0; i < elements_length; i++) { |
| 4488 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); |
| 4489 Handle<Object> value = JSObject::GetElement(object, i); |
| 4490 if (value->IsJSObject()) { |
| 4491 Handle<JSObject> value_object = Handle<JSObject>::cast(value); |
| 4492 __ lea(ecx, Operand(result, *offset)); |
| 4493 __ mov(FieldOperand(result, total_offset), ecx); |
| 4494 __ LoadHeapObject(source, value_object); |
| 4495 EmitDeepCopy(value_object, result, source, offset); |
| 4496 } else if (value->IsHeapObject()) { |
| 4497 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); |
| 4498 __ mov(FieldOperand(result, total_offset), ecx); |
| 4499 } else { |
| 4500 __ mov(FieldOperand(result, total_offset), Immediate(value)); |
| 4501 } |
| 4502 } |
4489 } else { | 4503 } else { |
4490 __ mov(FieldOperand(result, total_offset), Immediate(value)); | 4504 UNREACHABLE(); |
4491 } | 4505 } |
4492 } | 4506 } |
4493 } | 4507 } |
4494 | 4508 |
4495 | 4509 |
4496 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 4510 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
4497 ASSERT(ToRegister(instr->context()).is(esi)); | 4511 ASSERT(ToRegister(instr->context()).is(esi)); |
4498 int size = instr->hydrogen()->total_size(); | 4512 int size = instr->hydrogen()->total_size(); |
4499 | 4513 |
4500 // Allocate all objects that are part of the literal in one big | 4514 // Allocate all objects that are part of the literal in one big |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4963 FixedArray::kHeaderSize - kPointerSize)); | 4977 FixedArray::kHeaderSize - kPointerSize)); |
4964 __ bind(&done); | 4978 __ bind(&done); |
4965 } | 4979 } |
4966 | 4980 |
4967 | 4981 |
4968 #undef __ | 4982 #undef __ |
4969 | 4983 |
4970 } } // namespace v8::internal | 4984 } } // namespace v8::internal |
4971 | 4985 |
4972 #endif // V8_TARGET_ARCH_IA32 | 4986 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |