| 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 1000 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1011 } | 1011 } |
| 1012 | 1012 |
| 1013 // Correct the sign of the result is the constant is negative. | 1013 // Correct the sign of the result is the constant is negative. |
| 1014 if (constant < 0) { | 1014 if (constant < 0) { |
| 1015 __ Subu(result, zero_reg, result); | 1015 __ Subu(result, zero_reg, result); |
| 1016 } | 1016 } |
| 1017 | 1017 |
| 1018 } else { | 1018 } else { |
| 1019 // Generate standard code. | 1019 // Generate standard code. |
| 1020 __ li(at, constant); | 1020 __ li(at, constant); |
| 1021 __ mul(result, left, at); | 1021 __ Mul(result, left, at); |
| 1022 } | 1022 } |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 } else { | 1025 } else { |
| 1026 Register right = EmitLoadRegister(right_op, scratch); | 1026 Register right = EmitLoadRegister(right_op, scratch); |
| 1027 if (bailout_on_minus_zero) { | 1027 if (bailout_on_minus_zero) { |
| 1028 __ Or(ToRegister(instr->TempAt(0)), left, right); | 1028 __ Or(ToRegister(instr->TempAt(0)), left, right); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 if (can_overflow) { | 1031 if (can_overflow) { |
| 1032 // hi:lo = left * right. | 1032 // hi:lo = left * right. |
| 1033 __ mult(left, right); | 1033 __ mult(left, right); |
| 1034 __ mfhi(scratch); | 1034 __ mfhi(scratch); |
| 1035 __ mflo(result); | 1035 __ mflo(result); |
| 1036 __ sra(at, result, 31); | 1036 __ sra(at, result, 31); |
| 1037 DeoptimizeIf(ne, instr->environment(), scratch, Operand(at)); | 1037 DeoptimizeIf(ne, instr->environment(), scratch, Operand(at)); |
| 1038 } else { | 1038 } else { |
| 1039 __ mul(result, left, right); | 1039 __ Mul(result, left, right); |
| 1040 } | 1040 } |
| 1041 | 1041 |
| 1042 if (bailout_on_minus_zero) { | 1042 if (bailout_on_minus_zero) { |
| 1043 // Bail out if the result is supposed to be negative zero. | 1043 // Bail out if the result is supposed to be negative zero. |
| 1044 Label done; | 1044 Label done; |
| 1045 __ Branch(&done, ne, result, Operand(zero_reg)); | 1045 __ Branch(&done, ne, result, Operand(zero_reg)); |
| 1046 DeoptimizeIf(lt, | 1046 DeoptimizeIf(lt, |
| 1047 instr->environment(), | 1047 instr->environment(), |
| 1048 ToRegister(instr->TempAt(0)), | 1048 ToRegister(instr->TempAt(0)), |
| 1049 Operand(zero_reg)); | 1049 Operand(zero_reg)); |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2657 Register result = ToRegister(instr->result()); | 2657 Register result = ToRegister(instr->result()); |
| 2658 | 2658 |
| 2659 // Check if the calling frame is an arguments adaptor frame. | 2659 // Check if the calling frame is an arguments adaptor frame. |
| 2660 Label done, adapted; | 2660 Label done, adapted; |
| 2661 __ lw(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2661 __ lw(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
| 2662 __ lw(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); | 2662 __ lw(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); |
| 2663 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2663 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
| 2664 | 2664 |
| 2665 // Result is the frame pointer for the frame if not adapted and for the real | 2665 // Result is the frame pointer for the frame if not adapted and for the real |
| 2666 // frame below the adaptor frame if adapted. | 2666 // frame below the adaptor frame if adapted. |
| 2667 __ movn(result, fp, temp); // move only if temp is not equal to zero (ne) | 2667 __ Movn(result, fp, temp); // Move only if temp is not equal to zero (ne). |
| 2668 __ movz(result, scratch, temp); // move only if temp is equal to zero (eq) | 2668 __ Movz(result, scratch, temp); // Move only if temp is equal to zero (eq). |
| 2669 } | 2669 } |
| 2670 | 2670 |
| 2671 | 2671 |
| 2672 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { | 2672 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { |
| 2673 Register elem = ToRegister(instr->InputAt(0)); | 2673 Register elem = ToRegister(instr->InputAt(0)); |
| 2674 Register result = ToRegister(instr->result()); | 2674 Register result = ToRegister(instr->result()); |
| 2675 | 2675 |
| 2676 Label done; | 2676 Label done; |
| 2677 | 2677 |
| 2678 // If no arguments adaptor frame the number of arguments is fixed. | 2678 // If no arguments adaptor frame the number of arguments is fixed. |
| (...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5046 __ Subu(scratch, result, scratch); | 5046 __ Subu(scratch, result, scratch); |
| 5047 __ lw(result, FieldMemOperand(scratch, | 5047 __ lw(result, FieldMemOperand(scratch, |
| 5048 FixedArray::kHeaderSize - kPointerSize)); | 5048 FixedArray::kHeaderSize - kPointerSize)); |
| 5049 __ bind(&done); | 5049 __ bind(&done); |
| 5050 } | 5050 } |
| 5051 | 5051 |
| 5052 | 5052 |
| 5053 #undef __ | 5053 #undef __ |
| 5054 | 5054 |
| 5055 } } // namespace v8::internal | 5055 } } // namespace v8::internal |
| OLD | NEW |