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/base/division-by-constant.h" | 10 #include "src/base/division-by-constant.h" |
(...skipping 2337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 mov(dst, x); | 2348 mov(dst, x); |
2349 } | 2349 } |
2350 } | 2350 } |
2351 | 2351 |
2352 | 2352 |
2353 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { | 2353 void MacroAssembler::Move(const Operand& dst, const Immediate& x) { |
2354 mov(dst, x); | 2354 mov(dst, x); |
2355 } | 2355 } |
2356 | 2356 |
2357 | 2357 |
| 2358 void MacroAssembler::Lzcnt(Register dst, const Operand& src) { |
| 2359 // TODO(intel): Add support for LZCNT (with ABM/BMI1). |
| 2360 Label not_zero_src; |
| 2361 bsr(dst, src); |
| 2362 j(not_zero, ¬_zero_src, Label::kNear); |
| 2363 Move(dst, Immediate(63)); // 63^31 == 32 |
| 2364 bind(¬_zero_src); |
| 2365 xor_(dst, Immediate(31)); // for x in [0..31], 31^x == 31-x. |
| 2366 } |
| 2367 |
| 2368 |
2358 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { | 2369 void MacroAssembler::SetCounter(StatsCounter* counter, int value) { |
2359 if (FLAG_native_code_counters && counter->Enabled()) { | 2370 if (FLAG_native_code_counters && counter->Enabled()) { |
2360 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); | 2371 mov(Operand::StaticVariable(ExternalReference(counter)), Immediate(value)); |
2361 } | 2372 } |
2362 } | 2373 } |
2363 | 2374 |
2364 | 2375 |
2365 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { | 2376 void MacroAssembler::IncrementCounter(StatsCounter* counter, int value) { |
2366 DCHECK(value > 0); | 2377 DCHECK(value > 0); |
2367 if (FLAG_native_code_counters && counter->Enabled()) { | 2378 if (FLAG_native_code_counters && counter->Enabled()) { |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3104 if (mag.shift > 0) sar(edx, mag.shift); | 3115 if (mag.shift > 0) sar(edx, mag.shift); |
3105 mov(eax, dividend); | 3116 mov(eax, dividend); |
3106 shr(eax, 31); | 3117 shr(eax, 31); |
3107 add(edx, eax); | 3118 add(edx, eax); |
3108 } | 3119 } |
3109 | 3120 |
3110 | 3121 |
3111 } } // namespace v8::internal | 3122 } } // namespace v8::internal |
3112 | 3123 |
3113 #endif // V8_TARGET_ARCH_X87 | 3124 #endif // V8_TARGET_ARCH_X87 |
OLD | NEW |