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_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
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/ia32/lithium-codegen-ia32.h" | 14 #include "src/ia32/lithium-codegen-ia32.h" |
14 | 15 |
15 namespace v8 { | 16 namespace v8 { |
16 namespace internal { | 17 namespace internal { |
17 | 18 |
18 // When invoking builtins, we need to record the safepoint in the middle of | 19 // When invoking builtins, we need to record the safepoint in the middle of |
(...skipping 1192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1211 } | 1212 } |
1212 __ idiv(right_reg); | 1213 __ idiv(right_reg); |
1213 __ bind(&done); | 1214 __ bind(&done); |
1214 } | 1215 } |
1215 | 1216 |
1216 | 1217 |
1217 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { | 1218 void LCodeGen::DoDivByPowerOf2I(LDivByPowerOf2I* instr) { |
1218 Register dividend = ToRegister(instr->dividend()); | 1219 Register dividend = ToRegister(instr->dividend()); |
1219 int32_t divisor = instr->divisor(); | 1220 int32_t divisor = instr->divisor(); |
1220 Register result = ToRegister(instr->result()); | 1221 Register result = ToRegister(instr->result()); |
1221 DCHECK(divisor == kMinInt || IsPowerOf2(Abs(divisor))); | 1222 DCHECK(divisor == kMinInt || base::bits::IsPowerOfTwo32(Abs(divisor))); |
1222 DCHECK(!result.is(dividend)); | 1223 DCHECK(!result.is(dividend)); |
1223 | 1224 |
1224 // Check for (0 / -x) that will produce negative zero. | 1225 // Check for (0 / -x) that will produce negative zero. |
1225 HDiv* hdiv = instr->hydrogen(); | 1226 HDiv* hdiv = instr->hydrogen(); |
1226 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { | 1227 if (hdiv->CheckFlag(HValue::kBailoutOnMinusZero) && divisor < 0) { |
1227 __ test(dividend, dividend); | 1228 __ test(dividend, dividend); |
1228 DeoptimizeIf(zero, instr->environment()); | 1229 DeoptimizeIf(zero, instr->environment()); |
1229 } | 1230 } |
1230 // Check for (kMinInt / -1). | 1231 // Check for (kMinInt / -1). |
1231 if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { | 1232 if (hdiv->CheckFlag(HValue::kCanOverflow) && divisor == -1) { |
(...skipping 3664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4896 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), | 4897 __ cmpb(FieldOperand(temp, Map::kInstanceTypeOffset), |
4897 static_cast<int8_t>(last)); | 4898 static_cast<int8_t>(last)); |
4898 DeoptimizeIf(above, instr->environment()); | 4899 DeoptimizeIf(above, instr->environment()); |
4899 } | 4900 } |
4900 } | 4901 } |
4901 } else { | 4902 } else { |
4902 uint8_t mask; | 4903 uint8_t mask; |
4903 uint8_t tag; | 4904 uint8_t tag; |
4904 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); | 4905 instr->hydrogen()->GetCheckMaskAndTag(&mask, &tag); |
4905 | 4906 |
4906 if (IsPowerOf2(mask)) { | 4907 if (base::bits::IsPowerOfTwo32(mask)) { |
4907 DCHECK(tag == 0 || IsPowerOf2(tag)); | 4908 DCHECK(tag == 0 || base::bits::IsPowerOfTwo32(tag)); |
4908 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); | 4909 __ test_b(FieldOperand(temp, Map::kInstanceTypeOffset), mask); |
4909 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); | 4910 DeoptimizeIf(tag == 0 ? not_zero : zero, instr->environment()); |
4910 } else { | 4911 } else { |
4911 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); | 4912 __ movzx_b(temp, FieldOperand(temp, Map::kInstanceTypeOffset)); |
4912 __ and_(temp, mask); | 4913 __ and_(temp, mask); |
4913 __ cmp(temp, tag); | 4914 __ cmp(temp, tag); |
4914 DeoptimizeIf(not_equal, instr->environment()); | 4915 DeoptimizeIf(not_equal, instr->environment()); |
4915 } | 4916 } |
4916 } | 4917 } |
4917 } | 4918 } |
(...skipping 751 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5669 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5670 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5670 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5671 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5671 } | 5672 } |
5672 | 5673 |
5673 | 5674 |
5674 #undef __ | 5675 #undef __ |
5675 | 5676 |
5676 } } // namespace v8::internal | 5677 } } // namespace v8::internal |
5677 | 5678 |
5678 #endif // V8_TARGET_ARCH_IA32 | 5679 #endif // V8_TARGET_ARCH_IA32 |
OLD | NEW |