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

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

Issue 2137008: Reapply r4686: Complete version of full codegen for 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 3824 matching lines...) Expand 10 before | Expand all | Expand 10 after
3835 3835
3836 __ Move(kScratchRegister, Factory::null_value()); 3836 __ Move(kScratchRegister, Factory::null_value());
3837 __ cmpq(obj.reg(), kScratchRegister); 3837 __ cmpq(obj.reg(), kScratchRegister);
3838 destination()->true_target()->Branch(equal); 3838 destination()->true_target()->Branch(equal);
3839 3839
3840 __ movq(kScratchRegister, FieldOperand(obj.reg(), HeapObject::kMapOffset)); 3840 __ movq(kScratchRegister, FieldOperand(obj.reg(), HeapObject::kMapOffset));
3841 // Undetectable objects behave like undefined when tested with typeof. 3841 // Undetectable objects behave like undefined when tested with typeof.
3842 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset), 3842 __ testb(FieldOperand(kScratchRegister, Map::kBitFieldOffset),
3843 Immediate(1 << Map::kIsUndetectable)); 3843 Immediate(1 << Map::kIsUndetectable));
3844 destination()->false_target()->Branch(not_zero); 3844 destination()->false_target()->Branch(not_zero);
3845 __ CmpInstanceType(kScratchRegister, FIRST_JS_OBJECT_TYPE); 3845 __ movzxbq(kScratchRegister,
3846 destination()->false_target()->Branch(less); 3846 FieldOperand(kScratchRegister, Map::kInstanceTypeOffset));
3847 __ CmpInstanceType(kScratchRegister, LAST_JS_OBJECT_TYPE); 3847 __ cmpq(kScratchRegister, Immediate(FIRST_JS_OBJECT_TYPE));
3848 destination()->false_target()->Branch(below);
3849 __ cmpq(kScratchRegister, Immediate(LAST_JS_OBJECT_TYPE));
3848 obj.Unuse(); 3850 obj.Unuse();
3849 destination()->Split(less_equal); 3851 destination()->Split(below_equal);
3850 } 3852 }
3851 3853
3852 3854
3853 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) { 3855 void CodeGenerator::GenerateIsFunction(ZoneList<Expression*>* args) {
3854 // This generates a fast version of: 3856 // This generates a fast version of:
3855 // (%_ClassOf(arg) === 'Function') 3857 // (%_ClassOf(arg) === 'Function')
3856 ASSERT(args->length() == 1); 3858 ASSERT(args->length() == 1);
3857 Load(args->at(0)); 3859 Load(args->at(0));
3858 Result obj = frame_->Pop(); 3860 Result obj = frame_->Pop();
3859 obj.ToRegister(); 3861 obj.ToRegister();
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 __ CallRuntime(Runtime::kNumberUnaryMinus, 1); 4333 __ CallRuntime(Runtime::kNumberUnaryMinus, 1);
4332 __ movq(rbx, rax); 4334 __ movq(rbx, rax);
4333 4335
4334 __ bind(&heapnumber_allocated); 4336 __ bind(&heapnumber_allocated);
4335 4337
4336 // Return a random uint32 number in rax. 4338 // Return a random uint32 number in rax.
4337 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs. 4339 // The fresh HeapNumber is in rbx, which is callee-save on both x64 ABIs.
4338 __ PrepareCallCFunction(0); 4340 __ PrepareCallCFunction(0);
4339 __ CallCFunction(ExternalReference::random_uint32_function(), 0); 4341 __ CallCFunction(ExternalReference::random_uint32_function(), 0);
4340 4342
4341 // Convert 32 random bits in eax to 0.(32 random bits) in a double 4343 // Convert 32 random bits in rax to 0.(32 random bits) in a double
4342 // by computing: 4344 // by computing:
4343 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)). 4345 // ( 1.(20 0s)(32 random bits) x 2^20 ) - (1.0 x 2^20)).
4344 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single. 4346 __ movl(rcx, Immediate(0x49800000)); // 1.0 x 2^20 as single.
4345 __ movd(xmm1, rcx); 4347 __ movd(xmm1, rcx);
4346 __ movd(xmm0, rax); 4348 __ movd(xmm0, rax);
4347 __ cvtss2sd(xmm1, xmm1); 4349 __ cvtss2sd(xmm1, xmm1);
4348 __ xorpd(xmm0, xmm1); 4350 __ xorpd(xmm0, xmm1);
4349 __ subsd(xmm0, xmm1); 4351 __ subsd(xmm0, xmm1);
4350 __ movsd(FieldOperand(rbx, HeapNumber::kValueOffset), xmm0); 4352 __ movsd(FieldOperand(rbx, HeapNumber::kValueOffset), xmm0);
4351 4353
(...skipping 7240 matching lines...) Expand 10 before | Expand all | Expand 10 after
11592 } 11594 }
11593 11595
11594 #endif 11596 #endif
11595 11597
11596 11598
11597 #undef __ 11599 #undef __
11598 11600
11599 } } // namespace v8::internal 11601 } } // namespace v8::internal
11600 11602
11601 #endif // V8_TARGET_ARCH_X64 11603 #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