From: mvstanton@chromium.org Date: Wed, 17 Jul 2013 08:46:01 +0000 (+0000) Subject: Calls to HCheckFunction can be eliminated if the value is an HConstant. X-Git-Tag: upstream/4.7.83~13347 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4465c83104917a4c896a960e779c96e434a0345b;p=platform%2Fupstream%2Fv8.git Calls to HCheckFunction can be eliminated if the value is an HConstant. 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 --- diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc index 5a9510f..e99f909 100644 --- a/src/hydrogen-instructions.cc +++ b/src/hydrogen-instructions.cc @@ -1690,6 +1690,14 @@ void HCheckFunction::PrintDataTo(StringStream* stream) { } +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"; diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h index 27c517a..2fb18fd 100644 --- a/src/hydrogen-instructions.h +++ b/src/hydrogen-instructions.h @@ -2837,6 +2837,8 @@ class HCheckFunction: public HUnaryOperation { virtual void PrintDataTo(StringStream* stream); virtual HType CalculateInferredType(); + virtual HValue* Canonicalize(); + #ifdef DEBUG virtual void Verify(); #endif @@ -3410,6 +3412,10 @@ class HConstant: public HTemplateInstruction<0> { } } + bool UniqueValueIdsMatch(UniqueValueId other) { + return !has_double_value_ && unique_id_ == other; + } + #ifdef DEBUG virtual void Verify() { } #endif diff --git a/src/objects.cc b/src/objects.cc index 7b06b87..0c31df3 100644 --- a/src/objects.cc +++ b/src/objects.cc @@ -15899,7 +15899,8 @@ Type* PropertyCell::UpdateType(Handle cell, Handle value) { Isolate* isolate = cell->GetIsolate(); Handle old_type(cell->type(), isolate); - Handle new_type((value->IsSmi() || value->IsUndefined()) + Handle new_type((value->IsSmi() || value->IsJSFunction() || + value->IsUndefined()) ? Type::Constant(value, isolate) : Type::Any(), isolate);