From: danno@chromium.org Date: Thu, 27 Jun 2013 15:31:49 +0000 (+0000) Subject: Type handling for special cases and optimization X-Git-Tag: upstream/4.7.83~13644 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5b1ccfb95224654005cfd0b0f65ee10567cb4a23;p=platform%2Fupstream%2Fv8.git Type handling for special cases and optimization R=rossberg@chromium.org Review URL: https://codereview.chromium.org/18078002 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15366 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- diff --git a/src/types.cc b/src/types.cc index b8febc2..1275dea 100644 --- a/src/types.cc +++ b/src/types.cc @@ -131,6 +131,7 @@ int Type::LubBitset() { if (value->IsUndefined()) return kUndefined; if (value->IsNull()) return kNull; if (value->IsTrue() || value->IsFalse()) return kBoolean; + if (value->IsTheHole()) return kAny; } } switch (map->instance_type()) { @@ -200,6 +201,10 @@ int Type::LubBitset() { // We ought to find a cleaner solution for compiling stubs parameterised // over type or class variables, esp ones with bounds... return kDetectable; + case DECLARED_ACCESSOR_INFO_TYPE: + case EXECUTABLE_ACCESSOR_INFO_TYPE: + case ACCESSOR_PAIR_TYPE: + return kInternal; default: UNREACHABLE(); return kNone; @@ -222,7 +227,7 @@ int Type::GlbBitset() { // Check this <= that. -bool Type::Is(Type* that) { +bool Type::IsSlowCase(Type* that) { // Fast path for bitsets. if (that->is_bitset()) { return (this->LubBitset() | that->as_bitset()) == that->as_bitset(); diff --git a/src/types.h b/src/types.h index 25ed6e8..a2bcda6 100644 --- a/src/types.h +++ b/src/types.h @@ -126,6 +126,7 @@ class Type : public Object { static Type* Function() { return from_bitset(kFunction); } static Type* RegExp() { return from_bitset(kRegExp); } static Type* Proxy() { return from_bitset(kProxy); } + static Type* Internal() { return from_bitset(kInternal); } static Type* Class(Handle map) { return from_handle(map); } static Type* Constant(Handle value) { @@ -139,7 +140,7 @@ class Type : public Object { static Type* Intersect(Handle type1, Handle type2); static Type* Optional(Handle type); // type \/ Undefined - bool Is(Type* that); + bool Is(Type* that) { return (this == that) ? true : IsSlowCase(that); } bool Is(Handle that) { return this->Is(*that); } bool Maybe(Type* that); bool Maybe(Handle that) { return this->Maybe(*that); } @@ -207,6 +208,7 @@ class Type : public Object { kRegExp = 1 << 13, kOtherObject = 1 << 14, kProxy = 1 << 15, + kInternal = 1 << 16, kOddball = kBoolean | kNull | kUndefined, kSigned32 = kSmi | kOtherSigned32, @@ -218,7 +220,7 @@ class Type : public Object { kObject = kUndetectable | kArray | kFunction | kRegExp | kOtherObject, kReceiver = kObject | kProxy, kAllocated = kDouble | kName | kReceiver, - kAny = kOddball | kNumber | kAllocated, + kAny = kOddball | kNumber | kAllocated | kInternal, kDetectable = kAllocated - kUndetectable, kNone = 0 }; @@ -228,6 +230,8 @@ class Type : public Object { bool is_constant() { return this->IsBox(); } bool is_union() { return this->IsFixedArray(); } + bool IsSlowCase(Type* that); + int as_bitset() { return Smi::cast(this)->value(); } Handle as_class() { return Handle::cast(handle()); } Handle as_constant() {