Revision: 15366
Author:   [email protected]
Date:     Thu Jun 27 08:31:49 2013
Log:      Type handling for special cases and optimization

[email protected]

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

Modified:
 /branches/bleeding_edge/src/types.cc
 /branches/bleeding_edge/src/types.h

=======================================
--- /branches/bleeding_edge/src/types.cc        Wed Jun 26 02:51:57 2013
+++ /branches/bleeding_edge/src/types.cc        Thu Jun 27 08:31:49 2013
@@ -131,6 +131,7 @@
         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 @@
// 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 @@


 // 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();
=======================================
--- /branches/bleeding_edge/src/types.h Wed Jun 26 02:51:57 2013
+++ /branches/bleeding_edge/src/types.h Thu Jun 27 08:31:49 2013
@@ -126,6 +126,7 @@
   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> map) { return from_handle(map); }
   static Type* Constant(Handle<HeapObject> value) {
@@ -139,7 +140,7 @@
   static Type* Intersect(Handle<Type> type1, Handle<Type> type2);
   static Type* Optional(Handle<Type> type);  // type \/ Undefined

-  bool Is(Type* that);
+  bool Is(Type* that) { return (this == that) ? true : IsSlowCase(that); }
   bool Is(Handle<Type> that) { return this->Is(*that); }
   bool Maybe(Type* that);
   bool Maybe(Handle<Type> that) { return this->Maybe(*that); }
@@ -207,6 +208,7 @@
     kRegExp = 1 << 13,
     kOtherObject = 1 << 14,
     kProxy = 1 << 15,
+    kInternal = 1 << 16,

     kOddball = kBoolean | kNull | kUndefined,
     kSigned32 = kSmi | kOtherSigned32,
@@ -218,7 +220,7 @@
     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
   };
@@ -227,6 +229,8 @@
   bool is_class() { return this->IsMap(); }
   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<Map> as_class() { return Handle<Map>::cast(handle()); }

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