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

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

Issue 2078022: Complete the full codegenerator on x64. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 7 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/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.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 2010 the V8 project authors. All rights reserved. 1 // Copyright 2010 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 3822 matching lines...) Expand 10 before | Expand all | Expand 10 after
3833 3833
3834 __ Move(kScratchRegister, Factory::null_value()); 3834 __ Move(kScratchRegister, Factory::null_value());
3835 __ cmpq(obj.reg(), kScratchRegister); 3835 __ cmpq(obj.reg(), kScratchRegister);
3836 destination()->true_target()->Branch(equal); 3836 destination()->true_target()->Branch(equal);
3837 3837
3838 __ movq(kScratchRegister, FieldOperand(obj.reg(), HeapObject::kMapOffset)); 3838 __ movq(kScratchRegister, FieldOperand(obj.reg(), HeapObject::kMapOffset));
3839 // Undetectable objects behave like undefined when tested with typeof. 3839 // Undetectable objects behave like undefined when tested with typeof.
3840 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), 3840 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset),
3841 Immediate(1 << Map::kIsUndetectable)); 3841 Immediate(1 << Map::kIsUndetectable));
3842 destination()->false_target()->Branch(not_zero); 3842 destination()->false_target()->Branch(not_zero);
3843 __ CmpInstanceType(kScratchRegister, FIRST_JS_OBJECT_TYPE); 3843 __ movzxbq(kScratchRegister,
3844 destination()->false_target()->Branch(less); 3844 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset));
3845 __ CmpInstanceType(kScratchRegister, LAST_JS_OBJECT_TYPE); 3845 __ cmpq(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE));
3846 destination()->false_target()->Branch(below);
3847 __ cmpq(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE));
3846 obj.Unuse(); 3848 obj.Unuse();
3847 destination()->Split(less_equal); 3849 destination()->Split(below_equal);
3848 } 3850 }
3849 3851
3850 3852
3851 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { 3853 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
3852 // This generates a fast version of: 3854 // This generates a fast version of:
3853 // (%_ClassOf(arg) === 'Function') 3855 // (%_ClassOf(arg) === 'Function')
3854 ASSERT(args->length() == 1); 3856 ASSERT(args->length() == 1);
3855 Load(args->at(0)); 3857 Load(args->at(0));
3856 Result obj = frame_->Pop(); 3858 Result obj = frame_->Pop();
3857 obj.ToRegister(); 3859 obj.ToRegister();
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
4329 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); 4331 __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
4330 __ movq(rbx, rax); 4332 __ movq(rbx, rax);
4331 4333
4332 __ bind(&heapnumber_allocated); 4334 __ bind(&heapnumber_allocated);
4333 4335
4334 // Return a random uint32 number in rax. 4336 // Return a random uint32 number in rax.
4335 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. 4337 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
4336 __ PrepareCallCFunction(0); 4338 __ PrepareCallCFunction(0);
4337 __ CallCFunction(ExternalReference::random_uint32_function(), 0); 4339 __ CallCFunction(ExternalReference::random_uint32_function(), 0);
4338 4340
4339 // Convert 32 random bits in eax to 0.(32 random bits) in a double 4341 // Convert 32 random bits in rax to 0.(32 random bits) in a double
4340 // by computing: 4342 // by computing:
4341 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 4343 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
4342 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. 4344 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
4343 __ movd(xmm1, rcx); 4345 __ movd(xmm1, rcx);
4344 __ movd(xmm0, rax); 4346 __ movd(xmm0, rax);
4345 __ cvtss2sd(xmm1, xmm1); 4347 __ cvtss2sd(xmm1, xmm1);
4346 __ xorpd(xmm0, xmm1); 4348 __ xorpd(xmm0, xmm1);
4347 __ subsd(xmm0, xmm1); 4349 __ subsd(xmm0, xmm1);
4348 __ movsd(FieldOperand(rbx, HeapNumber::kValueOffset), xmm0); 4350 __ movsd(FieldOperand(rbx, HeapNumber::kValueOffset), xmm0);
4349 4351
(...skipping 7227 matching lines...) Expand 10 before | Expand all | Expand 10 after
11577 } 11579 }
11578 11580
11579 #endif 11581 #endif
11580 11582
11581 11583
11582 #undef __ 11584 #undef __
11583 11585
11584 } } // namespace v8::internal 11586 } } // namespace v8::internal
11585 11587
11586 #endif // V8_TARGET_ARCH_X64 11588 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698