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

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

Issue 2827022: X64: Change some fpu operations to use XMM registers. (Closed)
Patch Set: Addressed review comment. Created 10 years, 6 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
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/disasm-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 5318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5329 if (value.is_number()) { 5329 if (value.is_number()) {
5330 // Fast case if TypeInfo indicates only numbers. 5330 // Fast case if TypeInfo indicates only numbers.
5331 if (FLAG_debug_code) { 5331 if (FLAG_debug_code) {
5332 __ AbortIfNotNumber(value.reg()); 5332 __ AbortIfNotNumber(value.reg());
5333 } 5333 }
5334 // Smi => false iff zero. 5334 // Smi => false iff zero.
5335 __ SmiCompare(value.reg(), Smi::FromInt(0)); 5335 __ SmiCompare(value.reg(), Smi::FromInt(0));
5336 dest->false_target()->Branch(equal); 5336 dest->false_target()->Branch(equal);
5337 Condition is_smi = masm_->CheckSmi(value.reg()); 5337 Condition is_smi = masm_->CheckSmi(value.reg());
5338 dest->true_target()->Branch(is_smi); 5338 dest->true_target()->Branch(is_smi);
5339 __ fldz(); 5339 __ xorpd(xmm0, xmm0);
5340 __ fld_d(FieldOperand(value.reg(), HeapNumber::kValueOffset)); 5340 __ ucomisd(xmm0, FieldOperand(value.reg(), HeapNumber::kValueOffset));
5341 __ FCmp();
5342 value.Unuse(); 5341 value.Unuse();
5343 dest->Split(not_zero); 5342 dest->Split(not_zero);
5344 } else { 5343 } else {
5345 // Fast case checks. 5344 // Fast case checks.
5346 // 'false' => false. 5345 // 'false' => false.
5347 __ CompareRoot(value.reg(), Heap::kFalseValueRootIndex); 5346 __ CompareRoot(value.reg(), Heap::kFalseValueRootIndex);
5348 dest->false_target()->Branch(equal); 5347 dest->false_target()->Branch(equal);
5349 5348
5350 // 'true' => true. 5349 // 'true' => true.
5351 __ CompareRoot(value.reg(), Heap::kTrueValueRootIndex); 5350 __ CompareRoot(value.reg(), Heap::kTrueValueRootIndex);
(...skipping 2641 matching lines...) Expand 10 before | Expand all | Expand 10 after
7993 7992
7994 // String value => false iff empty. 7993 // String value => false iff empty.
7995 __ cmpq(rcx, Immediate(FIRST_NONSTRING_TYPE)); 7994 __ cmpq(rcx, Immediate(FIRST_NONSTRING_TYPE));
7996 __ j(above_equal, &not_string); 7995 __ j(above_equal, &not_string);
7997 __ movq(rdx, FieldOperand(rax, String::kLengthOffset)); 7996 __ movq(rdx, FieldOperand(rax, String::kLengthOffset));
7998 __ SmiTest(rdx); 7997 __ SmiTest(rdx);
7999 __ j(zero, &false_result); 7998 __ j(zero, &false_result);
8000 __ jmp(&true_result); 7999 __ jmp(&true_result);
8001 8000
8002 __ bind(&not_string); 8001 __ bind(&not_string);
8003 // HeapNumber => false iff +0, -0, or NaN.
8004 // These three cases set C3 when compared to zero in the FPU.
8005 __ CompareRoot(rdx, Heap::kHeapNumberMapRootIndex); 8002 __ CompareRoot(rdx, Heap::kHeapNumberMapRootIndex);
8006 __ j(not_equal, &true_result); 8003 __ j(not_equal, &true_result);
8007 __ fldz(); // Load zero onto fp stack 8004 // HeapNumber => false iff +0, -0, or NaN.
8008 // Load heap-number double value onto fp stack 8005 // These three cases set the zero flag when compared to zero using ucomisd.
8009 __ fld_d(FieldOperand(rax, HeapNumber::kValueOffset)); 8006 __ xorpd(xmm0, xmm0);
8010 __ FCmp(); 8007 __ ucomisd(xmm0, FieldOperand(rax, HeapNumber::kValueOffset));
8011 __ j(zero, &false_result); 8008 __ j(zero, &false_result);
8012 // Fall through to |true_result|. 8009 // Fall through to |true_result|.
8013 8010
8014 // Return 1/0 for true/false in rax. 8011 // Return 1/0 for true/false in rax.
8015 __ bind(&true_result); 8012 __ bind(&true_result);
8016 __ movq(rax, Immediate(1)); 8013 __ movq(rax, Immediate(1));
8017 __ ret(1 * kPointerSize); 8014 __ ret(1 * kPointerSize);
8018 __ bind(&false_result); 8015 __ bind(&false_result);
8019 __ xor_(rax, rax); 8016 __ xor_(rax, rax);
8020 __ ret(1 * kPointerSize); 8017 __ ret(1 * kPointerSize);
(...skipping 3873 matching lines...) Expand 10 before | Expand all | Expand 10 after
11894 } 11891 }
11895 11892
11896 #endif 11893 #endif
11897 11894
11898 11895
11899 #undef __ 11896 #undef __
11900 11897
11901 } } // namespace v8::internal 11898 } } // namespace v8::internal
11902 11899
11903 #endif // V8_TARGET_ARCH_X64 11900 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/assembler-x64.cc ('k') | src/x64/disasm-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698