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

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: 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 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 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after
2450 Label done; 2450 Label done;
2451 __ j(not_zero, &load_false); 2451 __ j(not_zero, &load_false);
2452 __ LoadRoot(rax, Heap::kTrueValueRootIndex); 2452 __ LoadRoot(rax, Heap::kTrueValueRootIndex);
2453 __ jmp(&done); 2453 __ jmp(&done);
2454 __ bind(&load_false); 2454 __ bind(&load_false);
2455 __ LoadRoot(rax, Heap::kFalseValueRootIndex); 2455 __ LoadRoot(rax, Heap::kFalseValueRootIndex);
2456 __ bind(&done); 2456 __ bind(&done);
2457 } 2457 }
2458 2458
2459 2459
2460 void LCodeGen::DoInstanceSize(LInstanceSize* instr) {
2461 Register object = ToRegister(instr->object());
2462 Register result = ToRegister(instr->result());
2463 __ movq(result, FieldOperand(object, HeapObject::kMapOffset));
2464 __ movzxbq(result, FieldOperand(result, Map::kInstanceSizeOffset));
2465 }
2466
2467
2460 void LCodeGen::DoCmpT(LCmpT* instr) { 2468 void LCodeGen::DoCmpT(LCmpT* instr) {
2461 Token::Value op = instr->op(); 2469 Token::Value op = instr->op();
2462 2470
2463 Handle<Code> ic = CompareIC::GetUninitialized(op); 2471 Handle<Code> ic = CompareIC::GetUninitialized(op);
2464 CallCode(ic, RelocInfo::CODE_TARGET, instr); 2472 CallCode(ic, RelocInfo::CODE_TARGET, instr);
2465 2473
2466 Condition condition = TokenToCondition(op, false); 2474 Condition condition = TokenToCondition(op, false);
2467 Label true_value, done; 2475 Label true_value, done;
2468 __ testq(rax, rax); 2476 __ testq(rax, rax);
2469 __ j(condition, &true_value, Label::kNear); 2477 __ j(condition, &true_value, Label::kNear);
(...skipping 2547 matching lines...) Expand 10 before | Expand all | Expand 10 after
5017 : LDeferredCode(codegen), instr_(instr) { } 5025 : LDeferredCode(codegen), instr_(instr) { }
5018 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); } 5026 virtual void Generate() { codegen()->DoDeferredAllocate(instr_); }
5019 virtual LInstruction* instr() { return instr_; } 5027 virtual LInstruction* instr() { return instr_; }
5020 private: 5028 private:
5021 LAllocate* instr_; 5029 LAllocate* instr_;
5022 }; 5030 };
5023 5031
5024 DeferredAllocate* deferred = 5032 DeferredAllocate* deferred =
5025 new(zone()) DeferredAllocate(this, instr); 5033 new(zone()) DeferredAllocate(this, instr);
5026 5034
5027 Register size = ToRegister(instr->size());
5028 Register result = ToRegister(instr->result()); 5035 Register result = ToRegister(instr->result());
5029 Register temp = ToRegister(instr->temp()); 5036 Register temp = ToRegister(instr->temp());
5030 5037
5031 HAllocate* original_instr = instr->hydrogen(); 5038 // Allocate memory for the object.
5032 if (original_instr->size()->IsConstant()) { 5039 AllocationFlags flags = TAG_OBJECT;
5033 UNREACHABLE(); 5040 if (instr->hydrogen()->MustAllocateDoubleAligned()) {
5041 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5042 }
5043 if (instr->size()->IsConstantOperand()) {
5044 int32_t size = ToInteger32(LConstantOperand::cast(instr->size()));
5045 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5034 } else { 5046 } else {
5035 // Allocate memory for the object. 5047 Register size = ToRegister(instr->size());
5036 AllocationFlags flags = TAG_OBJECT; 5048 __ AllocateInNewSpace(size, result, temp, no_reg, deferred->entry(), flags);
5037 if (original_instr->MustAllocateDoubleAligned()) {
5038 flags = static_cast<AllocationFlags>(flags | DOUBLE_ALIGNMENT);
5039 }
5040 __ AllocateInNewSpace(size, result, temp, no_reg,
5041 deferred->entry(), flags);
5042 } 5049 }
5043 5050
5044 __ bind(deferred->exit()); 5051 __ bind(deferred->exit());
5045 } 5052 }
5046 5053
5047 5054
5048 void LCodeGen::DoDeferredAllocate(LAllocate* instr) { 5055 void LCodeGen::DoDeferredAllocate(LAllocate* instr) {
5049 Register size = ToRegister(instr->size()); 5056 Register size = ToRegister(instr->size());
5050 Register result = ToRegister(instr->result()); 5057 Register result = ToRegister(instr->result());
5051 5058
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
5269 instr->hydrogen()->allocation_site_mode()); 5276 instr->hydrogen()->allocation_site_mode());
5270 ASSERT_EQ(size, offset); 5277 ASSERT_EQ(size, offset);
5271 } 5278 }
5272 5279
5273 5280
5274 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) { 5281 void LCodeGen::DoObjectLiteral(LObjectLiteral* instr) {
5275 Handle<FixedArray> literals(instr->environment()->closure()->literals()); 5282 Handle<FixedArray> literals(instr->environment()->closure()->literals());
5276 Handle<FixedArray> constant_properties = 5283 Handle<FixedArray> constant_properties =
5277 instr->hydrogen()->constant_properties(); 5284 instr->hydrogen()->constant_properties();
5278 5285
5279 // Set up the parameters to the stub/runtime call.
5280 __ PushHeapObject(literals);
5281 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5282 __ Push(constant_properties);
5283 int flags = instr->hydrogen()->fast_elements() 5286 int flags = instr->hydrogen()->fast_elements()
5284 ? ObjectLiteral::kFastElements 5287 ? ObjectLiteral::kFastElements
5285 : ObjectLiteral::kNoFlags; 5288 : ObjectLiteral::kNoFlags;
5286 flags |= instr->hydrogen()->has_function() 5289 flags |= instr->hydrogen()->has_function()
5287 ? ObjectLiteral::kHasFunction 5290 ? ObjectLiteral::kHasFunction
5288 : ObjectLiteral::kNoFlags; 5291 : ObjectLiteral::kNoFlags;
5289 __ Push(Smi::FromInt(flags));
5290 5292
5291 // Pick the right runtime function or stub to call. 5293 // Set up the parameters to the stub/runtime call and pick the right
5294 // runtime function or stub to call.
5292 int properties_count = constant_properties->length() / 2; 5295 int properties_count = constant_properties->length() / 2;
5293 if (instr->hydrogen()->depth() > 1) { 5296 if (instr->hydrogen()->depth() > 1) {
5297 __ PushHeapObject(literals);
5298 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5299 __ Push(constant_properties);
5300 __ Push(Smi::FromInt(flags));
5294 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr); 5301 CallRuntime(Runtime::kCreateObjectLiteral, 4, instr);
5295 } else if (flags != ObjectLiteral::kFastElements || 5302 } else if (flags != ObjectLiteral::kFastElements ||
5296 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { 5303 properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) {
5304 __ PushHeapObject(literals);
5305 __ Push(Smi::FromInt(instr->hydrogen()->literal_index()));
5306 __ Push(constant_properties);
5307 __ Push(Smi::FromInt(flags));
5297 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr); 5308 CallRuntime(Runtime::kCreateObjectLiteralShallow, 4, instr);
5298 } else { 5309 } else {
5310 __ LoadHeapObject(rax, literals);
5311 __ Move(rbx, Smi::FromInt(instr->hydrogen()->literal_index()));
5312 __ Move(rcx, constant_properties);
5313 __ Move(rdx, Smi::FromInt(flags));
5299 FastCloneShallowObjectStub stub(properties_count); 5314 FastCloneShallowObjectStub stub(properties_count);
5300 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr); 5315 CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
5301 } 5316 }
5302 } 5317 }
5303 5318
5304 5319
5305 void LCodeGen::DoToFastProperties(LToFastProperties* instr) { 5320 void LCodeGen::DoToFastProperties(LToFastProperties* instr) {
5306 ASSERT(ToRegister(instr->value()).is(rax)); 5321 ASSERT(ToRegister(instr->value()).is(rax));
5307 __ push(rax); 5322 __ push(rax);
5308 CallRuntime(Runtime::kToFastProperties, 1, instr); 5323 CallRuntime(Runtime::kToFastProperties, 1, instr);
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after
5742 FixedArray::kHeaderSize - kPointerSize)); 5757 FixedArray::kHeaderSize - kPointerSize));
5743 __ bind(&done); 5758 __ bind(&done);
5744 } 5759 }
5745 5760
5746 5761
5747 #undef __ 5762 #undef __
5748 5763
5749 } } // namespace v8::internal 5764 } } // namespace v8::internal
5750 5765
5751 #endif // V8_TARGET_ARCH_X64 5766 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/hydrogen.h ('K') | « 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