| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
| 8 #include "src/field-index.h" | 8 #include "src/field-index.h" |
| 9 #include "src/hydrogen.h" | 9 #include "src/hydrogen.h" |
| 10 #include "src/lithium.h" | 10 #include "src/lithium.h" |
| (...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 913 } else { | 913 } else { |
| 914 result = BuildBinaryOperation( | 914 result = BuildBinaryOperation( |
| 915 state.op(), left, right, | 915 state.op(), left, right, |
| 916 left_type, right_type, result_type, | 916 left_type, right_type, result_type, |
| 917 state.fixed_right_arg(), allocation_mode); | 917 state.fixed_right_arg(), allocation_mode); |
| 918 } | 918 } |
| 919 | 919 |
| 920 // If we encounter a generic argument, the number conversion is | 920 // If we encounter a generic argument, the number conversion is |
| 921 // observable, thus we cannot afford to bail out after the fact. | 921 // observable, thus we cannot afford to bail out after the fact. |
| 922 if (!state.HasSideEffects()) { | 922 if (!state.HasSideEffects()) { |
| 923 if (result_type->Is(Type::SignedSmall())) { | |
| 924 if (state.op() == Token::SHR) { | |
| 925 // TODO(olivf) Replace this by a SmiTagU Instruction. | |
| 926 // 0x40000000: this number would convert to negative when interpreting | |
| 927 // the register as signed value; | |
| 928 IfBuilder if_of(this); | |
| 929 if_of.IfNot<HCompareNumericAndBranch>(result, | |
| 930 Add<HConstant>(static_cast<int>(SmiValuesAre32Bits() | |
| 931 ? 0x80000000 : 0x40000000)), Token::EQ_STRICT); | |
| 932 if_of.Then(); | |
| 933 if_of.ElseDeopt("UInt->Smi oveflow"); | |
| 934 if_of.End(); | |
| 935 } | |
| 936 } | |
| 937 result = EnforceNumberType(result, result_type); | 923 result = EnforceNumberType(result, result_type); |
| 938 } | 924 } |
| 939 | 925 |
| 940 // Reuse the double box of one of the operands if we are allowed to (i.e. | 926 // Reuse the double box of one of the operands if we are allowed to (i.e. |
| 941 // chained binops). | 927 // chained binops). |
| 942 if (state.CanReuseDoubleBox()) { | 928 if (state.CanReuseDoubleBox()) { |
| 943 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right; | 929 HValue* operand = (state.mode() == OVERWRITE_LEFT) ? left : right; |
| 944 IfBuilder if_heap_number(this); | 930 IfBuilder if_heap_number(this); |
| 945 if_heap_number.If<HHasInstanceTypeAndBranch>(operand, HEAP_NUMBER_TYPE); | 931 if_heap_number.If<HHasInstanceTypeAndBranch>(operand, HEAP_NUMBER_TYPE); |
| 946 if_heap_number.Then(); | 932 if_heap_number.Then(); |
| (...skipping 768 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1715 return Pop(); | 1701 return Pop(); |
| 1716 } | 1702 } |
| 1717 | 1703 |
| 1718 | 1704 |
| 1719 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { | 1705 Handle<Code> KeyedLoadGenericElementStub::GenerateCode() { |
| 1720 return DoGenerateCode(this); | 1706 return DoGenerateCode(this); |
| 1721 } | 1707 } |
| 1722 | 1708 |
| 1723 | 1709 |
| 1724 } } // namespace v8::internal | 1710 } } // namespace v8::internal |
| OLD | NEW |