| 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/code-stubs.h" | 10 #include "src/code-stubs.h" |
| 10 #include "src/codegen.h" | 11 #include "src/codegen.h" |
| 11 #include "src/deoptimizer.h" | 12 #include "src/deoptimizer.h" |
| 12 #include "src/hydrogen-osr.h" | 13 #include "src/hydrogen-osr.h" |
| 13 #include "src/x87/lithium-codegen-x87.h" | 14 #include "src/x87/lithium-codegen-x87.h" |
| 14 | 15 |
| 15 namespace v8 { | 16 namespace v8 { |
| 16 namespace internal { | 17 namespace internal { |
| 17 | 18 |
| 18 | 19 |
| (...skipping 1385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1404 } | 1405 } |
| 1405 __ idiv(right_reg); | 1406 __ idiv(right_reg); |
| 1406 __ bind(&done); | 1407 __ bind(&done); |
| 1407 } | 1408 } |
| 1408 | 1409 |
| 1409 | 1410 |
| 1410 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { | 1411 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { |
| 1411 Register dividend = ToRegister(instr->dividend()); | 1412 Register dividend = ToRegister(instr->dividend()); |
| 1412 int32_t divisor = instr->divisor(); | 1413 int32_t divisor = instr->divisor(); |
| 1413 Register result = ToRegister(instr->result()); | 1414 Register result = ToRegister(instr->result()); |
| 1414 DCHECK(divisor == kMinInt || IsPowerOf2(Abs(divisor))); | 1415 DCHECK(divisor == kMinInt || base::bits::IsPowerOfTwo32(Abs(divisor))); |
| 1415 DCHECK(!result.is(dividend)); | 1416 DCHECK(!result.is(dividend)); |
| 1416 | 1417 |
| 1417 // Check for (0 / -x) that will produce negative zero. | 1418 // Check for (0 / -x) that will produce negative zero. |
| 1418 HDiv* hdiv = instr->hydrogen(); | 1419 HDiv* hdiv = instr->hydrogen(); |
| 1419 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { | 1420 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
| 1420 __ test(dividend, dividend); | 1421 __ test(dividend, dividend); |
| 1421 DeoptimizeIf(zero, instr->environment()); | 1422 DeoptimizeIf(zero, instr->environment()); |
| 1422 } | 1423 } |
| 1423 // Check for (kMinInt / -1). | 1424 // Check for (kMinInt / -1). |
| 1424 if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { | 1425 if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { |
| (...skipping 3438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4863 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 4864 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
| 4864 static_cast<int8_t>(last)); | 4865 static_cast<int8_t>(last)); |
| 4865 DeoptimizeIf(above, instr->environment()); | 4866 DeoptimizeIf(above, instr->environment()); |
| 4866 } | 4867 } |
| 4867 } | 4868 } |
| 4868 } else { | 4869 } else { |
| 4869 uint8_t mask; | 4870 uint8_t mask; |
| 4870 uint8_t tag; | 4871 uint8_t tag; |
| 4871 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); | 4872 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
| 4872 | 4873 |
| 4873 if (IsPowerOf2(mask)) { | 4874 if (base::bits::IsPowerOfTwo32(mask)) { |
| 4874 DCHECK(tag == 0 || IsPowerOf2(tag)); | 4875 DCHECK(tag == 0 || base::bits::IsPowerOfTwo32(tag)); |
| 4875 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); | 4876 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); |
| 4876 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); | 4877 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
| 4877 } else { | 4878 } else { |
| 4878 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); | 4879 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); |
| 4879 __ and_(temp, mask); | 4880 __ and_(temp, mask); |
| 4880 __ cmp(temp, tag); | 4881 __ cmp(temp, tag); |
| 4881 DeoptimizeIf(not_equal, instr->environment()); | 4882 DeoptimizeIf(not_equal, instr->environment()); |
| 4882 } | 4883 } |
| 4883 } | 4884 } |
| 4884 } | 4885 } |
| (...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5702 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5703 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
| 5703 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5704 RecordSafepoint(Safepoint::kNoLazyDeopt); |
| 5704 } | 5705 } |
| 5705 | 5706 |
| 5706 | 5707 |
| 5707 #undef __ | 5708 #undef __ |
| 5708 | 5709 |
| 5709 } } // namespace v8::internal | 5710 } } // namespace v8::internal |
| 5710 | 5711 |
| 5711 #endif // V8_TARGET_ARCH_X87 | 5712 #endif // V8_TARGET_ARCH_X87 |
| OLD | NEW |