Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(166)

Side by Side Diff: src/hydrogen-instructions.cc

Issue 16134003: Support Smi in CompareIDAndBranch (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 2436 matching lines...) Expand 10 before | Expand all | Expand 10 after
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) {
2457 Representation rep = Representation::None();
2458 Representation left_rep = left()->representation(); 2457 Representation left_rep = left()->representation();
2459 Representation right_rep = right()->representation(); 2458 Representation right_rep = right()->representation();
2460 bool observed_integers = 2459 Representation observed_left = observed_input_representation(0);
2461 observed_input_representation(0).IsInteger32() && 2460 Representation observed_right = observed_input_representation(1);
2462 observed_input_representation(1).IsInteger32(); 2461
2463 bool inputs_are_not_doubles = 2462 Representation rep = Representation::Smi();
2464 !left_rep.IsDouble() && !right_rep.IsDouble(); 2463 if (!left_rep.IsTagged()) rep = rep.generalize(left_rep);
2465 if (observed_integers && inputs_are_not_doubles) { 2464 if (!right_rep.IsTagged()) rep = rep.generalize(right_rep);
2466 rep = Representation::Integer32(); 2465 if (!observed_left.IsTagged()) rep = rep.generalize(observed_left);
2467 } else { 2466 if (!observed_right.IsTagged()) rep = rep.generalize(observed_right);
2468 rep = Representation::Double(); 2467
2468 if (rep.IsDouble()) {
2469 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, === 2469 // According to the ES5 spec (11.9.3, 11.8.5), Equality comparisons (==, ===
2470 // and !=) have special handling of undefined, e.g. undefined == undefined 2470 // and !=) have special handling of undefined, e.g. undefined == undefined
2471 // is 'true'. Relational comparisons have a different semantic, first 2471 // is 'true'. Relational comparisons have a different semantic, first
2472 // calling ToPrimitive() on their arguments. The standard Crankshaft 2472 // calling ToPrimitive() on their arguments. The standard Crankshaft
2473 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs 2473 // tagged-to-double conversion to ensure the HCompareIDAndBranch's inputs
2474 // are doubles caused 'undefined' to be converted to NaN. That's compatible 2474 // are doubles caused 'undefined' to be converted to NaN. That's compatible
2475 // out-of-the box with ordered relational comparisons (<, >, <=, 2475 // out-of-the box with ordered relational comparisons (<, >, <=,
2476 // >=). However, for equality comparisons (and for 'in' and 'instanceof'), 2476 // >=). However, for equality comparisons (and for 'in' and 'instanceof'),
2477 // it is not consistent with the spec. For example, it would cause undefined 2477 // it is not consistent with the spec. For example, it would cause undefined
2478 // == undefined (should be true) to be evaluated as NaN == NaN 2478 // == undefined (should be true) to be evaluated as NaN == NaN
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3795 case kBackingStore: 3795 case kBackingStore:
3796 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3796 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3797 stream->Add("[backing-store]"); 3797 stream->Add("[backing-store]");
3798 break; 3798 break;
3799 } 3799 }
3800 3800
3801 stream->Add("@%d", offset()); 3801 stream->Add("@%d", offset());
3802 } 3802 }
3803 3803
3804 } } // namespace v8::internal 3804 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen.cc ('k') | src/ia32/lithium-codegen-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698