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 2493 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2504 | 2504 |
2505 if (result_type_ <= BinaryOpIC::INT32) { | 2505 if (result_type_ <= BinaryOpIC::INT32) { |
2506 // If except_flag != 0, result does not fit in a 32-bit integer. | 2506 // If except_flag != 0, result does not fit in a 32-bit integer. |
2507 __ Branch(&transition, ne, except_flag, Operand(zero_reg)); | 2507 __ Branch(&transition, ne, except_flag, Operand(zero_reg)); |
2508 } | 2508 } |
2509 | 2509 |
2510 // Check if the result fits in a smi. | 2510 // Check if the result fits in a smi. |
2511 __ Addu(scratch2, scratch1, Operand(0x40000000)); | 2511 __ Addu(scratch2, scratch1, Operand(0x40000000)); |
2512 // If not try to return a heap number. | 2512 // If not try to return a heap number. |
2513 __ Branch(&return_heap_number, lt, scratch2, Operand(zero_reg)); | 2513 __ Branch(&return_heap_number, lt, scratch2, Operand(zero_reg)); |
2514 // Check for minus zero. Return heap number for minus zero. | 2514 // Check for minus zero. Return heap number for minus zero if |
| 2515 // double results are allowed; otherwise transition. |
2515 Label not_zero; | 2516 Label not_zero; |
2516 __ Branch(¬_zero, ne, scratch1, Operand(zero_reg)); | 2517 __ Branch(¬_zero, ne, scratch1, Operand(zero_reg)); |
2517 __ mfc1(scratch2, f11); | 2518 __ mfc1(scratch2, f11); |
2518 __ And(scratch2, scratch2, HeapNumber::kSignMask); | 2519 __ And(scratch2, scratch2, HeapNumber::kSignMask); |
2519 __ Branch(&return_heap_number, ne, scratch2, Operand(zero_reg)); | 2520 __ Branch(result_type_ <= BinaryOpIC::INT32 ? &transition |
| 2521 : &return_heap_number, |
| 2522 ne, |
| 2523 scratch2, |
| 2524 Operand(zero_reg)); |
2520 __ bind(¬_zero); | 2525 __ bind(¬_zero); |
2521 | 2526 |
2522 // Tag the result and return. | 2527 // Tag the result and return. |
2523 __ SmiTag(v0, scratch1); | 2528 __ SmiTag(v0, scratch1); |
2524 __ Ret(); | 2529 __ Ret(); |
2525 } else { | 2530 } else { |
2526 // DIV just falls through to allocating a heap number. | 2531 // DIV just falls through to allocating a heap number. |
2527 } | 2532 } |
2528 | 2533 |
2529 __ bind(&return_heap_number); | 2534 __ bind(&return_heap_number); |
2530 // Return a heap number, or fall through to type transition or runtime | 2535 // Return a heap number, or fall through to type transition or runtime |
2531 // call if we can't. | 2536 // call if we can't. |
2532 if (result_type_ >= ((op_ == Token::DIV) ? BinaryOpIC::NUMBER | 2537 // We are using FPU registers so s0 is available. |
2533 : BinaryOpIC::INT32)) { | 2538 heap_number_result = s0; |
2534 // We are using FPU registers so s0 is available. | 2539 BinaryOpStub_GenerateHeapResultAllocation(masm, |
2535 heap_number_result = s0; | 2540 heap_number_result, |
2536 BinaryOpStub_GenerateHeapResultAllocation(masm, | 2541 heap_number_map, |
2537 heap_number_result, | 2542 scratch1, |
2538 heap_number_map, | 2543 scratch2, |
2539 scratch1, | 2544 &call_runtime, |
2540 scratch2, | 2545 mode_); |
2541 &call_runtime, | 2546 __ mov(v0, heap_number_result); |
2542 mode_); | 2547 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset)); |
2543 __ mov(v0, heap_number_result); | 2548 __ Ret(); |
2544 __ sdc1(f10, FieldMemOperand(v0, HeapNumber::kValueOffset)); | |
2545 __ Ret(); | |
2546 } | |
2547 | 2549 |
2548 // A DIV operation expecting an integer result falls through | 2550 // A DIV operation expecting an integer result falls through |
2549 // to type transition. | 2551 // to type transition. |
2550 | 2552 |
2551 } else { | 2553 } else { |
2552 // We preserved a0 and a1 to be able to call runtime. | 2554 // We preserved a0 and a1 to be able to call runtime. |
2553 // Save the left value on the stack. | 2555 // Save the left value on the stack. |
2554 __ Push(t1, t0); | 2556 __ Push(t1, t0); |
2555 | 2557 |
2556 Label pop_and_call_runtime; | 2558 Label pop_and_call_runtime; |
(...skipping 4988 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7545 __ Pop(ra, t1, a1); | 7547 __ Pop(ra, t1, a1); |
7546 __ Ret(); | 7548 __ Ret(); |
7547 } | 7549 } |
7548 | 7550 |
7549 | 7551 |
7550 #undef __ | 7552 #undef __ |
7551 | 7553 |
7552 } } // namespace v8::internal | 7554 } } // namespace v8::internal |
7553 | 7555 |
7554 #endif // V8_TARGET_ARCH_MIPS | 7556 #endif // V8_TARGET_ARCH_MIPS |
OLD | NEW |