Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: src/arm/lithium-codegen-arm.cc

Issue 9814006: First implementation of fast path for instantiation of array literals composed of doubles. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed core review comments. Created 8 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | src/objects-inl.h » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 4589 matching lines...) Expand 10 before | Expand all | Expand 10 after
4600 EmitDeepCopy(value_object, result, source, offset); 4600 EmitDeepCopy(value_object, result, source, offset);
4601 } else if (value->IsHeapObject()) { 4601 } else if (value->IsHeapObject()) {
4602 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); 4602 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value));
4603 __ str(r2, FieldMemOperand(result, total_offset)); 4603 __ str(r2, FieldMemOperand(result, total_offset));
4604 } else { 4604 } else {
4605 __ mov(r2, Operand(value)); 4605 __ mov(r2, Operand(value));
4606 __ str(r2, FieldMemOperand(result, total_offset)); 4606 __ str(r2, FieldMemOperand(result, total_offset));
4607 } 4607 }
4608 } 4608 }
4609 4609
4610 // Copy elements backing store header.
4611 ASSERT(!has_elements || elements->IsFixedArray());
4612 if (has_elements) { 4610 if (has_elements) {
4611 // Copy elements backing store header.
4613 __ LoadHeapObject(source, elements); 4612 __ LoadHeapObject(source, elements);
4614 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { 4613 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) {
4615 __ ldr(r2, FieldMemOperand(source, i)); 4614 __ ldr(r2, FieldMemOperand(source, i));
4616 __ str(r2, FieldMemOperand(result, elements_offset + i)); 4615 __ str(r2, FieldMemOperand(result, elements_offset + i));
4617 } 4616 }
4618 }
4619 4617
4620 // Copy elements backing store content. 4618 // Copy elements backing store content.
4621 ASSERT(!has_elements || elements->IsFixedArray()); 4619 int elements_length = has_elements ? elements->length() : 0;
4622 int elements_length = has_elements ? elements->length() : 0; 4620 if (elements->IsFixedDoubleArray()) {
4623 for (int i = 0; i < elements_length; i++) { 4621 Handle<FixedDoubleArray> double_array =
4624 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); 4622 Handle<FixedDoubleArray>::cast(elements);
4625 Handle<Object> value = JSObject::GetElement(object, i); 4623 for (int i = 0; i < elements_length; i++) {
4626 if (value->IsJSObject()) { 4624 int64_t value = double_array->get_representation(i);
4627 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 4625 // We only support little endian mode...
4628 __ add(r2, result, Operand(*offset)); 4626 int32_t value_low = value & 0xFFFFFFFF;
4629 __ str(r2, FieldMemOperand(result, total_offset)); 4627 int32_t value_high = value >> 32;
4630 __ LoadHeapObject(source, value_object); 4628 int total_offset =
4631 EmitDeepCopy(value_object, result, source, offset); 4629 elements_offset + FixedDoubleArray::OffsetOfElementAt(i);
4632 } else if (value->IsHeapObject()) { 4630 __ mov(r2, Operand(value_low));
4633 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value)); 4631 __ str(r2, FieldMemOperand(result, total_offset));
4634 __ str(r2, FieldMemOperand(result, total_offset)); 4632 __ mov(r2, Operand(value_high));
4633 __ str(r2, FieldMemOperand(result, total_offset + 4));
4634 }
4635 } else if (elements->IsFixedArray()) {
4636 for (int i = 0; i < elements_length; i++) {
4637 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
4638 Handle<Object> value = JSObject::GetElement(object, i);
4639 if (value->IsJSObject()) {
4640 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
4641 __ add(r2, result, Operand(*offset));
4642 __ str(r2, FieldMemOperand(result, total_offset));
4643 __ LoadHeapObject(source, value_object);
4644 EmitDeepCopy(value_object, result, source, offset);
4645 } else if (value->IsHeapObject()) {
4646 __ LoadHeapObject(r2, Handle<HeapObject>::cast(value));
4647 __ str(r2, FieldMemOperand(result, total_offset));
4648 } else {
4649 __ mov(r2, Operand(value));
4650 __ str(r2, FieldMemOperand(result, total_offset));
4651 }
4652 }
4635 } else { 4653 } else {
4636 __ mov(r2, Operand(value)); 4654 UNREACHABLE();
4637 __ str(r2, FieldMemOperand(result, total_offset));
4638 } 4655 }
4639 } 4656 }
4640 } 4657 }
4641 4658
4642 4659
4643 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { 4660 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4644 int size = instr->hydrogen()->total_size(); 4661 int size = instr->hydrogen()->total_size();
4645 4662
4646 // Allocate all objects that are part of the literal in one big 4663 // Allocate all objects that are part of the literal in one big
4647 // allocation. This avoids multiple limit checks. 4664 // allocation. This avoids multiple limit checks.
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
5112 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize)); 5129 __ sub(scratch, result, Operand(index, LSL, kPointerSizeLog2 - kSmiTagSize));
5113 __ ldr(result, FieldMemOperand(scratch, 5130 __ ldr(result, FieldMemOperand(scratch,
5114 FixedArray::kHeaderSize - kPointerSize)); 5131 FixedArray::kHeaderSize - kPointerSize));
5115 __ bind(&done); 5132 __ bind(&done);
5116 } 5133 }
5117 5134
5118 5135
5119 #undef __ 5136 #undef __
5120 5137
5121 } } // namespace v8::internal 5138 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | src/hydrogen.cc » ('j') | src/objects-inl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698