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 2474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2485 Register input = ToRegister(instr->input()); | 2485 Register input = ToRegister(instr->input()); |
2486 Register scratch = scratch0(); | 2486 Register scratch = scratch0(); |
2487 | 2487 |
2488 // Deoptimize if not a heap number. | 2488 // Deoptimize if not a heap number. |
2489 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); | 2489 __ ldr(scratch, FieldMemOperand(input, HeapObject::kMapOffset)); |
2490 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); | 2490 __ LoadRoot(ip, Heap::kHeapNumberMapRootIndex); |
2491 __ cmp(scratch, Operand(ip)); | 2491 __ cmp(scratch, Operand(ip)); |
2492 DeoptimizeIf(ne, instr->environment()); | 2492 DeoptimizeIf(ne, instr->environment()); |
2493 | 2493 |
2494 Label done; | 2494 Label done; |
2495 Register tmp = input.is(r0) ? r1 : r0; | |
2496 Register tmp2 = r2; | |
2497 Register tmp3 = r3; | |
2498 | 2495 |
2499 Label negative; | 2496 Label negative; |
2500 __ ldr(scratch, FieldMemOperand(input, HeapNumber::kExponentOffset)); | 2497 __ ldr(scratch, FieldMemOperand(input, HeapNumber::kExponentOffset)); |
2501 // Check the sign of the argument. If the argument is positive, just | 2498 // Check the sign of the argument. If the argument is positive, just |
2502 // return it. We do not need to patch the stack since |input| and | 2499 // return it. We do not need to patch the stack since |input| and |
2503 // |result| are the same register and |input| will be restored | 2500 // |result| are the same register and |input| will be restored |
2504 // unchanged by popping safepoint registers. | 2501 // unchanged by popping safepoint registers. |
2505 __ tst(scratch, Operand(HeapNumber::kSignMask)); | 2502 __ tst(scratch, Operand(HeapNumber::kSignMask)); |
2506 __ b(ne, &negative); | 2503 __ b(ne, &negative); |
2507 __ jmp(&done); | 2504 __ jmp(&done); |
2508 | 2505 |
2509 __ bind(&negative); | 2506 __ bind(&negative); |
2510 // Preserve the value of all registers. | 2507 // Preserve the value of all registers. |
2511 __ PushSafepointRegisters(); | 2508 __ PushSafepointRegisters(); |
2512 | 2509 |
| 2510 Register tmp = input.is(r0) ? r1 : r0; |
| 2511 Register tmp2 = input.is(r2) ? r3 : r2; |
| 2512 Register tmp3 = input.is(r4) ? r5 : r4; |
| 2513 |
2513 Label allocated, slow; | 2514 Label allocated, slow; |
2514 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); | 2515 __ LoadRoot(scratch, Heap::kHeapNumberMapRootIndex); |
2515 __ AllocateHeapNumber(tmp, tmp2, tmp3, scratch, &slow); | 2516 __ AllocateHeapNumber(tmp, tmp2, tmp3, scratch, &slow); |
2516 __ b(&allocated); | 2517 __ b(&allocated); |
2517 | 2518 |
2518 // Slow case: Call the runtime system to do the number allocation. | 2519 // Slow case: Call the runtime system to do the number allocation. |
2519 __ bind(&slow); | 2520 __ bind(&slow); |
2520 | 2521 |
2521 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); | 2522 __ CallRuntimeSaveDoubles(Runtime::kAllocateHeapNumber); |
2522 RecordSafepointWithRegisters( | 2523 RecordSafepointWithRegisters( |
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3644 | 3645 |
3645 | 3646 |
3646 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { | 3647 void LCodeGen::DoOsrEntry(LOsrEntry* instr) { |
3647 Abort("DoOsrEntry unimplemented."); | 3648 Abort("DoOsrEntry unimplemented."); |
3648 } | 3649 } |
3649 | 3650 |
3650 | 3651 |
3651 #undef __ | 3652 #undef __ |
3652 | 3653 |
3653 } } // namespace v8::internal | 3654 } } // namespace v8::internal |
OLD | NEW |