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

Side by Side Diff: src/x64/lithium-codegen-x64.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: 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
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 4211 matching lines...) Expand 10 before | Expand all | Expand 10 after
4222 EmitDeepCopy(value_object, result, source, offset); 4222 EmitDeepCopy(value_object, result, source, offset);
4223 } else if (value->IsHeapObject()) { 4223 } else if (value->IsHeapObject()) {
4224 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value)); 4224 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value));
4225 __ movq(FieldOperand(result, total_offset), rcx); 4225 __ movq(FieldOperand(result, total_offset), rcx);
4226 } else { 4226 } else {
4227 __ movq(rcx, value, RelocInfo::NONE); 4227 __ movq(rcx, value, RelocInfo::NONE);
4228 __ movq(FieldOperand(result, total_offset), rcx); 4228 __ movq(FieldOperand(result, total_offset), rcx);
4229 } 4229 }
4230 } 4230 }
4231 4231
4232 // Copy elements backing store header.
4233 ASSERT(!has_elements || elements->IsFixedArray());
4234 if (has_elements) { 4232 if (has_elements) {
4233 // Copy elements backing store header.
4235 __ LoadHeapObject(source, elements); 4234 __ LoadHeapObject(source, elements);
4236 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) { 4235 for (int i = 0; i < FixedArray::kHeaderSize; i += kPointerSize) {
4237 __ movq(rcx, FieldOperand(source, i)); 4236 __ movq(rcx, FieldOperand(source, i));
4238 __ movq(FieldOperand(result, elements_offset + i), rcx); 4237 __ movq(FieldOperand(result, elements_offset + i), rcx);
4239 } 4238 }
4240 }
4241 4239
4242 // Copy elements backing store content. 4240 // Copy elements backing store content.
4243 ASSERT(!has_elements || elements->IsFixedArray()); 4241 int elements_length = elements->length();
4244 int elements_length = has_elements ? elements->length() : 0; 4242 if (elements->IsFixedDoubleArray()) {
4245 for (int i = 0; i < elements_length; i++) { 4243 Handle<FixedDoubleArray> double_array =
4246 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i); 4244 Handle<FixedDoubleArray>::cast(elements);
4247 Handle<Object> value = JSObject::GetElement(object, i); 4245 for (int i = 0; i < elements_length; i++) {
4248 if (value->IsJSObject()) { 4246 int64_t i_value;
4249 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 4247 if (double_array->is_the_hole(i)) {
4250 __ lea(rcx, Operand(result, *offset)); 4248 i_value = kHoleNanInt64;
4251 __ movq(FieldOperand(result, total_offset), rcx); 4249 } else {
4252 __ LoadHeapObject(source, value_object); 4250 double value = double_array->get_scalar(i);
4253 EmitDeepCopy(value_object, result, source, offset); 4251 i_value = BitCast<int64_t, double>(value);
4254 } else if (value->IsHeapObject()) { 4252 }
4255 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value)); 4253 int total_offset =
4256 __ movq(FieldOperand(result, total_offset), rcx); 4254 elements_offset + FixedDoubleArray::OffsetOfElementAt(i);
4255 __ movq(rcx, i_value, RelocInfo::NONE);
4256 __ movq(FieldOperand(result, total_offset), rcx);
4257 }
4258 } else if (elements->IsFixedArray()) {
4259 for (int i = 0; i < elements_length; i++) {
4260 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
4261 Handle<Object> value = JSObject::GetElement(object, i);
4262 if (value->IsJSObject()) {
4263 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
4264 __ lea(rcx, Operand(result, *offset));
4265 __ movq(FieldOperand(result, total_offset), rcx);
4266 __ LoadHeapObject(source, value_object);
4267 EmitDeepCopy(value_object, result, source, offset);
4268 } else if (value->IsHeapObject()) {
4269 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value));
4270 __ movq(FieldOperand(result, total_offset), rcx);
4271 } else {
4272 __ movq(rcx, value, RelocInfo::NONE);
4273 __ movq(FieldOperand(result, total_offset), rcx);
4274 }
4275 }
4257 } else { 4276 } else {
4258 __ movq(rcx, value, RelocInfo::NONE); 4277 UNREACHABLE();
4259 __ movq(FieldOperand(result, total_offset), rcx);
4260 } 4278 }
4261 } 4279 }
4262 } 4280 }
4263 4281
4264 4282
4265 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { 4283 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4266 int size = instr->hydrogen()->total_size(); 4284 int size = instr->hydrogen()->total_size();
4267 4285
4268 // Allocate all objects that are part of the literal in one big 4286 // Allocate all objects that are part of the literal in one big
4269 // allocation. This avoids multiple limit checks. 4287 // allocation. This avoids multiple limit checks.
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 FixedArray::kHeaderSize - kPointerSize)); 4760 FixedArray::kHeaderSize - kPointerSize));
4743 __ bind(&done); 4761 __ bind(&done);
4744 } 4762 }
4745 4763
4746 4764
4747 #undef __ 4765 #undef __
4748 4766
4749 } } // namespace v8::internal 4767 } } // namespace v8::internal
4750 4768
4751 #endif // V8_TARGET_ARCH_X64 4769 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/ia32/lithium-codegen-ia32.cc ('K') | « src/ia32/lithium-codegen-ia32.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698