src/Types.h
changeset 234 26e3035cdffc
parent 233 bbb498ccb4ac
child 235 43287eef2fff
     1.1 --- a/src/Types.h	Sat Dec 22 23:18:57 2012 -0800
     1.2 +++ b/src/Types.h	Mon Dec 24 02:49:20 2012 -0800
     1.3 @@ -57,6 +57,9 @@
     1.4      // on 64-bit systems), and does not exist in language semantics.
     1.5      PrimitiveType_Native,
     1.6  
     1.7 +    // Internal string object.
     1.8 +    PrimitiveType_String,
     1.9 +
    1.10      PrimitiveTypes_Total
    1.11  };
    1.12  
    1.13 @@ -144,7 +147,7 @@
    1.14          return primitive_;
    1.15      }
    1.16      bool isPod() {
    1.17 -        return isPrimitive() || isEnum() || isUnchecked();
    1.18 +        return (isPrimitive() && !isString()) || isEnum() || isUnchecked();
    1.19      }
    1.20      PrimitiveType pod() {
    1.21          assert(isPod());
    1.22 @@ -169,11 +172,18 @@
    1.23      bool isBool() {
    1.24          return isPrimitive() && primitive() == PrimitiveType_Bool;
    1.25      }
    1.26 +    bool isString() {
    1.27 +        return isPrimitive() && primitive() == PrimitiveType_String;
    1.28 +    }
    1.29      bool isExternalArray() {
    1.30          return kind() == EXTERNAL_ARRAY;
    1.31      }
    1.32      bool isTraceable() {
    1.33 -        return !isPrimitive();
    1.34 +        return (isPrimitive() && primitive() == PrimitiveType_String) ||
    1.35 +               isReference() ||
    1.36 +               isArray() ||
    1.37 +               isStruct() ||
    1.38 +               isFunction();
    1.39      }
    1.40      bool isConst() {
    1.41          assert(isPrimitive() ||
    1.42 @@ -250,7 +260,6 @@
    1.43      static ArrayType *NewExternal(Zone *zone, Handle<Type> contained);
    1.44  
    1.45      Type *innermost() {
    1.46 -        assert(isArray());
    1.47          Type *temp = contained();
    1.48          while (temp->isArray())
    1.49              temp = ArrayType::cast(temp)->contained();
    1.50 @@ -261,7 +270,6 @@
    1.51          return contained_;
    1.52      }
    1.53      bool isFixedLength() {
    1.54 -        assert(isArray());
    1.55          return elements_ > 0;
    1.56      }
    1.57      bool isCharArray() {
    1.58 @@ -273,12 +281,9 @@
    1.59          return elements_;
    1.60      }
    1.61      unsigned levels() {
    1.62 -        assert(isArray());
    1.63          return levels_;
    1.64      }
    1.65      bool hasInlineElements() {
    1.66 -        assert(isArray());
    1.67 -
    1.68          // We don't allocate traceable elements inline, since there's no
    1.69          // point to the optimization; we're going to be allocating lots of
    1.70          // objects anyway (in theory).