| 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 #if V8_TARGET_ARCH_IA32 | 5 #if V8_TARGET_ARCH_IA32 |
| 6 | 6 |
| 7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
| 8 #include "src/base/division-by-constant.h" | 8 #include "src/base/division-by-constant.h" |
| 9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
| 10 #include "src/codegen.h" | 10 #include "src/codegen.h" |
| (...skipping 2412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2423 } | 2423 } |
| 2424 Label not_zero_src; | 2424 Label not_zero_src; |
| 2425 bsr(dst, src); | 2425 bsr(dst, src); |
| 2426 j(not_zero, ¬_zero_src, Label::kNear); | 2426 j(not_zero, ¬_zero_src, Label::kNear); |
| 2427 Move(dst, Immediate(63)); // 63^31 == 32 | 2427 Move(dst, Immediate(63)); // 63^31 == 32 |
| 2428 bind(¬_zero_src); | 2428 bind(¬_zero_src); |
| 2429 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. | 2429 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. |
| 2430 } | 2430 } |
| 2431 | 2431 |
| 2432 | 2432 |
| 2433 void MacroAssembler::Tzcnt(Register dst, const Operand& src) { |
| 2434 if (CpuFeatures::IsSupported(BMI1)) { |
| 2435 CpuFeatureScope scope(this, BMI1); |
| 2436 tzcnt(dst, src); |
| 2437 return; |
| 2438 } |
| 2439 Label not_zero_src; |
| 2440 bsf(dst, src); |
| 2441 j(not_zero, ¬_zero_src, Label::kNear); |
| 2442 Move(dst, Immediate(32)); // The result of tzcnt is 32 if src = 0. |
| 2443 bind(¬_zero_src); |
| 2444 } |
| 2445 |
| 2446 |
| 2433 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 2447 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
| 2434 if (FLAG_native_code_counters && counter->Enabled()) { | 2448 if (FLAG_native_code_counters && counter->Enabled()) { |
| 2435 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); | 2449 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); |
| 2436 } | 2450 } |
| 2437 } | 2451 } |
| 2438 | 2452 |
| 2439 | 2453 |
| 2440 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { | 2454 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { |
| 2441 DCHECK(value > 0); | 2455 DCHECK(value > 0); |
| 2442 if (FLAG_native_code_counters && counter->Enabled()) { | 2456 if (FLAG_native_code_counters && counter->Enabled()) { |
| (...skipping 682 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3125 mov(eax, dividend); | 3139 mov(eax, dividend); |
| 3126 shr(eax, 31); | 3140 shr(eax, 31); |
| 3127 add(edx, eax); | 3141 add(edx, eax); |
| 3128 } | 3142 } |
| 3129 | 3143 |
| 3130 | 3144 |
| 3131 } // namespace internal | 3145 } // namespace internal |
| 3132 } // namespace v8 | 3146 } // namespace v8 |
| 3133 | 3147 |
| 3134 #endif // V8_TARGET_ARCH_IA32 | 3148 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |