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

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

Issue 9834044: MIPS: First implementation of fast path for instantiation of array literals composed of doubles. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
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 4487 matching lines...) Expand 10 before | Expand all | Expand 10 after
4498 } else if (value->IsHeapObject()) { 4498 } else if (value->IsHeapObject()) {
4499 __ LoadHeapObject(a2, Handle<HeapObject>::cast(value)); 4499 __ LoadHeapObject(a2, Handle<HeapObject>::cast(value));
4500 __ sw(a2, FieldMemOperand(result, total_offset)); 4500 __ sw(a2, FieldMemOperand(result, total_offset));
4501 } else { 4501 } else {
4502 __ li(a2, Operand(value)); 4502 __ li(a2, Operand(value));
4503 __ sw(a2, FieldMemOperand(result, total_offset)); 4503 __ sw(a2, FieldMemOperand(result, total_offset));
4504 } 4504 }
4505 } 4505 }
4506 4506
4507 4507
4508 // Copy elements backing store header.
4509 ASSERT(!has_elements || elements->IsFixedArray());
4510 if (has_elements) { 4508 if (has_elements) {
4509 // Copy elements backing store header.
4511 __ LoadHeapObject(source, elements); 4510 __ LoadHeapObject(source, elements);
4512 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { 4511 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) {
4513 __ lw(a2, FieldMemOperand(source, i)); 4512 __ lw(a2, FieldMemOperand(source, i));
4514 __ sw(a2, FieldMemOperand(result, elements_offset + i)); 4513 __ sw(a2, FieldMemOperand(result, elements_offset + i));
4515 } 4514 }
4516 }
4517 4515
4518 // Copy elements backing store content. 4516 // Copy elements backing store content.
4519 ASSERT(!has_elements || elements->IsFixedArray()); 4517 int elements_length = has_elements ? elements->length() : 0;
4520 int elements_length = has_elements ? elements->length() : 0; 4518 if (elements->IsFixedDoubleArray()) {
4521 for (int i = 0; i < elements_length; i++) { 4519 Handle<FixedDoubleArray> double_array =
4522 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); 4520 Handle<FixedDoubleArray>::cast(elements);
4523 Handle<Object> value = JSObject::GetElement(object, i); 4521 for (int i = 0; i < elements_length; i++) {
4524 if (value->IsJSObject()) { 4522 int64_t value = double_array->get_representation(i);
4525 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 4523 // We only support little endian mode...
4526 __ Addu(a2, result, Operand(*offset)); 4524 int32_t value_low = value & 0xFFFFFFFF;
4527 __ sw(a2, FieldMemOperand(result, total_offset)); 4525 int32_t value_high = value >> 32;
4528 __ LoadHeapObject(source, value_object); 4526 int total_offset =
4529 EmitDeepCopy(value_object, result, source, offset); 4527 elements_offset + FixedDoubleArray::OffsetOfElementAt(i);
4530 } else if (value->IsHeapObject()) { 4528 __ li(a2, Operand(value_low));
4531 __ LoadHeapObject(a2, Handle<HeapObject>::cast(value)); 4529 __ sw(a2, FieldMemOperand(result, total_offset));
4532 __ sw(a2, FieldMemOperand(result, total_offset)); 4530 __ li(a2, Operand(value_high));
4531 __ sw(a2, FieldMemOperand(result, total_offset + 4));
4532 }
4533 } else if (elements->IsFixedArray()) {
4534 for (int i = 0; i < elements_length; i++) {
4535 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
4536 Handle<Object> value = JSObject::GetElement(object, i);
4537 if (value->IsJSObject()) {
4538 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
4539 __ Addu(a2, result, Operand(*offset));
4540 __ sw(a2, FieldMemOperand(result, total_offset));
4541 __ LoadHeapObject(source, value_object);
4542 EmitDeepCopy(value_object, result, source, offset);
4543 } else if (value->IsHeapObject()) {
4544 __ LoadHeapObject(a2, Handle<HeapObject>::cast(value));
4545 __ sw(a2, FieldMemOperand(result, total_offset));
4546 } else {
4547 __ li(a2, Operand(value));
4548 __ sw(a2, FieldMemOperand(result, total_offset));
4549 }
4550 }
4533 } else { 4551 } else {
4534 __ li(a2, Operand(value)); 4552 UNREACHABLE();
4535 __ sw(a2, FieldMemOperand(result, total_offset));
4536 } 4553 }
4537 } 4554 }
4538 } 4555 }
4539 4556
4540 4557
4541 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { 4558 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4542 int size = instr->hydrogen()->total_size(); 4559 int size = instr->hydrogen()->total_size();
4543 4560
4544 // Allocate all objects that are part of the literal in one big 4561 // Allocate all objects that are part of the literal in one big
4545 // allocation. This avoids multiple limit checks. 4562 // allocation. This avoids multiple limit checks.
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
5047 __ Subu(scratch, result, scratch); 5064 __ Subu(scratch, result, scratch);
5048 __ lw(result, FieldMemOperand(scratch, 5065 __ lw(result, FieldMemOperand(scratch,
5049 FixedArray::kHeaderSize - kPointerSize)); 5066 FixedArray::kHeaderSize - kPointerSize));
5050 __ bind(&done); 5067 __ bind(&done);
5051 } 5068 }
5052 5069
5053 5070
5054 #undef __ 5071 #undef __
5055 5072
5056 } } // namespace v8::internal 5073 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698