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 2771 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2782 __ Branch(&return_heap_number, ne, scratch2, Operand(zero_reg)); | 2782 __ Branch(&return_heap_number, ne, scratch2, Operand(zero_reg)); |
2783 __ bind(¬_zero); | 2783 __ bind(¬_zero); |
2784 | 2784 |
2785 // Tag the result and return. | 2785 // Tag the result and return. |
2786 __ SmiTag(v0, scratch1); | 2786 __ SmiTag(v0, scratch1); |
2787 __ Ret(); | 2787 __ Ret(); |
2788 } else { | 2788 } else { |
2789 // DIV just falls through to allocating a heap number. | 2789 // DIV just falls through to allocating a heap number. |
2790 } | 2790 } |
2791 | 2791 |
| 2792 __ bind(&return_heap_number); |
| 2793 // Return a heap number, or fall through to type transition or runtime |
| 2794 // call if we can't. |
2792 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::HEAP_NUMBER | 2795 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::HEAP_NUMBER |
2793 : BinaryOpIC::INT32)) { | 2796 : BinaryOpIC::INT32)) { |
2794 __ bind(&return_heap_number); | |
2795 // We are using FPU registers so s0 is available. | 2797 // We are using FPU registers so s0 is available. |
2796 heap_number_result = s0; | 2798 heap_number_result = s0; |
2797 GenerateHeapResultAllocation(masm, | 2799 GenerateHeapResultAllocation(masm, |
2798 heap_number_result, | 2800 heap_number_result, |
2799 heap_number_map, | 2801 heap_number_map, |
2800 scratch1, | 2802 scratch1, |
2801 scratch2, | 2803 scratch2, |
2802 &call_runtime); | 2804 &call_runtime); |
2803 __ mov(v0, heap_number_result); | 2805 __ mov(v0, heap_number_result); |
2804 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset)); | 2806 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2963 __ TailCallStub(&stub); | 2965 __ TailCallStub(&stub); |
2964 } | 2966 } |
2965 | 2967 |
2966 break; | 2968 break; |
2967 } | 2969 } |
2968 | 2970 |
2969 default: | 2971 default: |
2970 UNREACHABLE(); | 2972 UNREACHABLE(); |
2971 } | 2973 } |
2972 | 2974 |
2973 if (transition.is_linked()) { | 2975 // We never expect DIV to yield an integer result, so we always generate |
| 2976 // type transition code for DIV operations expecting an integer result: the |
| 2977 // code will fall through to this type transition. |
| 2978 if (transition.is_linked() || |
| 2979 ((op_ == Token::DIV) && (result_type_ <= BinaryOpIC::INT32))) { |
2974 __ bind(&transition); | 2980 __ bind(&transition); |
2975 GenerateTypeTransition(masm); | 2981 GenerateTypeTransition(masm); |
2976 } | 2982 } |
2977 | 2983 |
2978 __ bind(&call_runtime); | 2984 __ bind(&call_runtime); |
2979 GenerateCallRuntime(masm); | 2985 GenerateCallRuntime(masm); |
2980 } | 2986 } |
2981 | 2987 |
2982 | 2988 |
2983 void BinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { | 2989 void BinaryOpStub::GenerateOddballStub(MacroAssembler* masm) { |
(...skipping 3670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6654 __ mov(result, zero_reg); | 6660 __ mov(result, zero_reg); |
6655 __ Ret(); | 6661 __ Ret(); |
6656 } | 6662 } |
6657 | 6663 |
6658 | 6664 |
6659 #undef __ | 6665 #undef __ |
6660 | 6666 |
6661 } } // namespace v8::internal | 6667 } } // namespace v8::internal |
6662 | 6668 |
6663 #endif // V8_TARGET_ARCH_MIPS | 6669 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |