Reland "Calls to HCheckFunction can be eliminated if the value is an HConstant"
(https://codereview.chromium.org/
18751003/).
The CL failed because of heap snapshot issues. alph@chromium.org just checked in
a fix for that (https://code.google.com/p/v8/source/detail?r=15694).
BUG=
R=danno@chromium.org
Review URL: https://codereview.chromium.org/
19504007
git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15704
ce2b1a6d-e550-0410-aec6-
3dcde31c8c00
}
+HValue* HCheckFunction::Canonicalize() {
+ return (value()->IsConstant() &&
+ HConstant::cast(value())->UniqueValueIdsMatch(target_unique_id_))
+ ? NULL
+ : this;
+}
+
+
const char* HCheckInstanceType::GetCheckName() {
switch (check_) {
case IS_SPEC_OBJECT: return "object";
virtual void PrintDataTo(StringStream* stream);
virtual HType CalculateInferredType();
+ virtual HValue* Canonicalize();
+
#ifdef DEBUG
virtual void Verify();
#endif
}
}
+ bool UniqueValueIdsMatch(UniqueValueId other) {
+ return !has_double_value_ && unique_id_ == other;
+ }
+
#ifdef DEBUG
virtual void Verify() { }
#endif
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);