OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 2593 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2604 __ b(ne, &transition); | 2604 __ b(ne, &transition); |
2605 } else { | 2605 } else { |
2606 __ vcvt_s32_f64(s8, d5); | 2606 __ vcvt_s32_f64(s8, d5); |
2607 __ vmov(scratch1, s8); | 2607 __ vmov(scratch1, s8); |
2608 } | 2608 } |
2609 | 2609 |
2610 // Check if the result fits in a smi. | 2610 // Check if the result fits in a smi. |
2611 __ add(scratch2, scratch1, Operand(0x40000000), SetCC); | 2611 __ add(scratch2, scratch1, Operand(0x40000000), SetCC); |
2612 // If not try to return a heap number. | 2612 // If not try to return a heap number. |
2613 __ b(mi, &return_heap_number); | 2613 __ b(mi, &return_heap_number); |
2614 // Check for minus zero. Return heap number for minus zero. | 2614 // Check for minus zero. Return heap number for minus zero if |
| 2615 // double results are allowed; otherwise transition. |
2615 Label not_zero; | 2616 Label not_zero; |
2616 __ cmp(scratch1, Operand::Zero()); | 2617 __ cmp(scratch1, Operand::Zero()); |
2617 __ b(ne, ¬_zero); | 2618 __ b(ne, ¬_zero); |
2618 __ vmov(scratch2, d5.high()); | 2619 __ vmov(scratch2, d5.high()); |
2619 __ tst(scratch2, Operand(HeapNumber::kSignMask)); | 2620 __ tst(scratch2, Operand(HeapNumber::kSignMask)); |
2620 __ b(ne, &return_heap_number); | 2621 __ b(ne, result_type_ <= BinaryOpIC::INT32 ? &transition |
| 2622 : &return_heap_number); |
2621 __ bind(¬_zero); | 2623 __ bind(¬_zero); |
2622 | 2624 |
2623 // Tag the result and return. | 2625 // Tag the result and return. |
2624 __ SmiTag(r0, scratch1); | 2626 __ SmiTag(r0, scratch1); |
2625 __ Ret(); | 2627 __ Ret(); |
2626 } else { | 2628 } else { |
2627 // DIV just falls through to allocating a heap number. | 2629 // DIV just falls through to allocating a heap number. |
2628 } | 2630 } |
2629 | 2631 |
2630 __ bind(&return_heap_number); | 2632 __ bind(&return_heap_number); |
2631 // Return a heap number, or fall through to type transition or runtime | 2633 // Return a heap number, or fall through to type transition or runtime |
2632 // call if we can't. | 2634 // call if we can't. |
2633 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::NUMBER | 2635 // We are using vfp registers so r5 is available. |
2634 : BinaryOpIC::INT32)) { | 2636 heap_number_result = r5; |
2635 // We are using vfp registers so r5 is available. | 2637 BinaryOpStub_GenerateHeapResultAllocation(masm, |
2636 heap_number_result = r5; | 2638 heap_number_result, |
2637 BinaryOpStub_GenerateHeapResultAllocation(masm, | 2639 heap_number_map, |
2638 heap_number_result, | 2640 scratch1, |
2639 heap_number_map, | 2641 scratch2, |
2640 scratch1, | 2642 &call_runtime, |
2641 scratch2, | 2643 mode_); |
2642 &call_runtime, | 2644 __ sub(r0, heap_number_result, Operand(kHeapObjectTag)); |
2643 mode_); | 2645 __ vstr(d5, r0, HeapNumber::kValueOffset); |
2644 __ sub(r0, heap_number_result, Operand(kHeapObjectTag)); | 2646 __ mov(r0, heap_number_result); |
2645 __ vstr(d5, r0, HeapNumber::kValueOffset); | 2647 __ Ret(); |
2646 __ mov(r0, heap_number_result); | |
2647 __ Ret(); | |
2648 } | |
2649 | 2648 |
2650 // A DIV operation expecting an integer result falls through | 2649 // A DIV operation expecting an integer result falls through |
2651 // to type transition. | 2650 // to type transition. |
2652 | 2651 |
2653 } else { | 2652 } else { |
2654 // We preserved r0 and r1 to be able to call runtime. | 2653 // We preserved r0 and r1 to be able to call runtime. |
2655 // Save the left value on the stack. | 2654 // Save the left value on the stack. |
2656 __ Push(r5, r4); | 2655 __ Push(r5, r4); |
2657 | 2656 |
2658 Label pop_and_call_runtime; | 2657 Label pop_and_call_runtime; |
(...skipping 4880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7539 | 7538 |
7540 __ Pop(lr, r5, r1); | 7539 __ Pop(lr, r5, r1); |
7541 __ Ret(); | 7540 __ Ret(); |
7542 } | 7541 } |
7543 | 7542 |
7544 #undef __ | 7543 #undef __ |
7545 | 7544 |
7546 } } // namespace v8::internal | 7545 } } // namespace v8::internal |
7547 | 7546 |
7548 #endif // V8_TARGET_ARCH_ARM | 7547 #endif // V8_TARGET_ARCH_ARM |
OLD | NEW |