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 <limits.h> // For LONG_MIN, LONG_MAX. | 5 #include <limits.h> // For LONG_MIN, LONG_MAX. |
6 | 6 |
7 #if V8_TARGET_ARCH_ARM | 7 #if V8_TARGET_ARCH_ARM |
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 1985 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1996 Register map, | 1996 Register map, |
1997 Register type_reg, | 1997 Register type_reg, |
1998 InstanceType type) { | 1998 InstanceType type) { |
1999 const Register temp = type_reg.is(no_reg) ? ip : type_reg; | 1999 const Register temp = type_reg.is(no_reg) ? ip : type_reg; |
2000 | 2000 |
2001 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | 2001 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); |
2002 CompareInstanceType(map, temp, type); | 2002 CompareInstanceType(map, temp, type); |
2003 } | 2003 } |
2004 | 2004 |
2005 | 2005 |
2006 void MacroAssembler::CheckObjectTypeRange(Register object, | |
2007 Register map, | |
2008 InstanceType min_type, | |
2009 InstanceType max_type, | |
2010 Label* false_label) { | |
2011 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); | |
2012 STATIC_ASSERT(LAST_TYPE < 256); | |
2013 ldr(map, FieldMemOperand(object, HeapObject::kMapOffset)); | |
2014 ldrb(ip, FieldMemOperand(map, Map::kInstanceTypeOffset)); | |
2015 sub(ip, ip, Operand(min_type)); | |
2016 cmp(ip, Operand(max_type - min_type)); | |
2017 b(hi, false_label); | |
2018 } | |
2019 | |
2020 | |
2021 void MacroAssembler::CompareInstanceType(Register map, | 2006 void MacroAssembler::CompareInstanceType(Register map, |
2022 Register type_reg, | 2007 Register type_reg, |
2023 InstanceType type) { | 2008 InstanceType type) { |
2024 // Registers map and type_reg can be ip. These two lines assert | 2009 // Registers map and type_reg can be ip. These two lines assert |
2025 // that ip can be used with the two instructions (the constants | 2010 // that ip can be used with the two instructions (the constants |
2026 // will never need ip). | 2011 // will never need ip). |
2027 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); | 2012 STATIC_ASSERT(Map::kInstanceTypeOffset < 4096); |
2028 STATIC_ASSERT(LAST_TYPE < 256); | 2013 STATIC_ASSERT(LAST_TYPE < 256); |
2029 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); | 2014 ldrb(type_reg, FieldMemOperand(map, Map::kInstanceTypeOffset)); |
2030 cmp(type_reg, Operand(type)); | 2015 cmp(type_reg, Operand(type)); |
(...skipping 1775 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3806 } | 3791 } |
3807 } | 3792 } |
3808 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); | 3793 if (mag.shift > 0) mov(result, Operand(result, ASR, mag.shift)); |
3809 add(result, result, Operand(dividend, LSR, 31)); | 3794 add(result, result, Operand(dividend, LSR, 31)); |
3810 } | 3795 } |
3811 | 3796 |
3812 } // namespace internal | 3797 } // namespace internal |
3813 } // namespace v8 | 3798 } // namespace v8 |
3814 | 3799 |
3815 #endif // V8_TARGET_ARCH_ARM | 3800 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |