Calls to HCheckFunction can be eliminated if the value is an HConstant

function, and that function handle matches the target handle.

BUG=
R=danno@chromium.org, mstarzinger@chromium.org

Review URL: https://codereview.chromium.org/18751003

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15540 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
mvstanton@chromium.org 2013-07-08 09:00:59 +00:00
parent 99f171a128
commit eea586f2a1
3 changed files with 17 additions and 1 deletions

View File

@ -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";

View File

@ -2838,6 +2838,8 @@ class HCheckFunction: public HUnaryOperation {
virtual void PrintDataTo(StringStream* stream);
virtual HType CalculateInferredType();
virtual HValue* Canonicalize();
#ifdef DEBUG
virtual void Verify();
#endif
@ -3411,6 +3413,11 @@ class HConstant: public HTemplateInstruction<0> {
}
}
bool UniqueValueIdsMatch(UniqueValueId other) {
if (!has_double_value_) return unique_id_ == other;
return false;
}
#ifdef DEBUG
virtual void Verify() { }
#endif

View File

@ -15836,7 +15836,8 @@ Type* PropertyCell::UpdateType(Handle<PropertyCell> cell,
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);