| 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 904 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 915 // For the generic add stub a fast case for string addition is performance | 915 // For the generic add stub a fast case for string addition is performance |
| 916 // critical. | 916 // critical. |
| 917 if (left_type->Maybe(Type::String())) { | 917 if (left_type->Maybe(Type::String())) { |
| 918 IfBuilder if_leftisstring(this); | 918 IfBuilder if_leftisstring(this); |
| 919 if_leftisstring.If<HIsStringAndBranch>(left); | 919 if_leftisstring.If<HIsStringAndBranch>(left); |
| 920 if_leftisstring.Then(); | 920 if_leftisstring.Then(); |
| 921 { | 921 { |
| 922 Push(BuildBinaryOperation( | 922 Push(BuildBinaryOperation( |
| 923 state.op(), left, right, | 923 state.op(), left, right, |
| 924 handle(Type::String(), isolate()), right_type, | 924 handle(Type::String(), isolate()), right_type, |
| 925 result_type)); | 925 result_type, state.fixed_right_arg())); |
| 926 } | 926 } |
| 927 if_leftisstring.Else(); | 927 if_leftisstring.Else(); |
| 928 { | 928 { |
| 929 Push(BuildBinaryOperation( | 929 Push(BuildBinaryOperation( |
| 930 state.op(), left, right, | 930 state.op(), left, right, |
| 931 left_type, right_type, result_type)); | 931 left_type, right_type, result_type, |
| 932 state.fixed_right_arg())); |
| 932 } | 933 } |
| 933 if_leftisstring.End(); | 934 if_leftisstring.End(); |
| 934 result = Pop(); | 935 result = Pop(); |
| 935 } else { | 936 } else { |
| 936 IfBuilder if_rightisstring(this); | 937 IfBuilder if_rightisstring(this); |
| 937 if_rightisstring.If<HIsStringAndBranch>(right); | 938 if_rightisstring.If<HIsStringAndBranch>(right); |
| 938 if_rightisstring.Then(); | 939 if_rightisstring.Then(); |
| 939 { | 940 { |
| 940 Push(BuildBinaryOperation( | 941 Push(BuildBinaryOperation( |
| 941 state.op(), left, right, | 942 state.op(), left, right, |
| 942 left_type, handle(Type::String(), isolate()), | 943 left_type, handle(Type::String(), isolate()), |
| 943 result_type)); | 944 result_type, state.fixed_right_arg())); |
| 944 } | 945 } |
| 945 if_rightisstring.Else(); | 946 if_rightisstring.Else(); |
| 946 { | 947 { |
| 947 Push(BuildBinaryOperation( | 948 Push(BuildBinaryOperation( |
| 948 state.op(), left, right, | 949 state.op(), left, right, |
| 949 left_type, right_type, result_type)); | 950 left_type, right_type, result_type, |
| 951 state.fixed_right_arg())); |
| 950 } | 952 } |
| 951 if_rightisstring.End(); | 953 if_rightisstring.End(); |
| 952 result = Pop(); | 954 result = Pop(); |
| 953 } | 955 } |
| 954 } else { | 956 } else { |
| 955 result = BuildBinaryOperation( | 957 result = BuildBinaryOperation( |
| 956 state.op(), left, right, | 958 state.op(), left, right, |
| 957 left_type, right_type, result_type); | 959 left_type, right_type, result_type, |
| 960 state.fixed_right_arg()); |
| 958 } | 961 } |
| 959 | 962 |
| 960 // If we encounter a generic argument, the number conversion is | 963 // If we encounter a generic argument, the number conversion is |
| 961 // observable, thus we cannot afford to bail out after the fact. | 964 // observable, thus we cannot afford to bail out after the fact. |
| 962 if (!state.HasSideEffects()) { | 965 if (!state.HasSideEffects()) { |
| 963 if (result_type->Is(Type::Smi())) { | 966 if (result_type->Is(Type::Smi())) { |
| 964 if (state.op() == Token::SHR) { | 967 if (state.op() == Token::SHR) { |
| 965 // TODO(olivf) Replace this by a SmiTagU Instruction. | 968 // TODO(olivf) Replace this by a SmiTagU Instruction. |
| 966 // 0x40000000: this number would convert to negative when interpreting | 969 // 0x40000000: this number would convert to negative when interpreting |
| 967 // the register as signed value; | 970 // the register as signed value; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1327 return BuildUncheckedDictionaryElementLoad(receiver, key); | 1330 return BuildUncheckedDictionaryElementLoad(receiver, key); |
| 1328 } | 1331 } |
| 1329 | 1332 |
| 1330 | 1333 |
| 1331 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { | 1334 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { |
| 1332 return DoGenerateCode(isolate, this); | 1335 return DoGenerateCode(isolate, this); |
| 1333 } | 1336 } |
| 1334 | 1337 |
| 1335 | 1338 |
| 1336 } } // namespace v8::internal | 1339 } } // namespace v8::internal |
| OLD | NEW |