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

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

Issue 12220074: Compile FastCloneShallowObjectStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Implemented port to ARM. Created 7 years, 10 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 2622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2633 // Get the deoptimization index of the LLazyBailout-environment that 2633 // Get the deoptimization index of the LLazyBailout-environment that
2634 // corresponds to this instruction. 2634 // corresponds to this instruction.
2635 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment(); 2635 LEnvironment* env = instr->GetDeferredLazyDeoptimizationEnvironment();
2636 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index()); 2636 safepoints_.RecordLazyDeoptimizationIndex(env->deoptimization_index());
2637 2637
2638 // Put the result value into the eax slot and restore all registers. 2638 // Put the result value into the eax slot and restore all registers.
2639 __ StoreToSafepointRegisterSlot(eax, eax); 2639 __ StoreToSafepointRegisterSlot(eax, eax);
2640 } 2640 }
2641 2641
2642 2642
2643 void LCodeGen::DoInstanceSize(LInstanceSize* instr) {
2644 Register object = ToRegister(instr->object());
2645 Register result = ToRegister(instr->result());
2646 __ mov(result, FieldOperand(object, HeapObject::kMapOffset));
2647 __ movzx_b(result, FieldOperand(result, Map::kInstanceSizeOffset));
2648 }
2649
2650
2643 void LCodeGen::DoCmpT(LCmpT* instr) { 2651 void LCodeGen::DoCmpT(LCmpT* instr) {
2644 Token::Value op = instr->op(); 2652 Token::Value op = instr->op();
2645 2653
2646 Handle<Code> ic = CompareIC::GetUninitialized(op); 2654 Handle<Code> ic = CompareIC::GetUninitialized(op);
2647 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2655 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2648 2656
2649 Condition condition = ComputeCompareCondition(op); 2657 Condition condition = ComputeCompareCondition(op);
2650 Label true_value, done; 2658 Label true_value, done;
2651 __ test(eax, Operand(eax)); 2659 __ test(eax, Operand(eax));
2652 __ j(condition, &true_value, Label::kNear); 2660 __ j(condition, &true_value, Label::kNear);
(...skipping 2791 matching lines...) Expand 10 before | Expand all | Expand 10 after
5444 : LDeferredCode(codegen), instr_(instr) { } 5452 : LDeferredCode(codegen), instr_(instr) { }
5445 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5453 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
5446 virtual LInstruction* instr() { return instr_; } 5454 virtual LInstruction* instr() { return instr_; }
5447 private: 5455 private:
5448 LAllocate* instr_; 5456 LAllocate* instr_;
5449 }; 5457 };
5450 5458
5451 DeferredAllocate* deferred = 5459 DeferredAllocate* deferred =
5452 new(zone()) DeferredAllocate(this, instr); 5460 new(zone()) DeferredAllocate(this, instr);
5453 5461
5454 Register size = ToRegister(instr->size());
5455 Register result = ToRegister(instr->result()); 5462 Register result = ToRegister(instr->result());
5456 Register temp = ToRegister(instr->temp()); 5463 Register temp = ToRegister(instr->temp());
5457 5464
5458 HAllocate* original_instr = instr->hydrogen(); 5465 // Allocate memory for the object.
5459 if (original_instr->size()->IsConstant()) { 5466 AllocationFlags flags = TAG_OBJECT;
5460 UNREACHABLE(); 5467 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5468 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5469 }
5470 if (instr->size()->IsConstantOperand()) {
5471 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5472 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5461 } else { 5473 } else {
5462 // Allocate memory for the object. 5474 Register size = ToRegister(instr->size());
5463 AllocationFlags flags = TAG_OBJECT; 5475 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5464 if (original_instr->MustAllocateDoubleAligned()) {
5465 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5466 }
5467 __ AllocateInNewSpace(size, result, temp, no_reg,
5468 deferred->entry(), flags);
5469 } 5476 }
5470 5477
5471 __ bind(deferred->exit()); 5478 __ bind(deferred->exit());
5472 } 5479 }
5473 5480
5474 5481
5475 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { 5482 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5476 Register size = ToRegister(instr->size()); 5483 Register size = ToRegister(instr->size());
5477 Register result = ToRegister(instr->result()); 5484 Register result = ToRegister(instr->result());
5478 5485
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
5715 ASSERT_EQ(size, offset); 5722 ASSERT_EQ(size, offset);
5716 } 5723 }
5717 5724
5718 5725
5719 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 5726 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
5720 ASSERT(ToRegister(instr->context()).is(esi)); 5727 ASSERT(ToRegister(instr->context()).is(esi));
5721 Handle<FixedArray> literals(instr->environment()->closure()->literals()); 5728 Handle<FixedArray> literals(instr->environment()->closure()->literals());
5722 Handle<FixedArray> constant_properties = 5729 Handle<FixedArray> constant_properties =
5723 instr->hydrogen()->constant_properties(); 5730 instr->hydrogen()->constant_properties();
5724 5731
5725 // Set up the parameters to the stub/runtime call.
5726 __ PushHeapObject(literals);
5727 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
5728 __ push(Immediate(constant_properties));
5729 int flags = instr->hydrogen()->fast_elements() 5732 int flags = instr->hydrogen()->fast_elements()
5730 ? ObjectLiteral::kFastElements 5733 ? ObjectLiteral::kFastElements
5731 : ObjectLiteral::kNoFlags; 5734 : ObjectLiteral::kNoFlags;
5732 flags |= instr->hydrogen()->has_function() 5735 flags |= instr->hydrogen()->has_function()
5733 ? ObjectLiteral::kHasFunction 5736 ? ObjectLiteral::kHasFunction
5734 : ObjectLiteral::kNoFlags; 5737 : ObjectLiteral::kNoFlags;
5735 __ push(Immediate(Smi::FromInt(flags)));
5736 5738
5737 // Pick the right runtime function or stub to call. 5739 // Set up the parameters to the stub/runtime call and pick the right
5740 // runtime function or stub to call.
5738 int properties_count = constant_properties->length() / 2; 5741 int properties_count = constant_properties->length() / 2;
5739 if (instr->hydrogen()->depth() > 1) { 5742 if (instr->hydrogen()->depth() > 1) {
5743 __ PushHeapObject(literals);
5744 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
5745 __ push(Immediate(constant_properties));
5746 __ push(Immediate(Smi::FromInt(flags)));
5740 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 5747 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
5741 } else if (flags != ObjectLiteral::kFastElements || 5748 } else if (flags != ObjectLiteral::kFastElements ||
5742 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 5749 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
5750 __ PushHeapObject(literals);
5751 __ push(Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
5752 __ push(Immediate(constant_properties));
5753 __ push(Immediate(Smi::FromInt(flags)));
5743 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5754 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5744 } else { 5755 } else {
5756 __ LoadHeapObject(eax, literals);
5757 __ mov(ebx, Immediate(Smi::FromInt(instr->hydrogen()->literal_index())));
5758 __ mov(ecx, Immediate(constant_properties));
5759 __ mov(edx, Immediate(Smi::FromInt(flags)));
5745 FastCloneShallowObjectStub stub(properties_count); 5760 FastCloneShallowObjectStub stub(properties_count);
5746 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5761 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5747 } 5762 }
5748 } 5763 }
5749 5764
5750 5765
5751 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5766 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5752 ASSERT(ToRegister(instr->value()).is(eax)); 5767 ASSERT(ToRegister(instr->value()).is(eax));
5753 __ push(eax); 5768 __ push(eax);
5754 CallRuntime(Runtime::kToFastProperties, 1, instr); 5769 CallRuntime(Runtime::kToFastProperties, 1, instr);
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after
6178 FixedArray::kHeaderSize - kPointerSize)); 6193 FixedArray::kHeaderSize - kPointerSize));
6179 __ bind(&done); 6194 __ bind(&done);
6180 } 6195 }
6181 6196
6182 6197
6183 #undef __ 6198 #undef __
6184 6199
6185 } } // namespace v8::internal 6200 } } // namespace v8::internal
6186 6201
6187 #endif // V8_TARGET_ARCH_IA32 6202 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« src/hydrogen.h ('K') | « src/ia32/full-codegen-ia32.cc ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698