Chromium Code Reviews| 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 2435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2446 right()->PrintNameTo(stream); | 2446 right()->PrintNameTo(stream); |
| 2447 HControlInstruction::PrintDataTo(stream); | 2447 HControlInstruction::PrintDataTo(stream); |
| 2448 } | 2448 } |
| 2449 | 2449 |
| 2450 | 2450 |
| 2451 void HGoto::PrintDataTo(StringStream* stream) { | 2451 void HGoto::PrintDataTo(StringStream* stream) { |
| 2452 stream->Add("B%d", SuccessorAt(0)->block_id()); | 2452 stream->Add("B%d", SuccessorAt(0)->block_id()); |
| 2453 } | 2453 } |
| 2454 | 2454 |
| 2455 | 2455 |
| 2456 void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) { | 2456 void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) { |
|
Jakob Kummerow
2013/05/28 09:00:54
As discussed offline, please rewrite this method t
| |
| 2457 Representation rep = Representation::None(); | 2457 Representation rep = Representation::None(); |
| 2458 Representation left_rep = left()->representation(); | 2458 Representation left_rep = left()->representation(); |
| 2459 Representation right_rep = right()->representation(); | 2459 Representation right_rep = right()->representation(); |
| 2460 bool observed_integers = | 2460 bool observed_integers = |
| 2461 observed_input_representation(0).IsInteger32() && | 2461 observed_input_representation(0).IsInteger32() && |
| 2462 observed_input_representation(1).IsInteger32(); | 2462 observed_input_representation(1).IsInteger32(); |
| 2463 bool inputs_are_not_doubles = | 2463 bool inputs_are_not_doubles = !left_rep.IsDouble() && !right_rep.IsDouble(); |
| 2464 !left_rep.IsDouble() && !right_rep.IsDouble(); | 2464 |
| 2465 if (observed_integers && inputs_are_not_doubles) { | 2465 if (observed_integers && inputs_are_not_doubles) { |
| 2466 rep = Representation::Integer32(); | 2466 rep = Representation::Smi(); |
| 2467 if (left_rep.is_more_general_than(rep) && !left_rep.IsTagged()) { | |
| 2468 rep = Representation::Integer32(); | |
| 2469 } | |
| 2470 if (right_rep.is_more_general_than(rep) && !right_rep.IsTagged()) { | |
| 2471 rep = Representation::Integer32(); | |
| 2472 } | |
| 2467 } else { | 2473 } else { |
| 2468 rep = Representation::Double(); | 2474 rep = Representation::Double(); |
| 2469 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === | 2475 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === |
| 2470 // and !=) have special handling of undefined, e.g. undefined == undefined | 2476 // and !=) have special handling of undefined, e.g. undefined == undefined |
| 2471 // is 'true'. Relational comparisons have a different semantic, first | 2477 // is 'true'. Relational comparisons have a different semantic, first |
| 2472 // calling ToPrimitive() on their arguments. The standard Crankshaft | 2478 // calling ToPrimitive() on their arguments. The standard Crankshaft |
| 2473 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs | 2479 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs |
| 2474 // are doubles caused 'undefined' to be converted to NaN. That's compatible | 2480 // are doubles caused 'undefined' to be converted to NaN. That's compatible |
| 2475 // out-of-the box with ordered relational comparisons (<, >, <=, | 2481 // out-of-the box with ordered relational comparisons (<, >, <=, |
| 2476 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), | 2482 // >=). 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: | 3801 case kBackingStore: |
| 3796 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); | 3802 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); |
| 3797 stream->Add("[backing-store]"); | 3803 stream->Add("[backing-store]"); |
| 3798 break; | 3804 break; |
| 3799 } | 3805 } |
| 3800 | 3806 |
| 3801 stream->Add("@%d", offset()); | 3807 stream->Add("@%d", offset()); |
| 3802 } | 3808 } |
| 3803 | 3809 |
| 3804 } } // namespace v8::internal | 3810 } } // namespace v8::internal |
| OLD | NEW |