OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1559 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1570 } | 1570 } |
1571 | 1571 |
1572 | 1572 |
1573 // Tries to get a signed int32 out of a double precision floating point heap | 1573 // Tries to get a signed int32 out of a double precision floating point heap |
1574 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the | 1574 // number. Rounds towards 0. Branch to 'not_int32' if the double is out of the |
1575 // 32bits signed integer range. | 1575 // 32bits signed integer range. |
1576 void MacroAssembler::ConvertToInt32(Register source, | 1576 void MacroAssembler::ConvertToInt32(Register source, |
1577 Register dest, | 1577 Register dest, |
1578 Register scratch, | 1578 Register scratch, |
1579 Register scratch2, | 1579 Register scratch2, |
| 1580 DwVfpRegister double_scratch, |
1580 Label *not_int32) { | 1581 Label *not_int32) { |
1581 if (CpuFeatures::IsSupported(VFP3)) { | 1582 if (CpuFeatures::IsSupported(VFP3)) { |
1582 CpuFeatures::Scope scope(VFP3); | 1583 CpuFeatures::Scope scope(VFP3); |
1583 sub(scratch, source, Operand(kHeapObjectTag)); | 1584 sub(scratch, source, Operand(kHeapObjectTag)); |
1584 vldr(d0, scratch, HeapNumber::kValueOffset); | 1585 vldr(double_scratch, scratch, HeapNumber::kValueOffset); |
1585 vcvt_s32_f64(s0, d0); | 1586 vcvt_s32_f64(double_scratch.low(), double_scratch); |
1586 vmov(dest, s0); | 1587 vmov(dest, double_scratch.low()); |
1587 // Signed vcvt instruction will saturate to the minimum (0x80000000) or | 1588 // Signed vcvt instruction will saturate to the minimum (0x80000000) or |
1588 // maximun (0x7fffffff) signed 32bits integer when the double is out of | 1589 // maximun (0x7fffffff) signed 32bits integer when the double is out of |
1589 // range. When substracting one, the minimum signed integer becomes the | 1590 // range. When substracting one, the minimum signed integer becomes the |
1590 // maximun signed integer. | 1591 // maximun signed integer. |
1591 sub(scratch, dest, Operand(1)); | 1592 sub(scratch, dest, Operand(1)); |
1592 cmp(scratch, Operand(LONG_MAX - 1)); | 1593 cmp(scratch, Operand(LONG_MAX - 1)); |
1593 // If equal then dest was LONG_MAX, if greater dest was LONG_MIN. | 1594 // If equal then dest was LONG_MAX, if greater dest was LONG_MIN. |
1594 b(ge, not_int32); | 1595 b(ge, not_int32); |
1595 } else { | 1596 } else { |
1596 // This code is faster for doubles that are in the ranges -0x7fffffff to | 1597 // This code is faster for doubles that are in the ranges -0x7fffffff to |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1992 } | 1993 } |
1993 | 1994 |
1994 | 1995 |
1995 void MacroAssembler::AbortIfNotSmi(Register object) { | 1996 void MacroAssembler::AbortIfNotSmi(Register object) { |
1996 STATIC_ASSERT(kSmiTag == 0); | 1997 STATIC_ASSERT(kSmiTag == 0); |
1997 tst(object, Operand(kSmiTagMask)); | 1998 tst(object, Operand(kSmiTagMask)); |
1998 Assert(eq, "Operand is not smi"); | 1999 Assert(eq, "Operand is not smi"); |
1999 } | 2000 } |
2000 | 2001 |
2001 | 2002 |
| 2003 void MacroAssembler::AbortIfNotRootValue(Register src, |
| 2004 Heap::RootListIndex root_value_index, |
| 2005 const char* message) { |
| 2006 ASSERT(!src.is(ip)); |
| 2007 LoadRoot(ip, root_value_index); |
| 2008 cmp(src, ip); |
| 2009 Assert(eq, message); |
| 2010 } |
| 2011 |
| 2012 |
2002 void MacroAssembler::JumpIfNotHeapNumber(Register object, | 2013 void MacroAssembler::JumpIfNotHeapNumber(Register object, |
2003 Register heap_number_map, | 2014 Register heap_number_map, |
2004 Register scratch, | 2015 Register scratch, |
2005 Label* on_not_heap_number) { | 2016 Label* on_not_heap_number) { |
2006 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); | 2017 ldr(scratch, FieldMemOperand(object, HeapObject::kMapOffset)); |
2007 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); | 2018 AssertRegisterIsRoot(heap_number_map, Heap::kHeapNumberMapRootIndex); |
2008 cmp(scratch, heap_number_map); | 2019 cmp(scratch, heap_number_map); |
2009 b(ne, on_not_heap_number); | 2020 b(ne, on_not_heap_number); |
2010 } | 2021 } |
2011 | 2022 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2285 | 2296 |
2286 void CodePatcher::Emit(Address addr) { | 2297 void CodePatcher::Emit(Address addr) { |
2287 masm()->emit(reinterpret_cast<Instr>(addr)); | 2298 masm()->emit(reinterpret_cast<Instr>(addr)); |
2288 } | 2299 } |
2289 #endif // ENABLE_DEBUGGER_SUPPORT | 2300 #endif // ENABLE_DEBUGGER_SUPPORT |
2290 | 2301 |
2291 | 2302 |
2292 } } // namespace v8::internal | 2303 } } // namespace v8::internal |
2293 | 2304 |
2294 #endif // V8_TARGET_ARCH_ARM | 2305 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |