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