From 99594f518a5fb657b75f68bba73537c4e9208e46 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 3 May 2017 08:45:28 +0200 Subject: Re-add some inline property storage It turns out that not using any inline property storage comes at a relatively high price in terms of memory consumption, as we always need to also create a memberData for any object. This avoids the memberData creation in quite a few cases, as we use the additional padding we have up to the 32 byte boundary given by the memory manager to store some property data. This complicates property access somewhat. To avoid performance regressions because of this, add specialized QV4::Lookup functions that optimize for properties that are inline or in the memberData struct. Change seems to be performance neutral on v8-bench on x86_64, but reduces peak memory usage when running the benchmark by around 20%. Change-Id: I0127d31a2d6038aaa540c4c4a1156f45ca3b7464 Reviewed-by: Simon Hausmann Reviewed-by: Robin Burchell --- src/qml/jsruntime/qv4lookup_p.h | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/qml/jsruntime/qv4lookup_p.h') diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index 2ffb43cce9..5a67c203ce 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -102,11 +102,15 @@ struct Lookup { static ReturnedValue getterTwoClasses(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getterFallback(Lookup *l, ExecutionEngine *engine, const Value &object); - static ReturnedValue getter0(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0MemberData(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0Inline(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getter1(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getter2(Lookup *l, ExecutionEngine *engine, const Value &object); - static ReturnedValue getter0getter0(Lookup *l, ExecutionEngine *engine, const Value &object); - static ReturnedValue getter0getter1(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0Inlinegetter0Inline(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0Inlinegetter0MemberData(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0MemberDatagetter0MemberData(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0Inlinegetter1(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue getter0MemberDatagetter1(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getter1getter1(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object); @@ -120,7 +124,8 @@ struct Lookup { static ReturnedValue arrayLengthGetter(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue globalGetterGeneric(Lookup *l, ExecutionEngine *engine); - static ReturnedValue globalGetter0(Lookup *l, ExecutionEngine *engine); + static ReturnedValue globalGetter0Inline(Lookup *l, ExecutionEngine *engine); + static ReturnedValue globalGetter0MemberData(Lookup *l, ExecutionEngine *engine); static ReturnedValue globalGetter1(Lookup *l, ExecutionEngine *engine); static ReturnedValue globalGetter2(Lookup *l, ExecutionEngine *engine); static ReturnedValue globalGetterAccessor0(Lookup *l, ExecutionEngine *engine); -- cgit v1.2.3 From 799f4a526375701d2b68d2ca1c85648994468394 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Wed, 3 May 2017 15:11:55 +0200 Subject: Optimize other lookups Add some more optimized lookups for accessing properties stored inline or in the memberData. Change-Id: Id74901d1dd91fd60933bf164c2bf90fed86232e3 Reviewed-by: Simon Hausmann Reviewed-by: Robin Burchell --- src/qml/jsruntime/qv4lookup_p.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/qml/jsruntime/qv4lookup_p.h') diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index 5a67c203ce..9e50235b73 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -79,7 +79,7 @@ struct Lookup { struct { void *dummy0; void *dummy1; - Object *proto; + Heap::Object *proto; unsigned type; }; }; @@ -116,7 +116,8 @@ struct Lookup { static ReturnedValue getterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue getterAccessor2(Lookup *l, ExecutionEngine *engine, const Value &object); - static ReturnedValue primitiveGetter0(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue primitiveGetter0Inline(Lookup *l, ExecutionEngine *engine, const Value &object); + static ReturnedValue primitiveGetter0MemberData(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue primitiveGetter1(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue primitiveGetterAccessor0(Lookup *l, ExecutionEngine *engine, const Value &object); static ReturnedValue primitiveGetterAccessor1(Lookup *l, ExecutionEngine *engine, const Value &object); @@ -136,6 +137,7 @@ struct Lookup { static void setterTwoClasses(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); static void setterFallback(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); static void setter0(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); + static void setter0Inline(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); static void setterInsert0(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); static void setterInsert1(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); static void setterInsert2(Lookup *l, ExecutionEngine *engine, Value &object, const Value &value); -- cgit v1.2.3 From 10b237882cfe76521b4dc65300a2a0473faca174 Mon Sep 17 00:00:00 2001 From: Lars Knoll Date: Mon, 15 May 2017 12:42:56 +0200 Subject: Optimize lookups based on IC changes Change-Id: I1f4f4aaad0c8194bce2ebde4503df38cab0990a2 Reviewed-by: Simon Hausmann --- src/qml/jsruntime/qv4lookup_p.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/qml/jsruntime/qv4lookup_p.h') diff --git a/src/qml/jsruntime/qv4lookup_p.h b/src/qml/jsruntime/qv4lookup_p.h index 9e50235b73..151231991f 100644 --- a/src/qml/jsruntime/qv4lookup_p.h +++ b/src/qml/jsruntime/qv4lookup_p.h @@ -79,13 +79,14 @@ struct Lookup { struct { void *dummy0; void *dummy1; + void *dummy2; Heap::Object *proto; - unsigned type; }; }; union { int level; uint index2; + unsigned type; }; uint index; uint nameIndex; -- cgit v1.2.3