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_X87 | 7 #if V8_TARGET_ARCH_X87 |
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 4276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4287 __ fld_d(Operand::StaticVariable(ninf)); | 4287 __ fld_d(Operand::StaticVariable(ninf)); |
4288 X87CommitWrite(input_reg); | 4288 X87CommitWrite(input_reg); |
4289 | 4289 |
4290 __ bind(&done); | 4290 __ bind(&done); |
4291 } | 4291 } |
4292 | 4292 |
4293 | 4293 |
4294 void LCodeGen::DoMathClz32(LMathClz32* instr) { | 4294 void LCodeGen::DoMathClz32(LMathClz32* instr) { |
4295 Register input = ToRegister(instr->value()); | 4295 Register input = ToRegister(instr->value()); |
4296 Register result = ToRegister(instr->result()); | 4296 Register result = ToRegister(instr->result()); |
4297 Label not_zero_input; | |
4298 __ bsr(result, input); | |
4299 | 4297 |
4300 __ j(not_zero, ¬_zero_input); | 4298 __ Lzcnt(result, input); |
4301 __ Move(result, Immediate(63)); // 63^31 == 32 | |
4302 | |
4303 __ bind(¬_zero_input); | |
4304 __ xor_(result, Immediate(31)); // for x in [0..31], 31^x == 31-x. | |
4305 } | 4299 } |
4306 | 4300 |
4307 | 4301 |
4308 void LCodeGen::DoMathExp(LMathExp* instr) { | 4302 void LCodeGen::DoMathExp(LMathExp* instr) { |
4309 X87Register input = ToX87Register(instr->value()); | 4303 X87Register input = ToX87Register(instr->value()); |
4310 X87Register result_reg = ToX87Register(instr->result()); | 4304 X87Register result_reg = ToX87Register(instr->result()); |
4311 Register temp_result = ToRegister(instr->temp1()); | 4305 Register temp_result = ToRegister(instr->temp1()); |
4312 Register temp = ToRegister(instr->temp2()); | 4306 Register temp = ToRegister(instr->temp2()); |
4313 Label slow, done, smi, finish; | 4307 Label slow, done, smi, finish; |
4314 DCHECK(result_reg.is(input)); | 4308 DCHECK(result_reg.is(input)); |
(...skipping 2098 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6413 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 6407 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
6414 RecordSafepoint(Safepoint::kNoLazyDeopt); | 6408 RecordSafepoint(Safepoint::kNoLazyDeopt); |
6415 } | 6409 } |
6416 | 6410 |
6417 | 6411 |
6418 #undef __ | 6412 #undef __ |
6419 | 6413 |
6420 } } // namespace v8::internal | 6414 } } // namespace v8::internal |
6421 | 6415 |
6422 #endif // V8_TARGET_ARCH_X87 | 6416 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |