aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/memory/qv4mm_p.h
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-18 10:29:10 +0200
committerUlf Hermann <ulf.hermann@theqtcompany.com>2015-08-18 10:29:47 +0200
commiteb30e3d7ee81c48cea720e7ecd2ed45647bc70ee (patch)
tree810e8ad0642434eeb4043c3a06c82217314300e1 /src/qml/memory/qv4mm_p.h
parent9c9fca5e27bd91da1ea07bebd7569049493c5ccf (diff)
parent521ace713d8e5230d47f3da8cd941699ca085af2 (diff)
Merge remote-tracking branch 'origin/5.5' into 5.6
Conflicts: src/qml/debugger/qv4debugservice.cpp src/qml/jsruntime/qv4value_inl_p.h src/qml/jsruntime/qv4value_p.h src/qml/memory/qv4mm.cpp src/qml/memory/qv4mm_p.h src/qml/qml/qqmlnotifier_p.h src/qml/qml/qqmlproperty.cpp src/quick/items/qquickflickable.cpp src/quick/items/qquicktextedit.cpp tests/auto/quick/qquickwindow/BLACKLIST The extra changes in qqmlbinding.cpp are ported from changes to qqmlproperty.cpp that occurred in parallel with writeBinding() being moved to qqmlbinding.cpp. Change-Id: I16d1920abf448c29a01822256f52153651a56356
Diffstat (limited to 'src/qml/memory/qv4mm_p.h')
-rw-r--r--src/qml/memory/qv4mm_p.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/qml/memory/qv4mm_p.h b/src/qml/memory/qv4mm_p.h
index 6d6ce1bad7..c01866ff11 100644
--- a/src/qml/memory/qv4mm_p.h
+++ b/src/qml/memory/qv4mm_p.h
@@ -83,10 +83,10 @@ public:
{ return (size + 15) & ~0xf; }
template<typename ManagedType>
- inline typename ManagedType::Data *allocManaged(std::size_t size)
+ inline typename ManagedType::Data *allocManaged(std::size_t size, std::size_t unmanagedSize = 0)
{
size = align(size);
- Heap::Base *o = allocData(size);
+ Heap::Base *o = allocData(size, unmanagedSize);
o->setVtable(ManagedType::staticVTable());
return static_cast<typename ManagedType::Data *>(o);
}
@@ -109,6 +109,15 @@ public:
return t->d();
}
+ template <typename ManagedType, typename Arg1>
+ typename ManagedType::Data *allocWithStringData(std::size_t unmanagedSize, Arg1 arg1)
+ {
+ Scope scope(engine());
+ Scoped<ManagedType> t(scope, allocManaged<ManagedType>(sizeof(typename ManagedType::Data), unmanagedSize));
+ (void)new (t->d()) typename ManagedType::Data(this, arg1);
+ return t->d();
+ }
+
template <typename ManagedType, typename Arg1, typename Arg2>
typename ManagedType::Data *alloc(Arg1 arg1, Arg2 arg2)
{
@@ -157,10 +166,12 @@ public:
size_t getAllocatedMem() const;
size_t getLargeItemsMem() const;
+ void growUnmanagedHeapSizeUsage(size_t delta); // called when a JS object grows itself. Specifically: Heap::String::append
+
protected:
/// expects size to be aligned
// TODO: try to inline
- Heap::Base *allocData(std::size_t size);
+ Heap::Base *allocData(std::size_t size, std::size_t unmanagedSize);
#ifdef DETAILED_MM_STATS
void willAllocate(std::size_t size);