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 867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 (stub->HasSideEffects(isolate()) || !result_type->Is(Type::None()))); | 878 (stub->HasSideEffects(isolate()) || !result_type->Is(Type::None()))); |
879 | 879 |
880 HValue* result = NULL; | 880 HValue* result = NULL; |
881 if (stub->operation() == Token::ADD && | 881 if (stub->operation() == Token::ADD && |
882 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && | 882 (left_type->Maybe(Type::String()) || right_type->Maybe(Type::String())) && |
883 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { | 883 !left_type->Is(Type::String()) && !right_type->Is(Type::String())) { |
884 // For the generic add stub a fast case for String add is performance | 884 // For the generic add stub a fast case for String add is performance |
885 // critical. | 885 // critical. |
886 if (left_type->Maybe(Type::String())) { | 886 if (left_type->Maybe(Type::String())) { |
887 IfBuilder left_string(this); | 887 IfBuilder left_string(this); |
888 left_string.IfNot<HIsSmiAndBranch>(left); | 888 left_string.If<HIsStringAndBranch>(left); |
889 left_string.AndIf<HIsStringAndBranch>(left); | |
890 left_string.Then(); | 889 left_string.Then(); |
891 Push(Add<HStringAdd>(left, right, STRING_ADD_CHECK_RIGHT)); | 890 Push(Add<HStringAdd>(left, right, STRING_ADD_CHECK_RIGHT)); |
892 left_string.Else(); | 891 left_string.Else(); |
893 Push(AddInstruction(BuildBinaryOperation(stub->operation(), | 892 Push(AddInstruction(BuildBinaryOperation(stub->operation(), |
894 left, right, left_type, right_type, result_type, | 893 left, right, left_type, right_type, result_type, |
895 stub->fixed_right_arg(), true))); | 894 stub->fixed_right_arg(), true))); |
896 left_string.End(); | 895 left_string.End(); |
897 result = Pop(); | 896 result = Pop(); |
898 } else { | 897 } else { |
899 IfBuilder right_string(this); | 898 IfBuilder right_string(this); |
900 right_string.IfNot<HIsSmiAndBranch>(right); | 899 right_string.If<HIsStringAndBranch>(right); |
901 right_string.AndIf<HIsStringAndBranch>(right); | |
902 right_string.Then(); | 900 right_string.Then(); |
903 Push(Add<HStringAdd>(left, right, STRING_ADD_CHECK_LEFT)); | 901 Push(Add<HStringAdd>(left, right, STRING_ADD_CHECK_LEFT)); |
904 right_string.Else(); | 902 right_string.Else(); |
905 Push(AddInstruction(BuildBinaryOperation(stub->operation(), | 903 Push(AddInstruction(BuildBinaryOperation(stub->operation(), |
906 left, right, left_type, right_type, result_type, | 904 left, right, left_type, right_type, result_type, |
907 stub->fixed_right_arg(), true))); | 905 stub->fixed_right_arg(), true))); |
908 right_string.End(); | 906 right_string.End(); |
909 result = Pop(); | 907 result = Pop(); |
910 } | 908 } |
911 } else { | 909 } else { |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1246 return js_function; | 1244 return js_function; |
1247 } | 1245 } |
1248 | 1246 |
1249 | 1247 |
1250 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { | 1248 Handle<Code> FastNewClosureStub::GenerateCode(Isolate* isolate) { |
1251 return DoGenerateCode(isolate, this); | 1249 return DoGenerateCode(isolate, this); |
1252 } | 1250 } |
1253 | 1251 |
1254 | 1252 |
1255 } } // namespace v8::internal | 1253 } } // namespace v8::internal |
OLD | NEW |