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

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

Issue 6551009: X64 Crankshaft: Implement DoubleToI in optimizing compiler. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 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
« no previous file with comments | « no previous file | src/x64/lithium-x64.h » ('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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 2851 matching lines...) Expand 10 before | Expand all | Expand 10 after
2862 ASSERT(result->IsDoubleRegister()); 2862 ASSERT(result->IsDoubleRegister());
2863 2863
2864 Register input_reg = ToRegister(input); 2864 Register input_reg = ToRegister(input);
2865 XMMRegister result_reg = ToDoubleRegister(result); 2865 XMMRegister result_reg = ToDoubleRegister(result);
2866 2866
2867 EmitNumberUntagD(input_reg, result_reg, instr->environment()); 2867 EmitNumberUntagD(input_reg, result_reg, instr->environment());
2868 } 2868 }
2869 2869
2870 2870
2871 void LCodeGen::DoDoubleToI(LDoubleToI* instr) { 2871 void LCodeGen::DoDoubleToI(LDoubleToI* instr) {
2872 Abort("Unimplemented: %s", "DoDoubleToI"); 2872 LOperand* input = instr->InputAt(0);
2873 ASSERT(input->IsDoubleRegister());
2874 LOperand* result = instr->result();
2875 ASSERT(result->IsRegister());
2876
2877 XMMRegister input_reg = ToDoubleRegister(input);
2878 Register result_reg = ToRegister(result);
2879
2880 if (instr->truncating()) {
2881 // Performs a truncating conversion of a floating point number as used by
2882 // the JS bitwise operations.
2883 __ cvttsd2siq(result_reg, input_reg);
2884 __ movq(kScratchRegister, V8_INT64_C(0x8000000000000000), RelocInfo::NONE);
2885 __ cmpl(result_reg, kScratchRegister);
2886 DeoptimizeIf(equal, instr->environment());
2887 } else {
2888 __ cvttsd2si(result_reg, input_reg);
2889 __ cvtlsi2sd(xmm0, result_reg);
2890 __ ucomisd(xmm0, input_reg);
2891 DeoptimizeIf(not_equal, instr->environment());
2892 DeoptimizeIf(parity_even, instr->environment()); // NaN.
2893 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) {
2894 NearLabel done;
2895 // The integer converted back is equal to the original. We
2896 // only have to test if we got -0 as an input.
2897 __ testl(result_reg, result_reg);
2898 __ j(not_zero, &done);
2899 __ movmskpd(result_reg, input_reg);
2900 // Bit 0 contains the sign of the double in input_reg.
2901 // If input was positive, we are ok and return 0, otherwise
2902 // deoptimize.
2903 __ andl(result_reg, Immediate(1));
2904 DeoptimizeIf(not_zero, instr->environment());
2905 __ bind(&done);
2906 }
2907 }
2873 } 2908 }
2874 2909
2875 2910
2876 void LCodeGen::DoCheckSmi(LCheckSmi* instr) { 2911 void LCodeGen::DoCheckSmi(LCheckSmi* instr) {
2877 LOperand* input = instr->InputAt(0); 2912 LOperand* input = instr->InputAt(0);
2878 ASSERT(input->IsRegister()); 2913 ASSERT(input->IsRegister());
2879 Condition cc = masm()->CheckSmi(ToRegister(input)); 2914 Condition cc = masm()->CheckSmi(ToRegister(input));
2880 if (instr->condition() != equal) { 2915 if (instr->condition() != equal) {
2881 cc = NegateCondition(cc); 2916 cc = NegateCondition(cc);
2882 } 2917 }
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
3267 RegisterEnvironmentForDeoptimization(environment); 3302 RegisterEnvironmentForDeoptimization(environment);
3268 ASSERT(osr_pc_offset_ == -1); 3303 ASSERT(osr_pc_offset_ == -1);
3269 osr_pc_offset_ = masm()->pc_offset(); 3304 osr_pc_offset_ = masm()->pc_offset();
3270 } 3305 }
3271 3306
3272 #undef __ 3307 #undef __
3273 3308
3274 } } // namespace v8::internal 3309 } } // namespace v8::internal
3275 3310
3276 #endif // V8_TARGET_ARCH_X64 3311 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « no previous file | src/x64/lithium-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698