| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1927 ASSERT(cc == less || cc == equal || cc == greater_equal); | 1927 ASSERT(cc == less || cc == equal || cc == greater_equal); |
| 1928 | 1928 |
| 1929 // If either side is a constant of some sort, we can probably optimize the | 1929 // If either side is a constant of some sort, we can probably optimize the |
| 1930 // comparison. | 1930 // comparison. |
| 1931 bool left_side_constant_smi = false; | 1931 bool left_side_constant_smi = false; |
| 1932 bool left_side_constant_null = false; | 1932 bool left_side_constant_null = false; |
| 1933 bool left_side_constant_1_char_string = false; | 1933 bool left_side_constant_1_char_string = false; |
| 1934 if (left_side.is_constant()) { | 1934 if (left_side.is_constant()) { |
| 1935 left_side_constant_smi = left_side.handle()->IsSmi(); | 1935 left_side_constant_smi = left_side.handle()->IsSmi(); |
| 1936 left_side_constant_null = left_side.handle()->IsNull(); | 1936 left_side_constant_null = left_side.handle()->IsNull(); |
| 1937 left_side_constant_1_char_string = | 1937 left_side_constant_1_char_string = |
| 1938 (left_side.handle()->IsString() && | 1938 (left_side.handle()->IsString() && |
| 1939 (String::cast(*left_side.handle())->length() == 1)); | 1939 (String::cast(*left_side.handle())->length() == 1)); |
| 1940 } | 1940 } |
| 1941 bool right_side_constant_smi = false; | 1941 bool right_side_constant_smi = false; |
| 1942 bool right_side_constant_null = false; | 1942 bool right_side_constant_null = false; |
| 1943 bool right_side_constant_1_char_string = false; | 1943 bool right_side_constant_1_char_string = false; |
| 1944 if (right_side.is_constant()) { | 1944 if (right_side.is_constant()) { |
| 1945 right_side_constant_smi = right_side.handle()->IsSmi(); | 1945 right_side_constant_smi = right_side.handle()->IsSmi(); |
| 1946 right_side_constant_null = right_side.handle()->IsNull(); | 1946 right_side_constant_null = right_side.handle()->IsNull(); |
| 1947 right_side_constant_1_char_string = | 1947 right_side_constant_1_char_string = |
| 1948 (right_side.handle()->IsString() && | 1948 (right_side.handle()->IsString() && |
| 1949 (String::cast(*right_side.handle())->length() == 1)); | 1949 (String::cast(*right_side.handle())->length() == 1)); |
| 1950 } | 1950 } |
| 1951 | 1951 |
| 1952 if (left_side_constant_smi || right_side_constant_smi) { | 1952 if (left_side_constant_smi || right_side_constant_smi) { |
| 1953 if (left_side_constant_smi && right_side_constant_smi) { | 1953 if (left_side_constant_smi && right_side_constant_smi) { |
| 1954 // Trivial case, comparing two constants. | 1954 // Trivial case, comparing two constants. |
| 1955 int left_value = Smi::cast(*left_side.handle())->value(); | 1955 int left_value = Smi::cast(*left_side.handle())->value(); |
| 1956 int right_value = Smi::cast(*right_side.handle())->value(); | 1956 int right_value = Smi::cast(*right_side.handle())->value(); |
| 1957 switch (cc) { | 1957 switch (cc) { |
| (...skipping 7617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9575 __ ret(3 * kPointerSize); | 9575 __ ret(3 * kPointerSize); |
| 9576 | 9576 |
| 9577 // Just jump to runtime to create the sub string. | 9577 // Just jump to runtime to create the sub string. |
| 9578 __ bind(&runtime); | 9578 __ bind(&runtime); |
| 9579 __ TailCallRuntime(ExternalReference(Runtime::kSubString), 3, 1); | 9579 __ TailCallRuntime(ExternalReference(Runtime::kSubString), 3, 1); |
| 9580 } | 9580 } |
| 9581 | 9581 |
| 9582 #undef __ | 9582 #undef __ |
| 9583 | 9583 |
| 9584 } } // namespace v8::internal | 9584 } } // namespace v8::internal |
| OLD | NEW |