| 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 878 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 889 if (stub->operation() == Token::ADD && | 889 if (stub->operation() == Token::ADD && |
| 890 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && | 890 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && |
| 891 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { | 891 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { |
| 892 // For the generic add stub a fast case for string addition is performance | 892 // For the generic add stub a fast case for string addition is performance |
| 893 // critical. | 893 // critical. |
| 894 if (left_type->Maybe(Type::String())) { | 894 if (left_type->Maybe(Type::String())) { |
| 895 IfBuilder if_leftisstring(this); | 895 IfBuilder if_leftisstring(this); |
| 896 if_leftisstring.If<HIsStringAndBranch>(left); | 896 if_leftisstring.If<HIsStringAndBranch>(left); |
| 897 if_leftisstring.Then(); | 897 if_leftisstring.Then(); |
| 898 { | 898 { |
| 899 Push(AddInstruction(BuildBinaryOperation( | 899 Push(BuildBinaryOperation( |
| 900 stub->operation(), left, right, | 900 stub->operation(), left, right, |
| 901 handle(Type::String(), isolate()), right_type, | 901 handle(Type::String(), isolate()), right_type, |
| 902 result_type, stub->fixed_right_arg(), true))); | 902 result_type, stub->fixed_right_arg(), true)); |
| 903 } | 903 } |
| 904 if_leftisstring.Else(); | 904 if_leftisstring.Else(); |
| 905 { | 905 { |
| 906 Push(AddInstruction(BuildBinaryOperation( | 906 Push(BuildBinaryOperation( |
| 907 stub->operation(), left, right, | 907 stub->operation(), left, right, |
| 908 left_type, right_type, result_type, | 908 left_type, right_type, result_type, |
| 909 stub->fixed_right_arg(), true))); | 909 stub->fixed_right_arg(), true)); |
| 910 } | 910 } |
| 911 if_leftisstring.End(); | 911 if_leftisstring.End(); |
| 912 result = Pop(); | 912 result = Pop(); |
| 913 } else { | 913 } else { |
| 914 IfBuilder if_rightisstring(this); | 914 IfBuilder if_rightisstring(this); |
| 915 if_rightisstring.If<HIsStringAndBranch>(right); | 915 if_rightisstring.If<HIsStringAndBranch>(right); |
| 916 if_rightisstring.Then(); | 916 if_rightisstring.Then(); |
| 917 { | 917 { |
| 918 Push(AddInstruction(BuildBinaryOperation( | 918 Push(BuildBinaryOperation( |
| 919 stub->operation(), left, right, | 919 stub->operation(), left, right, |
| 920 left_type, handle(Type::String(), isolate()), | 920 left_type, handle(Type::String(), isolate()), |
| 921 result_type, stub->fixed_right_arg(), true))); | 921 result_type, stub->fixed_right_arg(), true)); |
| 922 } | 922 } |
| 923 if_rightisstring.Else(); | 923 if_rightisstring.Else(); |
| 924 { | 924 { |
| 925 Push(AddInstruction(BuildBinaryOperation( | 925 Push(BuildBinaryOperation( |
| 926 stub->operation(), left, right, | 926 stub->operation(), left, right, |
| 927 left_type, right_type, result_type, | 927 left_type, right_type, result_type, |
| 928 stub->fixed_right_arg(), true))); | 928 stub->fixed_right_arg(), true)); |
| 929 } | 929 } |
| 930 if_rightisstring.End(); | 930 if_rightisstring.End(); |
| 931 result = Pop(); | 931 result = Pop(); |
| 932 } | 932 } |
| 933 } else { | 933 } else { |
| 934 result = AddInstruction(BuildBinaryOperation( | 934 result = BuildBinaryOperation( |
| 935 stub->operation(), left, right, | 935 stub->operation(), left, right, |
| 936 left_type, right_type, result_type, | 936 left_type, right_type, result_type, |
| 937 stub->fixed_right_arg(), true)); | 937 stub->fixed_right_arg(), true); |
| 938 } | 938 } |
| 939 | 939 |
| 940 // If we encounter a generic argument, the number conversion is | 940 // If we encounter a generic argument, the number conversion is |
| 941 // observable, thus we cannot afford to bail out after the fact. | 941 // observable, thus we cannot afford to bail out after the fact. |
| 942 if (!stub->HasSideEffects(isolate())) { | 942 if (!stub->HasSideEffects(isolate())) { |
| 943 if (result_type->Is(Type::Smi())) { | 943 if (result_type->Is(Type::Smi())) { |
| 944 if (stub->operation() == Token::SHR) { | 944 if (stub->operation() == Token::SHR) { |
| 945 // TODO(olivf) Replace this by a SmiTagU Instruction. | 945 // TODO(olivf) Replace this by a SmiTagU Instruction. |
| 946 // 0x40000000: this number would convert to negative when interpreting | 946 // 0x40000000: this number would convert to negative when interpreting |
| 947 // the register as signed value; | 947 // the register as signed value; |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1313 return BuildUncheckedDictionaryElementLoad(receiver, key); | 1313 return BuildUncheckedDictionaryElementLoad(receiver, key); |
| 1314 } | 1314 } |
| 1315 | 1315 |
| 1316 | 1316 |
| 1317 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { | 1317 Handle<Code> KeyedLoadDictionaryElementStub::GenerateCode(Isolate* isolate) { |
| 1318 return DoGenerateCode(isolate, this); | 1318 return DoGenerateCode(isolate, this); |
| 1319 } | 1319 } |
| 1320 | 1320 |
| 1321 | 1321 |
| 1322 } } // namespace v8::internal | 1322 } } // namespace v8::internal |
| OLD | NEW |