search for: isoftype

Displaying 2 results from an estimated 2 matches for "isoftype".

2016 Jan 28
8
Proposal: virtual constant propagation
...erhead of a control flow integrity check. We took a closer look at the hottest virtual call sites, and found that they were mostly type checking functions of the following form: struct Base { enum Type { kBase, kDerived }; virtual bool isDerived() const { return false; } // or: virtual bool isOfType(Type t) const { return t == kBase; } }; struct Derived : Base { virtual bool isDerived() const { return true; } virtual bool isOfType(Type t) const { return t == kDerived; } }; bool f(Base *b) { return b->isDerived(); } bool g(Base *b) { return b->isOfType(Base::kDerived); } We can...
2016 Jan 28
2
Proposal: virtual constant propagation
...ok a closer look at the hottest virtual call sites, and found that they >> were mostly type checking functions of the following form: >> >> struct Base { >> enum Type { kBase, kDerived }; >> virtual bool isDerived() const { return false; } // or: >> virtual bool isOfType(Type t) const { return t == kBase; } >> }; >> struct Derived : Base { >> virtual bool isDerived() const { return true; } >> virtual bool isOfType(Type t) const { return t == kDerived; } >> }; >> >> bool f(Base *b) { >> return b->isDerived(); >&...