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) { |
Jakob Kummerow
2012/03/21 10:36:47
This should be FixedArrayBase::kHeaderSize (doesn'
| |
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 i_value; |
Jakob Kummerow
2012/03/21 10:36:47
Remove the "i_". Just "value".
The same applies to
Sven Panne
2012/03/21 11:04:12
To reduce copy-n-paste, adding a method to FixedDo
| |
4481 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | 4479 if (double_array->is_the_hole(i)) { |
4482 __ lea(ecx, Operand(result, *offset)); | 4480 i_value = kHoleNanInt64; |
4483 __ mov(FieldOperand(result, total_offset), ecx); | 4481 } else { |
4484 __ LoadHeapObject(source, value_object); | 4482 double value = double_array->get_scalar(i); |
4485 EmitDeepCopy(value_object, result, source, offset); | 4483 i_value = BitCast<int64_t, double>(value); |
4486 } else if (value->IsHeapObject()) { | 4484 } |
4487 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | 4485 int32_t i_value_low = i_value & 0xFFFFFFFF; |
4488 __ mov(FieldOperand(result, total_offset), ecx); | 4486 int32_t i_value_high = i_value >> 32; |
4487 int total_offset = | |
4488 elements_offset + FixedDoubleArray::OffsetOfElementAt(i); | |
4489 __ mov(FieldOperand(result, total_offset), Immediate(i_value_low)); | |
4490 __ mov(FieldOperand(result, total_offset + 4), Immediate(i_value_high)); | |
4491 } | |
4492 } else if (elements->IsFixedArray()) { | |
4493 for (int i = 0; i < elements_length; i++) { | |
4494 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); | |
4495 Handle<Object> value = JSObject::GetElement(object, i); | |
4496 if (value->IsJSObject()) { | |
4497 Handle<JSObject> value_object = Handle<JSObject>::cast(value); | |
4498 __ lea(ecx, Operand(result, *offset)); | |
4499 __ mov(FieldOperand(result, total_offset), ecx); | |
4500 __ LoadHeapObject(source, value_object); | |
4501 EmitDeepCopy(value_object, result, source, offset); | |
4502 } else if (value->IsHeapObject()) { | |
4503 __ LoadHeapObject(ecx, Handle<HeapObject>::cast(value)); | |
4504 __ mov(FieldOperand(result, total_offset), ecx); | |
4505 } else { | |
4506 __ mov(FieldOperand(result, total_offset), Immediate(value)); | |
4507 } | |
4508 } | |
4489 } else { | 4509 } else { |
4490 __ mov(FieldOperand(result, total_offset), Immediate(value)); | 4510 UNREACHABLE(); |
4491 } | 4511 } |
4492 } | 4512 } |
4493 } | 4513 } |
4494 | 4514 |
4495 | 4515 |
4496 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { | 4516 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { |
4497 ASSERT(ToRegister(instr->context()).is(esi)); | 4517 ASSERT(ToRegister(instr->context()).is(esi)); |
4498 int size = instr->hydrogen()->total_size(); | 4518 int size = instr->hydrogen()->total_size(); |
4499 | 4519 |
4500 // Allocate all objects that are part of the literal in one big | 4520 // 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)); | 4983 FixedArray::kHeaderSize - kPointerSize)); |
4964 __ bind(&done); | 4984 __ bind(&done); |
4965 } | 4985 } |
4966 | 4986 |
4967 | 4987 |
4968 #undef __ | 4988 #undef __ |
4969 | 4989 |
4970 } } // namespace v8::internal | 4990 } } // namespace v8::internal |
4971 | 4991 |
4972 #endif // V8_TARGET_ARCH_IA32 | 4992 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |