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

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: 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
« src/objects-inl.h ('K') | « src/objects-inl.h ('k') | 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 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 value = double_array->get_representation(i);
4249 Handle<JSObject> value_object = Handle<JSObject>::cast(value); 4247 int total_offset =
4250 __ lea(rcx, Operand(result, *offset)); 4248 elements_offset + FixedDoubleArray::OffsetOfElementAt(i);
4251 __ movq(FieldOperand(result, total_offset), rcx); 4249 __ movq(rcx, value, RelocInfo::NONE);
4252 __ LoadHeapObject(source, value_object); 4250 __ movq(FieldOperand(result, total_offset), rcx);
4253 EmitDeepCopy(value_object, result, source, offset); 4251 }
4254 } else if (value->IsHeapObject()) { 4252 } else if (elements->IsFixedArray()) {
4255 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value)); 4253 for (int i = 0; i < elements_length; i++) {
4256 __ movq(FieldOperand(result, total_offset), rcx); 4254 int total_offset = elements_offset + FixedArray::OffsetOfElementAt(i);
4255 Handle<Object> value = JSObject::GetElement(object, i);
4256 if (value->IsJSObject()) {
4257 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
4258 __ lea(rcx, Operand(result, *offset));
4259 __ movq(FieldOperand(result, total_offset), rcx);
4260 __ LoadHeapObject(source, value_object);
4261 EmitDeepCopy(value_object, result, source, offset);
4262 } else if (value->IsHeapObject()) {
4263 __ LoadHeapObject(rcx, Handle<HeapObject>::cast(value));
4264 __ movq(FieldOperand(result, total_offset), rcx);
4265 } else {
4266 __ movq(rcx, value, RelocInfo::NONE);
4267 __ movq(FieldOperand(result, total_offset), rcx);
4268 }
4269 }
4257 } else { 4270 } else {
4258 __ movq(rcx, value, RelocInfo::NONE); 4271 UNREACHABLE();
4259 __ movq(FieldOperand(result, total_offset), rcx);
4260 } 4272 }
4261 } 4273 }
4262 } 4274 }
4263 4275
4264 4276
4265 void LCodeGen::DoFastLiteral(LFastLiteral* instr) { 4277 void LCodeGen::DoFastLiteral(LFastLiteral* instr) {
4266 int size = instr->hydrogen()->total_size(); 4278 int size = instr->hydrogen()->total_size();
4267 4279
4268 // Allocate all objects that are part of the literal in one big 4280 // Allocate all objects that are part of the literal in one big
4269 // allocation. This avoids multiple limit checks. 4281 // allocation. This avoids multiple limit checks.
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after
4742 FixedArray::kHeaderSize - kPointerSize)); 4754 FixedArray::kHeaderSize - kPointerSize));
4743 __ bind(&done); 4755 __ bind(&done);
4744 } 4756 }
4745 4757
4746 4758
4747 #undef __ 4759 #undef __
4748 4760
4749 } } // namespace v8::internal 4761 } } // namespace v8::internal
4750 4762
4751 #endif // V8_TARGET_ARCH_X64 4763 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/objects-inl.h ('K') | « src/objects-inl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698