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