Reviewers: Toon Verwaest,

Message:
PTAL.

Description:
H-BuildIncrement should make use of available type feedback

Please review this at https://codereview.chromium.org/22611009/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/ast.h
  M src/hydrogen.cc
  A + test/mjsunit/compiler/increment-typefeedback.js


Index: src/ast.h
diff --git a/src/ast.h b/src/ast.h
index a8b74213adb663dce6c0fb3bad9ae8c45ea8a648..4dfef00062c09509ef3dfb50b1f11e0859dceef8 100644
--- a/src/ast.h
+++ b/src/ast.h
@@ -1949,7 +1949,7 @@ class CountOperation: public Expression {

   virtual void MarkAsStatement() { is_prefix_ = true; }

-  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* znoe);
+  void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
   virtual bool IsMonomorphic() { return is_monomorphic_; }
   virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
   virtual KeyedAccessStoreMode GetStoreMode() {
Index: src/hydrogen.cc
diff --git a/src/hydrogen.cc b/src/hydrogen.cc
index 4cd0ff0f08658ad651ac99c4552b9d1100a380a3..c5a77223726cfa03f84bf9a0d8804352fc35ca9d 100644
--- a/src/hydrogen.cc
+++ b/src/hydrogen.cc
@@ -7476,7 +7476,9 @@ HInstruction* HOptimizedGraphBuilder::BuildIncrement(
   HConstant* delta = (expr->op() == Token::INC)
       ? graph()->GetConstant1()
       : graph()->GetConstantMinus1();
-  HInstruction* instr = Add<HAdd>(Top(), delta);
+  HAdd* instr = Add<HAdd>(Top(), delta);
+  instr->set_observed_input_representation(1, rep);
+  instr->set_observed_input_representation(2, Representation::Smi());
   instr->SetFlag(HInstruction::kCannotBeTagged);
   instr->ClearAllSideEffects();
   return instr;
Index: test/mjsunit/compiler/increment-typefeedback.js
diff --git a/test/mjsunit/regress/regress-crbug-173974.js b/test/mjsunit/compiler/increment-typefeedback.js
similarity index 95%
copy from test/mjsunit/regress/regress-crbug-173974.js
copy to test/mjsunit/compiler/increment-typefeedback.js
index 905bd6058a0ad0fe2ebe10e4c7dafbe9945cbe3b..798959296c43014f252d65ae5dd11e00563bfd04 100644
--- a/test/mjsunit/regress/regress-crbug-173974.js
+++ b/test/mjsunit/compiler/increment-typefeedback.js
@@ -27,10 +27,13 @@

 // Flags: --allow-natives-syntax

-function f() {
-  var count = "";
-  count[0] --;
+function f(x) {
+  x++;
+  return x;
 }
-f();
+
+f(0.5);
+f(0.5);
 %OptimizeFunctionOnNextCall(f);
-f();
+f(0.5);
+assertOptimized(f);


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to