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

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

Issue 12220074: Compile FastCloneShallowObjectStub using Crankshaft. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Rebased. Created 7 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
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 2478 matching lines...) Expand 10 before | Expand all | Expand 10 after
2489 Label done; 2489 Label done;
2490 __ j(not_zero, &load_false); 2490 __ j(not_zero, &load_false);
2491 __ LoadRoot(rax, Heap::kTrueValueRootIndex); 2491 __ LoadRoot(rax, Heap::kTrueValueRootIndex);
2492 __ jmp(&done); 2492 __ jmp(&done);
2493 __ bind(&load_false); 2493 __ bind(&load_false);
2494 __ LoadRoot(rax, Heap::kFalseValueRootIndex); 2494 __ LoadRoot(rax, Heap::kFalseValueRootIndex);
2495 __ bind(&done); 2495 __ bind(&done);
2496 } 2496 }
2497 2497
2498 2498
2499 void LCodeGen::DoInstanceSize(LInstanceSize* instr) {
2500 Register object = ToRegister(instr->object());
2501 Register result = ToRegister(instr->result());
2502 __ movq(result, FieldOperand(object, HeapObject::kMapOffset));
2503 __ movzxbq(result, FieldOperand(result, Map::kInstanceSizeOffset));
2504 }
2505
2506
2499 void LCodeGen::DoCmpT(LCmpT* instr) { 2507 void LCodeGen::DoCmpT(LCmpT* instr) {
2500 Token::Value op = instr->op(); 2508 Token::Value op = instr->op();
2501 2509
2502 Handle<Code> ic = CompareIC::GetUninitialized(op); 2510 Handle<Code> ic = CompareIC::GetUninitialized(op);
2503 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2511 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2504 2512
2505 Condition condition = TokenToCondition(op, false); 2513 Condition condition = TokenToCondition(op, false);
2506 Label true_value, done; 2514 Label true_value, done;
2507 __ testq(rax, rax); 2515 __ testq(rax, rax);
2508 __ j(condition, &true_value, Label::kNear); 2516 __ j(condition, &true_value, Label::kNear);
(...skipping 2535 matching lines...) Expand 10 before | Expand all | Expand 10 after
5044 : LDeferredCode(codegen), instr_(instr) { } 5052 : LDeferredCode(codegen), instr_(instr) { }
5045 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5053 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
5046 virtual LInstruction* instr() { return instr_; } 5054 virtual LInstruction* instr() { return instr_; }
5047 private: 5055 private:
5048 LAllocate* instr_; 5056 LAllocate* instr_;
5049 }; 5057 };
5050 5058
5051 DeferredAllocate* deferred = 5059 DeferredAllocate* deferred =
5052 new(zone()) DeferredAllocate(this, instr); 5060 new(zone()) DeferredAllocate(this, instr);
5053 5061
5054 Register size = ToRegister(instr->size());
5055 Register result = ToRegister(instr->result()); 5062 Register result = ToRegister(instr->result());
5056 Register temp = ToRegister(instr->temp()); 5063 Register temp = ToRegister(instr->temp());
5057 5064
5058 HAllocate* original_instr = instr->hydrogen(); 5065 // Allocate memory for the object.
5059 if (original_instr->size()->IsConstant()) { 5066 AllocationFlags flags = TAG_OBJECT;
5060 UNREACHABLE(); 5067 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5068 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5069 }
5070 if (instr->size()->IsConstantOperand()) {
5071 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5072 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5061 } else { 5073 } else {
5062 // Allocate memory for the object. 5074 Register size = ToRegister(instr->size());
5063 AllocationFlags flags = TAG_OBJECT; 5075 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5064 if (original_instr->MustAllocateDoubleAligned()) {
5065 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5066 }
5067 __ AllocateInNewSpace(size, result, temp, no_reg,
5068 deferred->entry(), flags);
5069 } 5076 }
5070 5077
5071 __ bind(deferred->exit()); 5078 __ bind(deferred->exit());
5072 } 5079 }
5073 5080
5074 5081
5075 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { 5082 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5076 Register size = ToRegister(instr->size()); 5083 Register size = ToRegister(instr->size());
5077 Register result = ToRegister(instr->result()); 5084 Register result = ToRegister(instr->result());
5078 5085
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after
5297 instr->hydrogen()->allocation_site_mode()); 5304 instr->hydrogen()->allocation_site_mode());
5298 ASSERT_EQ(size, offset); 5305 ASSERT_EQ(size, offset);
5299 } 5306 }
5300 5307
5301 5308
5302 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 5309 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
5303 Handle<FixedArray> literals(instr->environment()->closure()->literals()); 5310 Handle<FixedArray> literals(instr->environment()->closure()->literals());
5304 Handle<FixedArray> constant_properties = 5311 Handle<FixedArray> constant_properties =
5305 instr->hydrogen()->constant_properties(); 5312 instr->hydrogen()->constant_properties();
5306 5313
5307 // Set up the parameters to the stub/runtime call.
5308 __ PushHeapObject(literals);
5309 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5310 __ Push(constant_properties);
5311 int flags = instr->hydrogen()->fast_elements() 5314 int flags = instr->hydrogen()->fast_elements()
5312 ? ObjectLiteral::kFastElements 5315 ? ObjectLiteral::kFastElements
5313 : ObjectLiteral::kNoFlags; 5316 : ObjectLiteral::kNoFlags;
5314 flags |= instr->hydrogen()->has_function() 5317 flags |= instr->hydrogen()->has_function()
5315 ? ObjectLiteral::kHasFunction 5318 ? ObjectLiteral::kHasFunction
5316 : ObjectLiteral::kNoFlags; 5319 : ObjectLiteral::kNoFlags;
5317 __ Push(Smi::FromInt(flags));
5318 5320
5319 // Pick the right runtime function or stub to call. 5321 // Set up the parameters to the stub/runtime call and pick the right
5322 // runtime function or stub to call.
5320 int properties_count = constant_properties->length() / 2; 5323 int properties_count = constant_properties->length() / 2;
5321 if (instr->hydrogen()->depth() > 1) { 5324 if (instr->hydrogen()->depth() > 1) {
5325 __ PushHeapObject(literals);
5326 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5327 __ Push(constant_properties);
5328 __ Push(Smi::FromInt(flags));
5322 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 5329 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
5323 } else if (flags != ObjectLiteral::kFastElements || 5330 } else if (flags != ObjectLiteral::kFastElements ||
5324 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 5331 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
5332 __ PushHeapObject(literals);
5333 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5334 __ Push(constant_properties);
5335 __ Push(Smi::FromInt(flags));
5325 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5336 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5326 } else { 5337 } else {
5338 __ LoadHeapObject(rax, literals);
5339 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index()));
5340 __ Move(rcx, constant_properties);
5341 __ Move(rdx, Smi::FromInt(flags));
5327 FastCloneShallowObjectStub stub(properties_count); 5342 FastCloneShallowObjectStub stub(properties_count);
5328 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5343 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5329 } 5344 }
5330 } 5345 }
5331 5346
5332 5347
5333 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5348 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5334 ASSERT(ToRegister(instr->value()).is(rax)); 5349 ASSERT(ToRegister(instr->value()).is(rax));
5335 __ push(rax); 5350 __ push(rax);
5336 CallRuntime(Runtime::kToFastProperties, 1, instr); 5351 CallRuntime(Runtime::kToFastProperties, 1, instr);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
5770 FixedArray::kHeaderSize - kPointerSize)); 5785 FixedArray::kHeaderSize - kPointerSize));
5771 __ bind(&done); 5786 __ bind(&done);
5772 } 5787 }
5773 5788
5774 5789
5775 #undef __ 5790 #undef __
5776 5791
5777 } } // namespace v8::internal 5792 } } // namespace v8::internal
5778 5793
5779 #endif // V8_TARGET_ARCH_X64 5794 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698