| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "src/base/bits.h" | 9 #include "src/base/bits.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| (...skipping 3896 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3907 __ fstp_d(Operand(esp, 0)); | 3907 __ fstp_d(Operand(esp, 0)); |
| 3908 __ movsd(input_reg, Operand(esp, 0)); | 3908 __ movsd(input_reg, Operand(esp, 0)); |
| 3909 __ add(Operand(esp), Immediate(kDoubleSize)); | 3909 __ add(Operand(esp), Immediate(kDoubleSize)); |
| 3910 __ bind(&done); | 3910 __ bind(&done); |
| 3911 } | 3911 } |
| 3912 | 3912 |
| 3913 | 3913 |
| 3914 void LCodeGen::DoMathClz32(LMathClz32* instr) { | 3914 void LCodeGen::DoMathClz32(LMathClz32* instr) { |
| 3915 Register input = ToRegister(instr->value()); | 3915 Register input = ToRegister(instr->value()); |
| 3916 Register result = ToRegister(instr->result()); | 3916 Register result = ToRegister(instr->result()); |
| 3917 Label not_zero_input; | |
| 3918 __ bsr(result, input); | |
| 3919 | 3917 |
| 3920 __ j(not_zero, ¬_zero_input); | 3918 __ Lzcnt(result, input); |
| 3921 __ Move(result, Immediate(63)); // 63^31 == 32 | |
| 3922 | |
| 3923 __ bind(¬_zero_input); | |
| 3924 __ xor_(result, Immediate(31)); // for x in [0..31], 31^x == 31-x. | |
| 3925 } | 3919 } |
| 3926 | 3920 |
| 3927 | 3921 |
| 3928 void LCodeGen::DoMathExp(LMathExp* instr) { | 3922 void LCodeGen::DoMathExp(LMathExp* instr) { |
| 3929 XMMRegister input = ToDoubleRegister(instr->value()); | 3923 XMMRegister input = ToDoubleRegister(instr->value()); |
| 3930 XMMRegister result = ToDoubleRegister(instr->result()); | 3924 XMMRegister result = ToDoubleRegister(instr->result()); |
| 3931 XMMRegister temp0 = double_scratch0(); | 3925 XMMRegister temp0 = double_scratch0(); |
| 3932 Register temp1 = ToRegister(instr->temp1()); | 3926 Register temp1 = ToRegister(instr->temp1()); |
| 3933 Register temp2 = ToRegister(instr->temp2()); | 3927 Register temp2 = ToRegister(instr->temp2()); |
| 3934 | 3928 |
| (...skipping 1840 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5775 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5769 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5776 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5770 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5777 } | 5771 } |
| 5778 | 5772 |
| 5779 | 5773 |
| 5780 #undef __ | 5774 #undef __ |
| 5781 | 5775 |
| 5782 } } // namespace v8::internal | 5776 } } // namespace v8::internal |
| 5783 | 5777 |
| 5784 #endif // V8_TARGET_ARCH_IA32 | 5778 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |