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 1567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 Register result = ToRegister(instr->result()); | 2617 Register result = ToRegister(instr->result()); |
2618 | 2618 |
2619 // Check if the calling frame is an arguments adaptor frame. | 2619 // Check if the calling frame is an arguments adaptor frame. |
2620 Label done, adapted; | 2620 Label done, adapted; |
2621 __ lw(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); | 2621 __ lw(scratch, MemOperand(fp, StandardFrameConstants::kCallerFPOffset)); |
2622 __ lw(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); | 2622 __ lw(result, MemOperand(scratch, StandardFrameConstants::kContextOffset)); |
2623 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); | 2623 __ Xor(temp, result, Operand(Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR))); |
2624 | 2624 |
2625 // Result is the frame pointer for the frame if not adapted and for the real | 2625 // Result is the frame pointer for the frame if not adapted and for the real |
2626 // frame below the adaptor frame if adapted. | 2626 // frame below the adaptor frame if adapted. |
2627 __ movn(result, fp, temp); // move only if temp is not equal to zero (ne) | 2627 __ Movn(result, fp, temp); // Move only if temp is not equal to zero (ne). |
2628 __ movz(result, scratch, temp); // move only if temp is equal to zero (eq) | 2628 __ Movz(result, scratch, temp); // Move only if temp is equal to zero (eq). |
2629 } | 2629 } |
2630 | 2630 |
2631 | 2631 |
2632 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { | 2632 void LCodeGen::DoArgumentsLength(LArgumentsLength* instr) { |
2633 Register elem = ToRegister(instr->InputAt(0)); | 2633 Register elem = ToRegister(instr->InputAt(0)); |
2634 Register result = ToRegister(instr->result()); | 2634 Register result = ToRegister(instr->result()); |
2635 | 2635 |
2636 Label done; | 2636 Label done; |
2637 | 2637 |
2638 // If no arguments adaptor frame the number of arguments is fixed. | 2638 // If no arguments adaptor frame the number of arguments is fixed. |
(...skipping 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5006 __ Subu(scratch, result, scratch); | 5006 __ Subu(scratch, result, scratch); |
5007 __ lw(result, FieldMemOperand(scratch, | 5007 __ lw(result, FieldMemOperand(scratch, |
5008 FixedArray::kHeaderSize - kPointerSize)); | 5008 FixedArray::kHeaderSize - kPointerSize)); |
5009 __ bind(&done); | 5009 __ bind(&done); |
5010 } | 5010 } |
5011 | 5011 |
5012 | 5012 |
5013 #undef __ | 5013 #undef __ |
5014 | 5014 |
5015 } } // namespace v8::internal | 5015 } } // namespace v8::internal |
OLD | NEW |