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

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

Issue 16240003: Improve smi support in crankshaft (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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-instructions.h ('k') | src/lithium-allocator.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 3547 matching lines...) Expand 10 before | Expand all | Expand 10 after
3558 Representation new_rep = RepresentationFromInputs(); 3558 Representation new_rep = RepresentationFromInputs();
3559 UpdateRepresentation(new_rep, h_infer, "inputs"); 3559 UpdateRepresentation(new_rep, h_infer, "inputs");
3560 new_rep = RepresentationFromUses(); 3560 new_rep = RepresentationFromUses();
3561 UpdateRepresentation(new_rep, h_infer, "uses"); 3561 UpdateRepresentation(new_rep, h_infer, "uses");
3562 new_rep = RepresentationFromUseRequirements(); 3562 new_rep = RepresentationFromUseRequirements();
3563 UpdateRepresentation(new_rep, h_infer, "use requirements"); 3563 UpdateRepresentation(new_rep, h_infer, "use requirements");
3564 } 3564 }
3565 3565
3566 3566
3567 Representation HPhi::RepresentationFromInputs() { 3567 Representation HPhi::RepresentationFromInputs() {
3568 bool tagged_smi_occurred = false;
Jakob Kummerow 2013/05/31 16:39:40 I don't think we should treat tagged_smi different
3568 bool double_occurred = false; 3569 bool double_occurred = false;
3569 bool int32_occurred = false; 3570 bool int32_occurred = false;
3570 bool smi_occurred = false; 3571 bool smi_occurred = false;
3571 for (int i = 0; i < OperandCount(); ++i) { 3572 for (int i = 0; i < OperandCount(); ++i) {
3572 HValue* value = OperandAt(i); 3573 HValue* value = OperandAt(i);
3573 if (value->IsUnknownOSRValue()) { 3574 if (value->IsUnknownOSRValue()) {
3574 HPhi* hint_value = HUnknownOSRValue::cast(value)->incoming_value(); 3575 HPhi* hint_value = HUnknownOSRValue::cast(value)->incoming_value();
3575 if (hint_value != NULL) { 3576 if (hint_value != NULL) {
3576 Representation hint = hint_value->representation(); 3577 Representation hint = hint_value->representation();
3577 if (hint.IsTagged()) return hint; 3578 if (hint.IsTagged()) {
3578 if (hint.IsDouble()) double_occurred = true; 3579 if (!hint_value->type().IsSmi()) return hint;
3579 if (hint.IsInteger32()) int32_occurred = true; 3580 if (double_occurred) return hint;
3580 if (hint.IsSmi()) smi_occurred = true; 3581 if (int32_occurred) return hint;
3582 tagged_smi_occurred = true;
3583 } else if (tagged_smi_occurred) {
3584 if (!hint.IsSmi()) return Representation::Tagged();
3585 } else {
3586 if (hint.IsDouble()) double_occurred = true;
3587 if (hint.IsInteger32()) int32_occurred = true;
3588 if (hint.IsSmi()) smi_occurred = true;
3589 }
3581 } 3590 }
3582 continue; 3591 continue;
3583 } 3592 }
3584 if (value->representation().IsDouble()) double_occurred = true; 3593 if (value->representation().IsDouble()) double_occurred = true;
3585 if (value->representation().IsInteger32()) int32_occurred = true; 3594 if (value->representation().IsInteger32()) int32_occurred = true;
3586 if (value->representation().IsSmi()) smi_occurred = true; 3595 if (value->representation().IsSmi()) smi_occurred = true;
3587 if (value->representation().IsTagged()) { 3596 if (value->representation().IsTagged()) {
3588 if (value->IsConstant()) { 3597 if (value->IsConstant()) {
3589 HConstant* constant = HConstant::cast(value); 3598 HConstant* constant = HConstant::cast(value);
3590 if (constant->IsConvertibleToInteger()) { 3599 if (constant->HasSmiValue()) {
3600 smi_occurred = true;
3601 } else if (constant->IsConvertibleToInteger()) {
3591 int32_occurred = true; 3602 int32_occurred = true;
3592 } else if (constant->HasNumberValue()) { 3603 } else if (constant->HasNumberValue()) {
3593 double_occurred = true; 3604 double_occurred = true;
3594 } else { 3605 } else {
3595 return Representation::Tagged(); 3606 return Representation::Tagged();
3596 } 3607 }
3597 } else { 3608 } else {
3598 if (value->IsPhi() && !IsConvertibleToInteger()) { 3609 if (value->IsPhi() && !IsConvertibleToInteger()) {
3599 return Representation::Tagged(); 3610 if (!value->type().IsSmi()) return Representation::Tagged();
3611 if (double_occurred) return Representation::Tagged();
3612 if (int32_occurred) return Representation::Tagged();
3613 tagged_smi_occurred = true;
3600 } 3614 }
3601 } 3615 }
3602 } 3616 }
3603 } 3617 }
3604 3618
3619 if (tagged_smi_occurred) return Representation::Smi();
3605 if (double_occurred) return Representation::Double(); 3620 if (double_occurred) return Representation::Double();
3606 if (int32_occurred) return Representation::Integer32(); 3621 if (int32_occurred) return Representation::Integer32();
3607 if (smi_occurred) return Representation::Smi(); 3622 if (smi_occurred) return Representation::Smi();
3608 3623
3609 return Representation::None(); 3624 return Representation::None();
3610 } 3625 }
3611 3626
3612 3627
3613 Representation HPhi::RepresentationFromUseRequirements() { 3628 Representation HPhi::RepresentationFromUseRequirements() {
3614 Representation all_uses_require = Representation::None(); 3629 Representation all_uses_require = Representation::None();
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
3805 case kBackingStore: 3820 case kBackingStore:
3806 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString()); 3821 if (!name_.is_null()) stream->Add(*String::cast(*name_)->ToCString());
3807 stream->Add("[backing-store]"); 3822 stream->Add("[backing-store]");
3808 break; 3823 break;
3809 } 3824 }
3810 3825
3811 stream->Add("@%d", offset()); 3826 stream->Add("@%d", offset());
3812 } 3827 }
3813 3828
3814 } } // namespace v8::internal 3829 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/hydrogen-instructions.h ('k') | src/lithium-allocator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698