Revision: 15540
Author:   [email protected]
Date:     Mon Jul  8 02:00:59 2013
Log: Calls to HCheckFunction can be eliminated if the value is an HConstant
function, and that function handle matches the target handle.

BUG=
[email protected], [email protected]

Review URL: https://codereview.chromium.org/18751003
http://code.google.com/p/v8/source/detail?r=15540

Modified:
 /branches/bleeding_edge/src/hydrogen-instructions.cc
 /branches/bleeding_edge/src/hydrogen-instructions.h
 /branches/bleeding_edge/src/objects.cc

=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.cc Fri Jul 5 03:40:14 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.cc Mon Jul 8 02:00:59 2013
@@ -1688,6 +1688,14 @@
   value()->PrintNameTo(stream);
   stream->Add(" %p", *target());
 }
+
+
+HValue* HCheckFunction::Canonicalize() {
+  return (value()->IsConstant() &&
+          HConstant::cast(value())->UniqueValueIdsMatch(target_unique_id_))
+      ? NULL
+      : this;
+}


 const char* HCheckInstanceType::GetCheckName() {
=======================================
--- /branches/bleeding_edge/src/hydrogen-instructions.h Fri Jul 5 03:40:14 2013 +++ /branches/bleeding_edge/src/hydrogen-instructions.h Mon Jul 8 02:00:59 2013
@@ -2838,6 +2838,8 @@
   virtual void PrintDataTo(StringStream* stream);
   virtual HType CalculateInferredType();

+  virtual HValue* Canonicalize();
+
 #ifdef DEBUG
   virtual void Verify();
 #endif
@@ -3410,6 +3412,11 @@
       unique_id_ = UniqueValueId(handle_);
     }
   }
+
+  bool UniqueValueIdsMatch(UniqueValueId other) {
+    if (!has_double_value_) return unique_id_ == other;
+    return false;
+  }

 #ifdef DEBUG
   virtual void Verify() { }
=======================================
--- /branches/bleeding_edge/src/objects.cc      Fri Jul  5 03:40:14 2013
+++ /branches/bleeding_edge/src/objects.cc      Mon Jul  8 02:00:59 2013
@@ -15836,7 +15836,8 @@
                                Handle<Object> value) {
   Isolate* isolate = cell->GetIsolate();
   Handle<Type> old_type(cell->type(), isolate);
-  Handle<Type> new_type((value->IsSmi() || value->IsUndefined())
+  Handle<Type> new_type((value->IsSmi() || value->IsJSFunction() ||
+                         value->IsUndefined())
                         ? Type::Constant(value, isolate)
                         : Type::Any(), isolate);

--
--
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