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 2442 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2453 } | 2453 } |
2454 | 2454 |
2455 | 2455 |
2456 void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) { | 2456 void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) { |
2457 Representation left_rep = left()->representation(); | 2457 Representation left_rep = left()->representation(); |
2458 Representation right_rep = right()->representation(); | 2458 Representation right_rep = right()->representation(); |
2459 Representation observed_left = observed_input_representation(0); | 2459 Representation observed_left = observed_input_representation(0); |
2460 Representation observed_right = observed_input_representation(1); | 2460 Representation observed_right = observed_input_representation(1); |
2461 | 2461 |
2462 Representation rep = Representation::Smi(); | 2462 Representation rep = Representation::Smi(); |
2463 if (!left_rep.IsTagged()) rep = rep.generalize(left_rep); | 2463 if (observed_left.IsInteger32() && observed_right.IsInteger32()) { |
2464 if (!right_rep.IsTagged()) rep = rep.generalize(right_rep); | 2464 if (!left_rep.IsTagged()) rep = rep.generalize(left_rep); |
2465 if (!observed_left.IsTagged()) rep = rep.generalize(observed_left); | 2465 if (!right_rep.IsTagged()) rep = rep.generalize(right_rep); |
2466 if (!observed_right.IsTagged()) rep = rep.generalize(observed_right); | 2466 } else { |
| 2467 rep = Representation::Double(); |
| 2468 } |
2467 | 2469 |
2468 if (rep.IsDouble()) { | 2470 if (rep.IsDouble()) { |
2469 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === | 2471 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === |
2470 // and !=) have special handling of undefined, e.g. undefined == undefined | 2472 // and !=) have special handling of undefined, e.g. undefined == undefined |
2471 // is 'true'. Relational comparisons have a different semantic, first | 2473 // is 'true'. Relational comparisons have a different semantic, first |
2472 // calling ToPrimitive() on their arguments. The standard Crankshaft | 2474 // calling ToPrimitive() on their arguments. The standard Crankshaft |
2473 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs | 2475 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs |
2474 // are doubles caused 'undefined' to be converted to NaN. That's compatible | 2476 // are doubles caused 'undefined' to be converted to NaN. That's compatible |
2475 // out-of-the box with ordered relational comparisons (<, >, <=, | 2477 // out-of-the box with ordered relational comparisons (<, >, <=, |
2476 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), | 2478 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), |
(...skipping 1318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3795 case kBackingStore: | 3797 case kBackingStore: |
3796 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3798 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
3797 stream->Add("[backing-store]"); | 3799 stream->Add("[backing-store]"); |
3798 break; | 3800 break; |
3799 } | 3801 } |
3800 | 3802 |
3801 stream->Add("@%d", offset()); | 3803 stream->Add("@%d", offset()); |
3802 } | 3804 } |
3803 | 3805 |
3804 } } // namespace v8::internal | 3806 } } // namespace v8::internal |
OLD | NEW |