OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved.7 | 1 // Copyright 2012 the V8 project authors. All rights reserved.7 |
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 4916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4927 __ mov(input_reg, zero_reg); // In delay slot. | 4927 __ mov(input_reg, zero_reg); // In delay slot. |
4928 | 4928 |
4929 __ bind(&check_bools); | 4929 __ bind(&check_bools); |
4930 __ LoadRoot(at, Heap::kTrueValueRootIndex); | 4930 __ LoadRoot(at, Heap::kTrueValueRootIndex); |
4931 __ Branch(&check_false, ne, scratch2, Operand(at)); | 4931 __ Branch(&check_false, ne, scratch2, Operand(at)); |
4932 __ Branch(USE_DELAY_SLOT, &done); | 4932 __ Branch(USE_DELAY_SLOT, &done); |
4933 __ li(input_reg, Operand(1)); // In delay slot. | 4933 __ li(input_reg, Operand(1)); // In delay slot. |
4934 | 4934 |
4935 __ bind(&check_false); | 4935 __ bind(&check_false); |
4936 __ LoadRoot(at, Heap::kFalseValueRootIndex); | 4936 __ LoadRoot(at, Heap::kFalseValueRootIndex); |
| 4937 __ RecordComment("Deferred TaggedToI: cannot truncate"); |
4937 DeoptimizeIf(ne, instr->environment(), scratch2, Operand(at)); | 4938 DeoptimizeIf(ne, instr->environment(), scratch2, Operand(at)); |
4938 __ Branch(USE_DELAY_SLOT, &done); | 4939 __ Branch(USE_DELAY_SLOT, &done); |
4939 __ mov(input_reg, zero_reg); // In delay slot. | 4940 __ mov(input_reg, zero_reg); // In delay slot. |
4940 } else { | 4941 } else { |
4941 // Deoptimize if we don't have a heap number. | 4942 __ RecordComment("Deferred TaggedToI: not a heap number"); |
4942 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at)); | 4943 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(at)); |
4943 | 4944 |
4944 // Load the double value. | 4945 // Load the double value. |
4945 __ ldc1(double_scratch, | 4946 __ ldc1(double_scratch, |
4946 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); | 4947 FieldMemOperand(input_reg, HeapNumber::kValueOffset)); |
4947 | 4948 |
4948 Register except_flag = scratch2; | 4949 Register except_flag = scratch2; |
4949 __ EmitFPUTruncate(kRoundToZero, | 4950 __ EmitFPUTruncate(kRoundToZero, |
4950 input_reg, | 4951 input_reg, |
4951 double_scratch, | 4952 double_scratch, |
4952 scratch1, | 4953 scratch1, |
4953 double_scratch2, | 4954 double_scratch2, |
4954 except_flag, | 4955 except_flag, |
4955 kCheckForInexactConversion); | 4956 kCheckForInexactConversion); |
4956 | 4957 |
4957 // Deopt if the operation did not succeed. | 4958 __ RecordComment("Deferred TaggedToI: lost precision or NaN"); |
4958 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg)); | 4959 DeoptimizeIf(ne, instr->environment(), except_flag, Operand(zero_reg)); |
4959 | 4960 |
4960 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { | 4961 if (instr->hydrogen()->CheckFlag(HValue::kBailoutOnMinusZero)) { |
4961 __ Branch(&done, ne, input_reg, Operand(zero_reg)); | 4962 __ Branch(&done, ne, input_reg, Operand(zero_reg)); |
4962 | 4963 |
4963 __ Mfhc1(scratch1, double_scratch); | 4964 __ Mfhc1(scratch1, double_scratch); |
4964 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); | 4965 __ And(scratch1, scratch1, Operand(HeapNumber::kSignMask)); |
| 4966 __ RecordComment("Deferred TaggedToI: minus zero"); |
4965 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); | 4967 DeoptimizeIf(ne, instr->environment(), scratch1, Operand(zero_reg)); |
4966 } | 4968 } |
4967 } | 4969 } |
4968 __ bind(&done); | 4970 __ bind(&done); |
4969 } | 4971 } |
4970 | 4972 |
4971 | 4973 |
4972 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { | 4974 void LCodeGen::DoTaggedToI(LTaggedToI* instr) { |
4973 class DeferredTaggedToI FINAL : public LDeferredCode { | 4975 class DeferredTaggedToI FINAL : public LDeferredCode { |
4974 public: | 4976 public: |
(...skipping 955 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5930 __ li(at, scope_info); | 5932 __ li(at, scope_info); |
5931 __ Push(at, ToRegister(instr->function())); | 5933 __ Push(at, ToRegister(instr->function())); |
5932 CallRuntime(Runtime::kPushBlockContext, 2, instr); | 5934 CallRuntime(Runtime::kPushBlockContext, 2, instr); |
5933 RecordSafepoint(Safepoint::kNoLazyDeopt); | 5935 RecordSafepoint(Safepoint::kNoLazyDeopt); |
5934 } | 5936 } |
5935 | 5937 |
5936 | 5938 |
5937 #undef __ | 5939 #undef __ |
5938 | 5940 |
5939 } } // namespace v8::internal | 5941 } } // namespace v8::internal |
OLD | NEW |