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

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

Issue 155081: X64: Fix ToBoolean(floating point). (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 5 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/assembler-x64.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 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 5428 matching lines...) Expand 10 before | Expand all | Expand 10 after
5439 __ and_(rcx, Immediate(kStringSizeMask)); 5439 __ and_(rcx, Immediate(kStringSizeMask));
5440 __ cmpq(rcx, Immediate(kShortStringTag)); 5440 __ cmpq(rcx, Immediate(kShortStringTag));
5441 __ j(not_equal, &true_result); // Empty string is always short. 5441 __ j(not_equal, &true_result); // Empty string is always short.
5442 __ movq(rdx, FieldOperand(rax, String::kLengthOffset)); 5442 __ movq(rdx, FieldOperand(rax, String::kLengthOffset));
5443 __ shr(rdx, Immediate(String::kShortLengthShift)); 5443 __ shr(rdx, Immediate(String::kShortLengthShift));
5444 __ j(zero, &false_result); 5444 __ j(zero, &false_result);
5445 __ jmp(&true_result); 5445 __ jmp(&true_result);
5446 5446
5447 __ bind(&not_string); 5447 __ bind(&not_string);
5448 // HeapNumber => false iff +0, -0, or NaN. 5448 // HeapNumber => false iff +0, -0, or NaN.
5449 // These three cases set C3 when compared to zero in the FPU.
5449 __ Cmp(rdx, Factory::heap_number_map()); 5450 __ Cmp(rdx, Factory::heap_number_map());
5450 __ j(not_equal, &true_result); 5451 __ j(not_equal, &true_result);
5451 // TODO(x64): Don't use fp stack, use MMX registers? 5452 // TODO(x64): Don't use fp stack, use MMX registers?
5452 __ fldz(); // Load zero onto fp stack 5453 __ fldz(); // Load zero onto fp stack
5453 // Load heap-number double value onto fp stack 5454 // Load heap-number double value onto fp stack
5454 __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset)); 5455 __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset));
5455 __ fucompp(); // Compare and pop both values. 5456 __ fucompp(); // Compare and pop both values.
5456 __ movq(kScratchRegister, rax); 5457 __ movq(kScratchRegister, rax);
5457 __ fnstsw_ax(); // Store fp status word in ax, no checking for exceptions. 5458 __ fnstsw_ax(); // Store fp status word in ax, no checking for exceptions.
5458 __ testb(rax, Immediate(0x08)); // Test FP condition flag C3. 5459 __ testl(rax, Immediate(0x4000)); // Test FP condition flag C3, bit 16.
5459 __ movq(rax, kScratchRegister); 5460 __ movq(rax, kScratchRegister);
5460 __ j(zero, &false_result); 5461 __ j(not_zero, &false_result);
5461 // Fall through to |true_result|. 5462 // Fall through to |true_result|.
5462 5463
5463 // Return 1/0 for true/false in rax. 5464 // Return 1/0 for true/false in rax.
5464 __ bind(&true_result); 5465 __ bind(&true_result);
5465 __ movq(rax, Immediate(1)); 5466 __ movq(rax, Immediate(1));
5466 __ ret(1 * kPointerSize); 5467 __ ret(1 * kPointerSize);
5467 __ bind(&false_result); 5468 __ bind(&false_result);
5468 __ xor_(rax, rax); 5469 __ xor_(rax, rax);
5469 __ ret(1 * kPointerSize); 5470 __ ret(1 * kPointerSize);
5470 } 5471 }
(...skipping 1464 matching lines...) Expand 10 before | Expand all | Expand 10 after
6935 int CompareStub::MinorKey() { 6936 int CompareStub::MinorKey() {
6936 // Encode the two parameters in a unique 16 bit value. 6937 // Encode the two parameters in a unique 16 bit value.
6937 ASSERT(static_cast<unsigned>(cc_) < (1 << 15)); 6938 ASSERT(static_cast<unsigned>(cc_) < (1 << 15));
6938 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0); 6939 return (static_cast<unsigned>(cc_) << 1) | (strict_ ? 1 : 0);
6939 } 6940 }
6940 6941
6941 6942
6942 #undef __ 6943 #undef __
6943 6944
6944 } } // namespace v8::internal 6945 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698