| 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/bootstrapper.h" | 11 #include "src/bootstrapper.h" |
| 11 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 12 #include "src/cpu-profiler.h" | 13 #include "src/cpu-profiler.h" |
| 13 #include "src/debug.h" | 14 #include "src/debug.h" |
| 14 #include "src/isolate-inl.h" | 15 #include "src/isolate-inl.h" |
| 15 #include "src/runtime.h" | 16 #include "src/runtime.h" |
| 16 #include "src/serialize.h" | 17 #include "src/serialize.h" |
| 17 | 18 |
| 18 namespace v8 { | 19 namespace v8 { |
| 19 namespace internal { | 20 namespace internal { |
| (...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3303 j(equal, found); | 3304 j(equal, found); |
| 3304 mov(current, FieldOperand(current, Map::kPrototypeOffset)); | 3305 mov(current, FieldOperand(current, Map::kPrototypeOffset)); |
| 3305 cmp(current, Immediate(factory->null_value())); | 3306 cmp(current, Immediate(factory->null_value())); |
| 3306 j(not_equal, &loop_again); | 3307 j(not_equal, &loop_again); |
| 3307 } | 3308 } |
| 3308 | 3309 |
| 3309 | 3310 |
| 3310 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { | 3311 void MacroAssembler::TruncatingDiv(Register dividend, int32_t divisor) { |
| 3311 DCHECK(!dividend.is(eax)); | 3312 DCHECK(!dividend.is(eax)); |
| 3312 DCHECK(!dividend.is(edx)); | 3313 DCHECK(!dividend.is(edx)); |
| 3313 MultiplierAndShift ms(divisor); | 3314 base::MagicNumbersForDivision<uint32_t> mag = |
| 3314 mov(eax, Immediate(ms.multiplier())); | 3315 base::SignedDivisionByConstant(static_cast<uint32_t>(divisor)); |
| 3316 mov(eax, Immediate(mag.multiplier)); |
| 3315 imul(dividend); | 3317 imul(dividend); |
| 3316 if (divisor > 0 && ms.multiplier() < 0) add(edx, dividend); | 3318 bool neg = (mag.multiplier & (static_cast<uint32_t>(1) << 31)) != 0; |
| 3317 if (divisor < 0 && ms.multiplier() > 0) sub(edx, dividend); | 3319 if (divisor > 0 && neg) add(edx, dividend); |
| 3318 if (ms.shift() > 0) sar(edx, ms.shift()); | 3320 if (divisor < 0 && !neg && mag.multiplier > 0) sub(edx, dividend); |
| 3321 if (mag.shift > 0) sar(edx, mag.shift); |
| 3319 mov(eax, dividend); | 3322 mov(eax, dividend); |
| 3320 shr(eax, 31); | 3323 shr(eax, 31); |
| 3321 add(edx, eax); | 3324 add(edx, eax); |
| 3322 } | 3325 } |
| 3323 | 3326 |
| 3324 | 3327 |
| 3325 } } // namespace v8::internal | 3328 } } // namespace v8::internal |
| 3326 | 3329 |
| 3327 #endif // V8_TARGET_ARCH_X87 | 3330 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |