示例#1
0
bool AliasClass::operator<=(AliasClass o) const {
  if (m_bits == BEmpty) return true;

  auto const isect = static_cast<rep>(m_bits & o.m_bits);
  if (isect != m_bits) return false;

  // If they have the same specialized tag, then since isect is equal to
  // m_bits, the stagBit must be part of the intersection or be BEmpty.  This
  // means they can only be in a subclass relationship if that specialized data
  // is.
  if (m_stag == o.m_stag) return subclassData(o);

  /*
   * Disjoint stags.  The stagBit for m_stag must be part of the intersection
   * (or be BEmpty), since isect == m_bits above.  This breaks down into the
   * following cases:
   *
   * If the osbit is part of the intersection, then this can't be a subclass of
   * `o', because this has only generic information for that bit but it is set
   * in isect.  If the osbit is BEmpty, osbit & isect is zero, which avoids
   * this case.
   *
   * The remaining situations are that m_stag is STag::None, in which case it
   * is a subclass since osbit wasn't in the intersection.  Or that m_stag has
   * a bit that is in the isect (since m_bits == isect), and that bit is set in
   * o.m_bits.  In either case this is a subclass, so we can just return true.
   */
  auto const osbit = stagBit(o.m_stag);
  if (osbit & isect) return false;
  return true;
}
示例#2
0
void RegExpMatchesArray::fillArrayInstance(ExecState* exec)
{
    RegExpConstructorPrivate* d = static_cast<RegExpConstructorPrivate*>(subclassData());
    ASSERT(d);

    unsigned lastNumSubpatterns = d->lastNumSubPatterns;

    for (unsigned i = 0; i <= lastNumSubpatterns; ++i) {
        int start = d->lastOvector()[2 * i];
        if (start >= 0)
            JSArray::put(exec, i, jsSubstring(exec, d->lastInput, start, d->lastOvector()[2 * i + 1] - start));
        else
            JSArray::put(exec, i, jsUndefined());
    }

    PutPropertySlot slot;
    JSArray::put(exec, exec->propertyNames().index, jsNumber(d->lastOvector()[0]), slot);
    JSArray::put(exec, exec->propertyNames().input, jsString(exec, d->input), slot);

    delete d;
    setSubclassData(0);
}
示例#3
0
RegExpMatchesArray::~RegExpMatchesArray()
{
    delete static_cast<RegExpConstructorPrivate*>(subclassData());
}