aboutsummaryrefslogtreecommitdiffstats
path: root/src/qml/jsruntime/qv4value_p.h
Commit message (Collapse)AuthorAgeFilesLines
* JS: Encode result of Math.min and Math.max as int when possibleErik Verbruggen2018-07-131-4/+7
| | | | | | | | | | So now Math.max(array1.length, array2.length) won't return a double anymore. This improves the score in the crypto benchmark by ~10% Change-Id: I8453a671d28d7f2a39ba74b18b3155f031d9b12f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Get rid of Value::asArrayIndex()Lars Knoll2018-07-021-32/+0
| | | | | | | | | | | It was only used in a few places now, that can be replaced by either using a PropertyKey, or by limiting the fast path optimization in the runtime to array indices smaller than INT_MAX. Since there are less branches this should even be faster for pretty much all use cases. Change-Id: Ib4f2f2f3e27f14ad180b810546e82ac83170b106 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Introduce a PropertyKey class that inherits from ValueLars Knoll2018-07-021-1/+1
| | | | | | | | | | | This will replace Identifier over the next few commits. The advantage of PropertyKey is that it can be stored on the JS stack, so that a GC run won't accidentally clean up the string/symbol referenced by the key. Change-Id: Ib4daa4616bcfa537e6d371ef7c7740bc7727a50d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix creation of object literalsLars Knoll2018-06-041-1/+0
| | | | | | | | | | | | | | | | Our method to create object literals wasn't compliant with the ES7 spec, as we would in some cases re-order the properties. This violated the spec which required properties to be created in order, so that for-of would also iterate over them in creation order. As a nice side effect, this simplifies the code and gets a couple of test cases using computed property names to pass. Task-number: QTBUG-62512 Change-Id: I6dfe004357c5d46a0890027f4fd9e2d1e1a2a17a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Implement ToPropertyKey() from the ES7 specLars Knoll2018-06-041-5/+2
| | | | | | | and use it where required. Change-Id: I309ca61e0360b26428fc2ea5a2eea47c8e0632a0 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* qv4arrayobject: Implement Array.prototype.includes from ES7Robin Burchell2018-05-251-1/+2
| | | | | | | | | | | | | | We also add a sameValueZero helper, to make life easier. Remaining failures: built-ins/Array/prototype/includes/get-prop.js fails (due to missing Proxy) built-ins/Array/prototype/includes/length-boundaries.js fails length-boundaries failure is due to strange treatment of edge number values in Value, I think, I haven't yet been able to rectify that one. Change-Id: Idacca528d88fb052d19a5d244662927f502f20d2 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Don't use empty values anymore to store internal freelistsLars Knoll2018-05-241-26/+2
| | | | | | | | | | | | Simply encode them as integers. That works just as well, and allows removing the indexed empty values. This is helpful, to swap the internal representations of undefined and empty values, which in turn will simplify an implementation of correct handling of uninitialized variables (through let/const). Change-Id: I299f975d665309611d1b561f6a0c86b5ca15782a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix another ubsan warningLars Knoll2018-05-041-1/+1
| | | | | | | Don't call asReturnedValue() on something that might be null. Change-Id: I31ab7df7e353dee0718957ec0d5b4edcc72f7a56 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* Optimize conversions to array indicesLars Knoll2018-05-031-19/+21
| | | | | Change-Id: Ic83314fc2a5bb80f88c1616e7d3179fe6573a0e9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix asan warningsLars Knoll2018-05-021-0/+14
| | | | | | | Don't try to allocate an array buffer with negative length. Change-Id: Ie95b9bcf7a3108b47df27ef813b7922e9da42b17 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fixes when using getLength()Lars Knoll2018-05-021-1/+1
| | | | | | | Do some more bounds checking to avoid crashes. Change-Id: I44e838c3577a9176628aa5e382d712eac9800203 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Partial Symbol supportLars Knoll2018-05-021-1/+18
| | | | | | | | | Added basic infrastructure to create symbols and convert them back to strings. In addition, storing and retrieving of symbol based properties in Objects works. Change-Id: I185f7aa46e7afa19db5a801102142892e03b7bf1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Change Objects vtable methods to take a StringOrSymbolLars Knoll2018-05-021-0/+14
| | | | | | | This is needed for symbol support. Change-Id: I83db21f232168710d18999fd97d912016e86d630 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* The length of array like objects can in some cases be 2^53 -1 in ES7Lars Knoll2018-05-021-0/+13
| | | | | | | | | Add a Value::getLength(), that converts a Value to a length bound between 0 and 2^53-1 as per ES7 spec. Use the extended range in Array.prototype.splice and map to fix hanging test cases. Change-Id: If9280d501423cfc10a60abd4e8aa30521d2a7bca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove dependency from qv4heap_p.h onto qv4internalclass_p.hLars Knoll2018-04-121-5/+6
| | | | | | | | This is required to be able to turn the internal class into something that lives on the GC heap. Change-Id: Ie4318588d420743b1e1ab1cd596a1c9d153eb793 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix isInt32 for -0.0Erik Verbruggen2018-03-261-1/+1
| | | | | | | Because no, that can't be represented as an 32bit integer. Change-Id: I83e5e74fdfbd9b13ac04a49311619d8939c7b093 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* use nullptr consistently (clang-tidy)Shawn Rutledge2018-02-261-3/+3
| | | | | | | | | | | | | From now on we prefer nullptr instead of 0 to clarify cases where we are assigning or testing a pointer rather than a numeric zero. Also, replaced cases where 0 was passed as Qt::KeyboardModifiers with Qt::NoModifier (clang-tidy replaced them with nullptr, which waas wrong, so it was just as well to make the tests more readable rather than to revert those lines). Change-Id: I4735d35e4d9f42db5216862ce091429eadc6e65d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Merge remote-tracking branch 'origin/5.10' into 5.11Liang Qi2018-02-121-0/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/imports/shapes/qquickshape.cpp src/imports/shapes/qquickshape_p_p.h src/qml/compiler/qqmlpropertycachecreator_p.h src/qml/jsruntime/qv4value_p.h src/quick/items/qquickloader_p.h tests/auto/qml/qqmlecmascript/tst_qqmlecmascript.cpp tools/qmlprofiler/qmlprofilerapplication.cpp Change-Id: Iafc66ae84bf78630ed72a986acb678e9d19e3a69
| * Merge remote-tracking branch 'origin/5.9' into 5.105.10Liang Qi2018-02-071-0/+4
| |\ | | | | | | | | | Change-Id: I3b250545e334f50dcef1a75acdef51820d34079a
| | * QML: Collapse all NaNs into one single (encoded) NaNErik Verbruggen2018-02-051-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The idea of NaN boxing is to use one single NaN as a "true" NaN, and all others as a boxed value. So when encoding some NaN, be sure to use that one "true" NaN. Otherwise, it will be interpreted as an encoded value. Task-number: QTBUG-65998 Change-Id: Ia6e4641be180f3d626c40a57b473f181358e04db Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Disentangle include dependencies around the write barrierLars Knoll2018-01-191-0/+89
| | | | | | | | | | | | | | | | | | | | | The write barrier header should have minimal dependencies. Change-Id: I071718c2fafe5020d1093ca3b363844f7a9b7b35 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Raise minimum supported MSVC version to 2015Friedemann Kleint2018-01-061-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove code for older versions and streamline #ifdefs. Remove the helpers macros Q_STATIC_ASSERT_FOR_SANE_COMPILERS and V4_ASSERT_IS_TRIVIAL. Task-number: QTBUG-40658 Task-number: QTBUG-51673 Change-Id: Ifa4fab653b10ce7858739adef08364cddc6507cf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | V4: Remove left-overs from previous 32bit Value encodingErik Verbruggen2017-11-161-29/+0
| | | | | | | | | | | | | | | Change-Id: I0eb3300ac2e3e29b5311f9b7599d85eab7f775c5 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Optimize Value::toObject/toStringLars Knoll2017-11-151-0/+4
| | | | | | | | | | | | | | | Change-Id: Iccfe50c967560deee9e2903bbe3a293b13fe8b48 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Allow for encoding a nullptr Heap::Base as a ValueErik Verbruggen2017-11-141-1/+0
| | | | | | | | | | | | | | | | | | | | | The encoding will end up being the same as undefined. Change-Id: I2427e96f98d410c291234615969791de6bf4f833 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Bring back markObjects(), this time generatedLars Knoll2017-11-141-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | Doing the marking of objects in a function instead of using the table seems to be somewhat faster. Change-Id: I9ec00cc0264f9a15c69b285db493bee31d99bf96 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove Binop/BinopContext instructions and implement missing binopsErik Verbruggen2017-10-231-3/+4
| | | | | | | | | | | | | | | Change-Id: Ibefac50246045066c90c4c2dbc36d2776c5dab0e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Merge remote-tracking branch 'origin/dev' into HEADLars Knoll2017-10-221-1/+1
|\ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/qml/compiler/qv4codegen.cpp src/qml/compiler/qv4compileddata.cpp src/qml/compiler/qv4compileddata_p.h src/qml/compiler/qv4isel_moth_p.h src/qml/compiler/qv4ssa.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm_p.h src/qml/jit/qv4regalloc.cpp src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4qmlcontext_p.h src/qml/jsruntime/qv4regexp.cpp src/qml/jsruntime/qv4regexp_p.h src/qml/jsruntime/qv4regexpobject.cpp src/qml/jsruntime/qv4runtime.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/qml/v8/qqmlbuiltinfunctions.cpp tests/auto/qml/qml.pro tests/auto/qml/qmlplugindump/tst_qmlplugindump.cpp tools/qmlcachegen/qmlcachegen.cpp Change-Id: I1577e195c736f3414089036b957a01cb91a3ca23
| * | | Replace Q_NULLPTR with nullptrKevin Funk2017-09-271-1/+1
| |/ / | | | | | | | | | | | | Change-Id: I0c01862dbb475494c84e39c695cb563df8cbcfa8 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Fix 32bit builds/testsErik Verbruggen2017-09-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that we use the xor-NaN boxing on all platforms, the 32bit checks are not valid anymore. We do need to check if we still want specialized 32bit versions to prevent bad code generation for the 64bit stored value. Task-number: QTBUG-63194 Change-Id: Ic58a174194bfd343c09b78076ecbf8f2816d5749 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Add a Value::isFunctionObject() methodLars Knoll2017-09-011-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | This is just as fast as isObject(), and allows for some smaller optimizations. Change-Id: Icc2117941a2851e56e9ef2baf87ba3bca9538581 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Fix calling convention for some often used functions in QV4::ValueLars Knoll2017-08-281-4/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Calling a non inline memberfunction does force the this argument onto the stack. Replacing those functions with static member functions taking the object by Value avoids that problem and allows the QV4::Value to be passed in registers. Change-Id: I9cf1c220e1dc0f958b416a7216d9ba1ae79a4b3e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | New value type encodingLars Knoll2017-08-251-97/+83
| | | | | | | | | | | | | | | | | | | | | | | | | | | Switch to a more efficient encoding of Values. This makes the type() determination easier and faster than before, and should allow us to optimize comparison operations better. Change-Id: I22106262cea052ae1887f42a957860ee00b450e6 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Optimize toInt32()/toUInt32()Lars Knoll2017-08-181-12/+82
| | | | | | | | | | | | | | | | | | | | | | | | And with this there is no need to special case integers in the BitXxx binops anymore. Change-Id: I9f94651d776f4e31ff8152fe7ce00dc5b1fa706e Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Remove Scope::result and convert calling convention for builtinsLars Knoll2017-08-081-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | Allow for faster calling of builtins, and completely avoid scope creation in many cases. Change-Id: I0f1681e19e9908db10def85a74e134a87fc2e44c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | | Change function signatures for call/construct backLars Knoll2017-08-041-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | Change those back again to return a value. This will be required to avoid creation of Scope objects between JS function calls. Change-Id: I05cb5cf8fd0c13dcefa60d213ccd5983fab57ea3 Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
* | | Tune asArrayIndexErik Verbruggen2017-08-021-2/+2
| | | | | | | | | | | | | | | Change-Id: Icc8a05b9a04d98e6e7c29f1d5b2cea32ce75ad24 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | | Encode numeric literals as int when possibleErik Verbruggen2017-06-221-0/+8
|/ / | | | | | | | | Change-Id: I5ecc406f06a193b470eb9ac376da6b9f752d01cb Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into devSimon Hausmann2017-04-071-23/+35
|\| | | | | | | | | | | | | | | | | | | Conflicts: src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4vme_moth.cpp Change-Id: I865d794e550a263387a39ca8d051ebf48b70cbc0
| * Fix value type encoding constant usage when cross-compilingSimon Hausmann2017-03-301-23/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Our two value encodings use different masks for the upper 4 bytes. Depending on the target architecture we must use different values when generating code that uses these masks. This patch replaces the #ifdef'ed ValueTypeInternal_* enum values with two C++11 scoped enums that allows for the co-existence of both throughout the code base as well as selective use in the code generators. Change-Id: I380c8c28b84df2874cca521b78bfe7f9388ed228 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Separate the stack used for GC from the regular JS stackLars Knoll2017-04-071-1/+1
| | | | | | | | | | | | | | | | This is required to be able to implement concurrent or incremental garbage collection. Change-Id: Ib3c5eee3779ca2ee08a57cd3961dbcb0537bbb54 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Merge remote-tracking branch 'origin/5.9' into HEADSimon Hausmann2017-03-231-2/+0
|\| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/plugins/qmltooling/qmldbg_debugger/qv4datacollector.cpp src/qml/jit/qv4assembler.cpp src/qml/jit/qv4assembler_p.h src/qml/jit/qv4isel_masm.cpp src/qml/jsruntime/qv4context.cpp src/qml/jsruntime/qv4context_p.h src/qml/jsruntime/qv4engine.cpp src/qml/jsruntime/qv4vme_moth.cpp src/qml/memory/qv4mmdefs_p.h Change-Id: I9966750b7cd9106b78e4c4779f12b95a481cca40
| * Complete transition to standard layout classes for JIT accessSimon Hausmann2017-03-211-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | Move the Runtime function pointer array into EngineBase so that we can eliminate the last use of qOffsetOf. For improved cache locality the memory manager point is now also located in the EngineBase. Change-Id: I0b3cf44c726aa4fb8db1206cc414a56c2f522a84 Task-number: QTBUG-58666 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* | Add an actual write barrier and centralize it in one placeLars Knoll2017-03-091-46/+0
| | | | | | | | | | | | | | | | All stores into the Heap from C++ and Moth should now go through the write barrier. Change-Id: Iae9347754b90d68c10fade9f345842e86ec460cd Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | move locals over to be write barrier safeLars Knoll2017-03-091-22/+1
| | | | | | | | | | Change-Id: I56b1dab62ff432273ee8549b0496bd0f3fc655ea Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Go through proper set() functions when writing to MemberDataLars Knoll2017-03-091-0/+38
| | | | | | | | | | | | | | | | This is required, so we only have to add the write barrier in one place. Change-Id: I4e8bde823b30ad18f043312ac3f1ed46597b91a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Change getValueOrSetter to be write barrier friendlyLars Knoll2017-03-091-0/+5
| | | | | | | | | | | | | | | | Don't return a naked pointer into the heap, as this makes it impossible to track where and when we're writing into it. Change-Id: I2b9b81779ef8e9fb7a643ddda82aa6af8af459a7 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add a set() method to HeapValue as wellLars Knoll2017-03-091-1/+4
| | | | | | | | | | | | | | | | And use it instead of simply assigning to it, so we can add a write barrier later on. Change-Id: I31c0d0b20ed5d37fee046aa02af17875679b22bf Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Make every member of a Heap object aware of its offset inside the objectLars Knoll2017-03-091-0/+5
| | | | | | | | | | | | | | | | This will allow adding a write barrier to those fields with manageable effort. Change-Id: I7d06d7ffccbcefe66e2524c64c962353c91c2766 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Refactor how we define Heap objectsLars Knoll2017-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | Declare the type of Heap object in the Member() macro, instead of deducing it from templates. This allows us to encode the offset of the member in the second template argument to Pointer<> in a second step. Change-Id: I2cfb73785749d3fb991689b4e0554a72b3e5e13f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>