| Absolute File Name: | /home/opencoverage/opencoverage/guest-scripts/qtdeclarative/src/qtdeclarative/src/qml/jsruntime/qv4context_p.h | 
| Switch to Source code | Preprocessed file | 
| Line | Source | Count | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||
| 2 | - | |||||||||||||
| 3 | namespace QV4 { | - | ||||||||||||
| 4 | - | |||||||||||||
| 5 | - | |||||||||||||
| 6 | namespace Heap { | - | ||||||||||||
| 7 | - | |||||||||||||
| 8 | - | |||||||||||||
| 9 | - | |||||||||||||
| 10 | - | |||||||||||||
| 11 | - | |||||||||||||
| 12 | struct ExecutionContextOffsetStruct { Pointer<ExecutionContext *, 0> outer; Pointer<Object *, 0> activation; }; struct ExecutionContextSizeStruct : Base, ExecutionContextOffsetStruct {}; struct ExecutionContextData { typedef Base SuperClass; static constexpr size_t baseOffset = sizeof(ExecutionContextSizeStruct) - sizeof(ExecutionContextOffsetStruct); Pointer<ExecutionContext *, | - | ||||||||||||
| 13 | __builtin_offsetof ( | - | ||||||||||||
| 14 | ExecutionContextOffsetStruct | - | ||||||||||||
| 15 | , | - | ||||||||||||
| 16 | outer | - | ||||||||||||
| 17 | ) | - | ||||||||||||
| 18 | + baseOffset> outer; Pointer<Object *, | - | ||||||||||||
| 19 | __builtin_offsetof ( | - | ||||||||||||
| 20 | ExecutionContextOffsetStruct | - | ||||||||||||
| 21 | , | - | ||||||||||||
| 22 | activation | - | ||||||||||||
| 23 | ) | - | ||||||||||||
| 24 | + baseOffset> activation; }; static_assert(bool(sizeof(ExecutionContextSizeStruct) == sizeof(ExecutionContextData) + ExecutionContextData::baseOffset), "sizeof(ExecutionContextSizeStruct) == sizeof(ExecutionContextData) + ExecutionContextData::baseOffset"); struct ExecutionContext : Base, ExecutionContextData { | - | ||||||||||||
| 25 |     static void markObjects(Heap::Base *b, MarkStack *stack) { ExecutionContext *o = static_cast<ExecutionContext *>(b); ExecutionContextData::SuperClass::markObjects(o, stack); if (o->outer
 executed 81038 times by 22 tests:   if (o->activationo->outer.heapObject()->mark(stack);Executed by: 
 
 executed 89874 times by 27 tests:   }o->activation.heapObject()->mark(stack);Executed by: 
 executed 89894 times by 27 tests:  ;end of blockExecuted by: 
  | 20-89894 | ||||||||||||
| 26 | - | |||||||||||||
| 27 | enum ContextType { | - | ||||||||||||
| 28 | Type_GlobalContext = 0x1, | - | ||||||||||||
| 29 | Type_WithContext = 0x2, | - | ||||||||||||
| 30 | Type_QmlContext = 0x3, | - | ||||||||||||
| 31 | Type_BlockContext = 0x4, | - | ||||||||||||
| 32 | Type_CallContext = 0x5 | - | ||||||||||||
| 33 | }; | - | ||||||||||||
| 34 | - | |||||||||||||
| 35 | void init(ContextType t) | - | ||||||||||||
| 36 | { | - | ||||||||||||
| 37 | Base::init(); | - | ||||||||||||
| 38 | - | |||||||||||||
| 39 | type = t; | - | ||||||||||||
| 40 |     } executed 6062128 times by 154 tests:  end of blockExecuted by: 
  | 6062128 | ||||||||||||
| 41 | - | |||||||||||||
| 42 | const VTable *vtable() const { | - | ||||||||||||
| 43 |         return executed 1559567 times by 130 tests:   internalClass->vtable;return internalClass->vtable;Executed by: 
 executed 1559567 times by 130 tests:  return internalClass->vtable;Executed by: 
  | 1559567 | ||||||||||||
| 44 | } | - | ||||||||||||
| 45 | - | |||||||||||||
| 46 | quint32 type : 8; | - | ||||||||||||
| 47 | quint32 nArgs : 24; | - | ||||||||||||
| 48 | - | |||||||||||||
| 49 | quint8 padding_[4]; | - | ||||||||||||
| 50 | - | |||||||||||||
| 51 | }; | - | ||||||||||||
| 52 | static_assert(bool(std::is_trivial< ExecutionContext >::value), "std::is_trivial< ExecutionContext >::value"); | - | ||||||||||||
| 53 | static_assert(bool(sizeof(ExecutionContext) == sizeof(Base) + sizeof(ExecutionContextData) + 8), "sizeof(ExecutionContext) == sizeof(Base) + sizeof(ExecutionContextData) + QT_POINTER_SIZE"); | - | ||||||||||||
| 54 | - | |||||||||||||
| 55 | static_assert(bool(std::is_standard_layout<ExecutionContextData>::value), "std::is_standard_layout<ExecutionContextData>::value"); | - | ||||||||||||
| 56 | static_assert(bool( | - | ||||||||||||
| 57 | __builtin_offsetof ( | - | ||||||||||||
| 58 | ExecutionContextData | - | ||||||||||||
| 59 | , | - | ||||||||||||
| 60 | outer | - | ||||||||||||
| 61 | ) | - | ||||||||||||
| 62 | == 0), "offsetof(ExecutionContextData, outer) == 0"); | - | ||||||||||||
| 63 | static_assert(bool( | - | ||||||||||||
| 64 | __builtin_offsetof ( | - | ||||||||||||
| 65 | ExecutionContextData | - | ||||||||||||
| 66 | , | - | ||||||||||||
| 67 | activation | - | ||||||||||||
| 68 | ) | - | ||||||||||||
| 69 | == | - | ||||||||||||
| 70 | __builtin_offsetof ( | - | ||||||||||||
| 71 | ExecutionContextData | - | ||||||||||||
| 72 | , | - | ||||||||||||
| 73 | outer | - | ||||||||||||
| 74 | ) | - | ||||||||||||
| 75 | + 8), "offsetof(ExecutionContextData, activation) == offsetof(ExecutionContextData, outer) + QT_POINTER_SIZE"); | - | ||||||||||||
| 76 | - | |||||||||||||
| 77 | - | |||||||||||||
| 78 | - | |||||||||||||
| 79 | - | |||||||||||||
| 80 | - | |||||||||||||
| 81 | struct CallContextOffsetStruct { Pointer<FunctionObject *, 0> function; ValueArray<0> locals; }; struct CallContextSizeStruct : ExecutionContext, CallContextOffsetStruct {}; struct CallContextData { typedef ExecutionContext SuperClass; static constexpr size_t baseOffset = sizeof(CallContextSizeStruct) - sizeof(CallContextOffsetStruct); Pointer<FunctionObject *, | - | ||||||||||||
| 82 | __builtin_offsetof ( | - | ||||||||||||
| 83 | CallContextOffsetStruct | - | ||||||||||||
| 84 | , | - | ||||||||||||
| 85 | function | - | ||||||||||||
| 86 | ) | - | ||||||||||||
| 87 | + baseOffset> function; ValueArray< | - | ||||||||||||
| 88 | __builtin_offsetof ( | - | ||||||||||||
| 89 | CallContextOffsetStruct | - | ||||||||||||
| 90 | , | - | ||||||||||||
| 91 | locals | - | ||||||||||||
| 92 | ) | - | ||||||||||||
| 93 | + baseOffset> locals; }; static_assert(bool(sizeof(CallContextSizeStruct) == sizeof(CallContextData) + CallContextData::baseOffset), "sizeof(CallContextSizeStruct) == sizeof(CallContextData) + CallContextData::baseOffset"); struct CallContext : ExecutionContext, CallContextData { | - | ||||||||||||
| 94 |     static void markObjects(Heap::Base *b, MarkStack *stack) { CallContext *o = static_cast<CallContext *>(b); CallContextData::SuperClass::markObjects(o, stack); if (o->function
 executed 4 times by 1 test:   o->locals.mark(stack); }o->function.heapObject()->mark(stack);Executed by: 
 executed 20 times by 2 tests:  ;end of blockExecuted by: 
  | 4-20 | ||||||||||||
| 95 | - | |||||||||||||
| 96 | void init() | - | ||||||||||||
| 97 | { | - | ||||||||||||
| 98 | ExecutionContext::init(Type_CallContext); | - | ||||||||||||
| 99 |     } executed 4410185 times by 29 tests:  end of blockExecuted by: 
  | 4410185 | ||||||||||||
| 100 | - | |||||||||||||
| 101 | int argc() const { | - | ||||||||||||
| 102 |         return executed 6590 times by 11 tests:   static_cast<int>(nArgs);return static_cast<int>(nArgs);Executed by: 
 executed 6590 times by 11 tests:  return static_cast<int>(nArgs);Executed by: 
  | 6590 | ||||||||||||
| 103 | } | - | ||||||||||||
| 104 | const Value *args() const { | - | ||||||||||||
| 105 |         return executed 1963 times by 4 tests:   locals.data() + locals.size;return locals.data() + locals.size;Executed by: 
 executed 1963 times by 4 tests:  return locals.data() + locals.size;Executed by: 
  | 1963 | ||||||||||||
| 106 | } | - | ||||||||||||
| 107 | void setArg(uint index, Value v); | - | ||||||||||||
| 108 | }; | - | ||||||||||||
| 109 | static_assert(bool(std::is_trivial< CallContext >::value), "std::is_trivial< CallContext >::value"); | - | ||||||||||||
| 110 | static_assert(bool(std::is_standard_layout<CallContextData>::value), "std::is_standard_layout<CallContextData>::value"); | - | ||||||||||||
| 111 | static_assert(bool( | - | ||||||||||||
| 112 | __builtin_offsetof ( | - | ||||||||||||
| 113 | CallContextData | - | ||||||||||||
| 114 | , | - | ||||||||||||
| 115 | function | - | ||||||||||||
| 116 | ) | - | ||||||||||||
| 117 | == 0), "offsetof(CallContextData, function) == 0"); | - | ||||||||||||
| 118 | } | - | ||||||||||||
| 119 | - | |||||||||||||
| 120 | struct __attribute__((visibility("default"))) ExecutionContext : public Managed | - | ||||||||||||
| 121 | { | - | ||||||||||||
| 122 | enum { | - | ||||||||||||
| 123 | IsExecutionContext = true | - | ||||||||||||
| 124 | }; | - | ||||||||||||
| 125 | - | |||||||||||||
| 126 |     private: ExecutionContext() = delete; ExecutionContext(const ExecutionContext &) = delete; ExecutionContext &operator=(const ExecutionContext &) = delete; public: template <typename Type> inline void qt_check_for_QMANAGED_macro(const Type *_q_argument) const { int i = qYouForgotTheQ_MANAGED_Macro(this, _q_argument); i = i + 1; } never executed:   typedef QV4::Heap::ExecutionContext Data; typedef Managed SuperClass; static const QV4::VTable static_vtbl; static inline const QV4::VTable *staticVTable() { returnend of blockexecuted 198971 times by 154 tests:   &static_vtbl;return &static_vtbl;Executed by: 
 executed 198971 times by 154 tests:   } void __dataTest() { static_assert (sizeof(*this) == sizeof(Managed), "Classes derived from Managed can't have own data members."); }return &static_vtbl;Executed by: 
 never executed:   QV4::Heap::ExecutionContext *d_unchecked() const { returnend of blockexecuted 146347902 times by 154 tests:   static_cast<QV4::Heap::ExecutionContext *>(m());return static_cast<QV4::Heap::ExecutionContext *>(m());Executed by: 
 executed 146347902 times by 154 tests:   } QV4::Heap::ExecutionContext *d() const { QV4::Heap::ExecutionContext *dptr = d_unchecked(); dptr->_checkIsInitialized(); returnreturn static_cast<QV4::Heap::ExecutionContext *>(m());Executed by: 
 executed 146379841 times by 154 tests:   dptr;return dptr;Executed by: 
 executed 146379841 times by 154 tests:   } static_assert(bool(std::is_trivial< QV4::Heap::ExecutionContext >::value), "std::is_trivial< QV4::Heap::ExecutionContext >::value");return dptr;Executed by: 
  | 0-146379841 | ||||||||||||
| 127 | public: enum { MyType = Type_ExecutionContext }; | - | ||||||||||||
| 128 |     static Heap::InternalClass *defaultInternalClass(QV4::EngineBase *e) { return executed 99511 times by 154 tests:   e->internalClasses(QV4::EngineBase::Class_ExecutionContext);return e->internalClasses(QV4::EngineBase::Class_ExecutionContext);Executed by: 
 executed 99511 times by 154 tests:   }return e->internalClasses(QV4::EngineBase::Class_ExecutionContext);Executed by: 
  | 99511 | ||||||||||||
| 129 | - | |||||||||||||
| 130 | static Heap::CallContext *newBlockContext(QV4::CppStackFrame *frame, int blockIndex); | - | ||||||||||||
| 131 | static Heap::CallContext *cloneBlockContext(Heap::CallContext *context); | - | ||||||||||||
| 132 | static Heap::CallContext *newCallContext(QV4::CppStackFrame *frame); | - | ||||||||||||
| 133 | Heap::ExecutionContext *newWithContext(Heap::Object *with); | - | ||||||||||||
| 134 | static Heap::ExecutionContext *newCatchContext(CppStackFrame *frame, int blockIndex, Heap::String *exceptionVarName); | - | ||||||||||||
| 135 | - | |||||||||||||
| 136 | void createMutableBinding(String *name, bool deletable); | - | ||||||||||||
| 137 | - | |||||||||||||
| 138 | enum Error { | - | ||||||||||||
| 139 | NoError, | - | ||||||||||||
| 140 | TypeError, | - | ||||||||||||
| 141 | RangeError | - | ||||||||||||
| 142 | }; | - | ||||||||||||
| 143 | - | |||||||||||||
| 144 | Error setProperty(String *name, const Value &value); | - | ||||||||||||
| 145 | - | |||||||||||||
| 146 | ReturnedValue getProperty(String *name); | - | ||||||||||||
| 147 | ReturnedValue getPropertyAndBase(String *name, Value *base); | - | ||||||||||||
| 148 | bool deleteProperty(String *name); | - | ||||||||||||
| 149 | - | |||||||||||||
| 150 | inline CallContext *asCallContext(); | - | ||||||||||||
| 151 | inline const CallContext *asCallContext() const; | - | ||||||||||||
| 152 | - | |||||||||||||
| 153 | protected: | - | ||||||||||||
| 154 | - | |||||||||||||
| 155 | static bool virtualDeleteProperty(Managed *, PropertyKey) { | - | ||||||||||||
| 156 | do { ((false) ? static_cast<void>(0) : qt_assert_x("Q_UNREACHABLE()", "Q_UNREACHABLE was reached", __FILE__, 172)); __builtin_unreachable(); } while (false); | - | ||||||||||||
| 157 |     } never executed:  end of block | 0 | ||||||||||||
| 158 | }; | - | ||||||||||||
| 159 | - | |||||||||||||
| 160 | struct __attribute__((visibility("default"))) CallContext : public ExecutionContext | - | ||||||||||||
| 161 | { | - | ||||||||||||
| 162 |     private: CallContext() = delete; CallContext(const CallContext &) = delete; CallContext &operator=(const CallContext &) = delete; public: template <typename Type> inline void qt_check_for_QMANAGED_macro(const Type *_q_argument) const { int i = qYouForgotTheQ_MANAGED_Macro(this, _q_argument); i = i + 1; } never executed:   typedef QV4::Heap::CallContext Data; typedef ExecutionContext SuperClass; static const QV4::VTable static_vtbl; static inline const QV4::VTable *staticVTable() { returnend of blockexecuted 4504952 times by 154 tests:   &static_vtbl;return &static_vtbl;Executed by: 
 executed 4504952 times by 154 tests:   } void __dataTest() { static_assert (sizeof(*this) == sizeof(Managed), "Classes derived from Managed can't have own data members."); }return &static_vtbl;Executed by: 
 never executed:   QV4::Heap::CallContext *d_unchecked() const { returnend of blockexecuted 13557 times by 12 tests:   static_cast<QV4::Heap::CallContext *>(m());return static_cast<QV4::Heap::CallContext *>(m());Executed by: 
 executed 13557 times by 12 tests:   } QV4::Heap::CallContext *d() const { QV4::Heap::CallContext *dptr = d_unchecked(); dptr->_checkIsInitialized(); returnreturn static_cast<QV4::Heap::CallContext *>(m());Executed by: 
 executed 13562 times by 12 tests:   dptr;return dptr;Executed by: 
 executed 13562 times by 12 tests:   } static_assert(bool(std::is_trivial< QV4::Heap::CallContext >::value), "std::is_trivial< QV4::Heap::CallContext >::value");return dptr;Executed by: 
  | 0-4504952 | ||||||||||||
| 163 |     static Heap::InternalClass *defaultInternalClass(QV4::EngineBase *e) { return never executed:   e->internalClasses(QV4::EngineBase::Class_CallContext);return e->internalClasses(QV4::EngineBase::Class_CallContext);never executed:   }return e->internalClasses(QV4::EngineBase::Class_CallContext); | 0 | ||||||||||||
| 164 | - | |||||||||||||
| 165 | int argc() const { | - | ||||||||||||
| 166 |         return executed 4496 times by 11 tests:   d()->argc();return d()->argc();Executed by: 
 executed 4496 times by 11 tests:  return d()->argc();Executed by: 
  | 4496 | ||||||||||||
| 167 | } | - | ||||||||||||
| 168 | const Value *args() const { | - | ||||||||||||
| 169 |         return never executed:   d()->args();return d()->args();never executed:  return d()->args(); | 0 | ||||||||||||
| 170 | } | - | ||||||||||||
| 171 | }; | - | ||||||||||||
| 172 | - | |||||||||||||
| 173 | inline CallContext *ExecutionContext::asCallContext() | - | ||||||||||||
| 174 | { | - | ||||||||||||
| 175 |     return executed 232 times by 1 test:   d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;Executed by: 
 executed 232 times by 1 test:  return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<CallContext *>(this) : nullptr;Executed by: 
  | 232 | ||||||||||||
| 176 | } | - | ||||||||||||
| 177 | - | |||||||||||||
| 178 | inline const CallContext *ExecutionContext::asCallContext() const | - | ||||||||||||
| 179 | { | - | ||||||||||||
| 180 |     return never executed:   d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr;return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr;never executed:  return d()->type == Heap::ExecutionContext::Type_CallContext ? static_cast<const CallContext *>(this) : nullptr; | 0 | ||||||||||||
| 181 | } | - | ||||||||||||
| 182 | - | |||||||||||||
| 183 | } | - | ||||||||||||
| 184 | - | |||||||||||||
| 185 | - | |||||||||||||
| Switch to Source code | Preprocessed file |