Don't force representations in the loop builder.
authorverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 5 Jun 2013 17:24:14 +0000 (17:24 +0000)
committerverwaest@chromium.org <verwaest@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Wed, 5 Jun 2013 17:24:14 +0000 (17:24 +0000)
Additionally, infer None-typed CompareIDAndBranch to Smi+actual input.

R=jkummerow@chromium.org

Review URL: https://chromiumcodereview.appspot.com/16365004

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14960 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

src/hydrogen-instructions.cc
src/hydrogen.cc
src/hydrogen.h

index 5fae5f7..d3f1a9e 100644 (file)
@@ -2498,8 +2498,10 @@ void HCompareIDAndBranch::InferRepresentation(HInferRepresentation* h_infer) {
   Representation observed_left = observed_input_representation(0);
   Representation observed_right = observed_input_representation(1);
 
-  Representation rep = Representation::Smi();
-  if (observed_left.IsInteger32() && observed_right.IsInteger32()) {
+  Representation rep = Representation::None();
+  rep = rep.generalize(observed_left);
+  rep = rep.generalize(observed_right);
+  if (rep.IsNone() || rep.IsSmiOrInteger32()) {
     if (!left_rep.IsTagged()) rep = rep.generalize(left_rep);
     if (!right_rep.IsTagged()) rep = rep.generalize(right_rep);
   } else {
index 5da6d52..d1cfb8e 100644 (file)
@@ -898,13 +898,11 @@ HGraphBuilder::LoopBuilder::LoopBuilder(HGraphBuilder* builder,
 HValue* HGraphBuilder::LoopBuilder::BeginBody(
     HValue* initial,
     HValue* terminating,
-    Token::Value token,
-    Representation input_representation) {
+    Token::Value token) {
   HEnvironment* env = builder_->environment();
   phi_ = new(zone()) HPhi(env->values()->length(), zone());
   header_block_->AddPhi(phi_);
   phi_->AddInput(initial);
-  phi_->AssumeRepresentation(Representation::Integer32());
   env->Push(initial);
   builder_->current_block()->GotoNoSimulate(header_block_);
 
@@ -918,9 +916,6 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
   builder_->set_current_block(header_block_);
   HCompareIDAndBranch* compare =
       new(zone()) HCompareIDAndBranch(phi_, terminating, token);
-  compare->set_observed_input_representation(input_representation,
-                                             input_representation);
-  compare->AssumeRepresentation(input_representation);
   compare->SetSuccessorAt(0, body_block_);
   compare->SetSuccessorAt(1, exit_block_);
   builder_->current_block()->Finish(compare);
@@ -934,7 +929,6 @@ HValue* HGraphBuilder::LoopBuilder::BeginBody(
       increment_ = HSub::New(zone(), context_, phi_, one);
     }
     increment_->ClearFlag(HValue::kCanOverflow);
-    increment_->AssumeRepresentation(Representation::Integer32());
     builder_->AddInstruction(increment_);
     return increment_;
   } else {
@@ -954,7 +948,6 @@ void HGraphBuilder::LoopBuilder::EndBody() {
       increment_ = HSub::New(zone(), context_, phi_, one);
     }
     increment_->ClearFlag(HValue::kCanOverflow);
-    increment_->AssumeRepresentation(Representation::Integer32());
     builder_->AddInstruction(increment_);
   }
 
index db607d5..5cb99a1 100644 (file)
@@ -1217,8 +1217,7 @@ class HGraphBuilder {
     HValue* BeginBody(
         HValue* initial,
         HValue* terminating,
-        Token::Value token,
-        Representation input_representation = Representation::Integer32());
+        Token::Value token);
     void EndBody();
 
    private: