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