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

Unified Diff: src/hydrogen-instructions.cc

Issue 12321165: Fixed HCheckSmiOrInt <-> HBoundsCheck interaction wrt. representations (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/hydrogen-instructions.cc
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc
index aef227f60d0b98a67c59c980fcbfc9947550a598..38fca76dece4200d711b44fd433b01557e1be2e9 100644
--- a/src/hydrogen-instructions.cc
+++ b/src/hydrogen-instructions.cc
@@ -930,12 +930,14 @@ void HBoundsCheck::PrintDataTo(StringStream* stream) {
void HBoundsCheck::InferRepresentation(HInferRepresentation* h_infer) {
ASSERT(CheckFlag(kFlexibleRepresentation));
Representation r;
+ HValue* actual_length = length()->ActualValue();
+ HValue* actual_index = index()->ActualValue();
if (key_mode_ == DONT_ALLOW_SMI_KEY ||
- !length()->representation().IsTagged()) {
+ !actual_length->representation().IsTagged()) {
r = Representation::Integer32();
- } else if (index()->representation().IsTagged() ||
- (index()->ActualValue()->IsConstant() &&
- HConstant::cast(index()->ActualValue())->HasSmiValue())) {
+ } else if (actual_index->representation().IsTagged() ||
+ (actual_index->IsConstant() &&
+ HConstant::cast(actual_index)->HasSmiValue())) {
// If the index is tagged, or a constant that holds a Smi, allow the length
// to be tagged, since it is usually already tagged from loading it out of
// the length field of a JSArray. This allows for direct comparison without
@@ -2565,8 +2567,9 @@ HType HCheckSmi::CalculateInferredType() {
void HCheckSmiOrInt32::InferRepresentation(HInferRepresentation* h_infer) {
ASSERT(CheckFlag(kFlexibleRepresentation));
- Representation r = value()->representation().IsTagged()
- ? Representation::Tagged() : Representation::Integer32();
+ ASSERT(UseCount() == 1);
+ HUseIterator use = uses();
+ Representation r = use.value()->RequiredInputRepresentation(use.index());
UpdateRepresentation(r, h_infer, "checksmiorint32");
}
« no previous file with comments | « src/hydrogen-instructions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698