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

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

Issue 8640001: Implement crankshaft support for nested object literals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ported lithium part to x64 and ARM. Created 9 years 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 | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 4308 matching lines...) Expand 10 before | Expand all | Expand 10 after
4319 FastCloneShallowArrayStub::Mode mode = 4319 FastCloneShallowArrayStub::Mode mode =
4320 constant_elements_kind == FAST_DOUBLE_ELEMENTS 4320 constant_elements_kind == FAST_DOUBLE_ELEMENTS
4321 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS 4321 ? FastCloneShallowArrayStub::CLONE_DOUBLE_ELEMENTS
4322 : FastCloneShallowArrayStub::CLONE_ELEMENTS; 4322 : FastCloneShallowArrayStub::CLONE_ELEMENTS;
4323 FastCloneShallowArrayStub stub(mode, length); 4323 FastCloneShallowArrayStub stub(mode, length);
4324 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 4324 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
4325 } 4325 }
4326 } 4326 }
4327 4327
4328 4328
4329 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 4329 void LCodeGen::EmitDeepCopy(Handle<JSObject> object,
4330 Register result,
4331 Register source,
4332 int* offset) {
4333 ASSERT(!source.is(r2));
4334 ASSERT(!result.is(r2));
4335
4336 // Increase the offset so that subsequent objects end up right after
4337 // this one.
4338 int current_offset = *offset;
4339 int size = object->map()->instance_size();
4340 *offset += size;
4341
4342 // Copy object header.
4343 ASSERT(object->properties()->length() == 0);
4344 ASSERT(object->elements()->length() == 0 ||
4345 object->elements()->map() == isolate()->heap()->fixed_cow_array_map());
4346 int inobject_properties = object->map()->inobject_properties();
4347 int header_size = size - inobject_properties * kPointerSize;
4348 for (int i = 0; i < header_size; i += kPointerSize) {
4349 __ ldr(r2, FieldMemOperand(source, i));
4350 __ str(r2, FieldMemOperand(result, current_offset + i));
4351 }
4352
4353 // Copy in-object properties.
4354 for (int i = 0; i < inobject_properties; i++) {
4355 int total_offset = current_offset + object->GetInObjectPropertyOffset(i);
4356 Handle<Object> value = Handle<Object>(object->InObjectPropertyAt(i));
4357 if (value->IsJSObject()) {
4358 Handle<JSObject> value_object = Handle<JSObject>::cast(value);
4359 __ add(r2, result, Operand(*offset));
4360 __ str(r2, FieldMemOperand(result, total_offset));
4361 LoadHeapObject(source, value_object);
4362 EmitDeepCopy(value_object, result, source, offset);
4363 } else if (value->IsHeapObject()) {
4364 LoadHeapObject(r2, Handle<HeapObject>::cast(value));
4365 __ str(r2, FieldMemOperand(result, total_offset));
4366 } else {
4367 __ mov(r2, Operand(value));
4368 __ str(r2, FieldMemOperand(result, total_offset));
4369 }
4370 }
4371 }
4372
4373
4374 void LCodeGen::DoObjectLiteralFast(LObjectLiteralFast* instr) {
4375 int size = instr->hydrogen()->total_size();
4376
4377 // Allocate all objects that are part of the literal in one big
4378 // allocation. This avoids multiple limit checks.
4379 Label allocated, runtime_allocate;
4380 __ AllocateInNewSpace(size, r0, r2, r3, &runtime_allocate, TAG_OBJECT);
4381 __ jmp(&allocated);
4382
4383 __ bind(&runtime_allocate);
4384 __ mov(r0, Operand(Smi::FromInt(size)));
4385 __ push(r0);
4386 CallRuntime(Runtime::kAllocateInNewSpace, 1, instr);
4387
4388 __ bind(&allocated);
4389 int offset = 0;
4390 LoadHeapObject(r1, instr->hydrogen()->boilerplate());
4391 EmitDeepCopy(instr->hydrogen()->boilerplate(), r0, r1, &offset);
4392 ASSERT_EQ(size, offset);
4393 }
4394
4395
4396 void LCodeGen::DoObjectLiteralGeneric(LObjectLiteralGeneric* instr) {
4330 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 4397 __ ldr(r4, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
4331 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset)); 4398 __ ldr(r4, FieldMemOperand(r4, JSFunction::kLiteralsOffset));
4332 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index()))); 4399 __ mov(r3, Operand(Smi::FromInt(instr->hydrogen()->literal_index())));
4333 __ mov(r2, Operand(instr->hydrogen()->constant_properties())); 4400 __ mov(r2, Operand(instr->hydrogen()->constant_properties()));
4334 __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0))); 4401 __ mov(r1, Operand(Smi::FromInt(instr->hydrogen()->fast_elements() ? 1 : 0)));
4335 __ Push(r4, r3, r2, r1); 4402 __ Push(r4, r3, r2, r1);
4336 4403
4337 // Pick the right runtime function to call. 4404 // Pick the right runtime function to call.
4338 if (instr->hydrogen()->depth() > 1) { 4405 if (instr->hydrogen()->depth() > 1) {
4339 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 4406 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 ASSERT(osr_pc_offset_ == -1); 4749 ASSERT(osr_pc_offset_ == -1);
4683 osr_pc_offset_ = masm()->pc_offset(); 4750 osr_pc_offset_ = masm()->pc_offset();
4684 } 4751 }
4685 4752
4686 4753
4687 4754
4688 4755
4689 #undef __ 4756 #undef __
4690 4757
4691 } } // namespace v8::internal 4758 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/arm/lithium-codegen-arm.h ('k') | src/hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698