diff options
author | Liang Qi <liang.qi@qt.io> | 2017-06-15 08:57:58 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2017-06-15 09:10:12 +0200 |
commit | 9f3aefb086c5f9d6b9dd192689bdd473da07186a (patch) | |
tree | 93349812f4a46305edf5e27f7e737d952e0d9a3a /src/qml/jit | |
parent | a021bd87755ccfbe49e132f942ded935c9719b00 (diff) | |
parent | d2bb2e202427ebae545a408f065c893f3d837061 (diff) |
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts:
src/qml/compiler/qv4codegen.cpp
Change-Id: I3c41b9fc9ba7d41741e4dd400402ae80dd7726d9
Diffstat (limited to 'src/qml/jit')
-rw-r--r-- | src/qml/jit/qv4unop.cpp | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/qml/jit/qv4unop.cpp b/src/qml/jit/qv4unop.cpp index 896be07ed5..78546e1509 100644 --- a/src/qml/jit/qv4unop.cpp +++ b/src/qml/jit/qv4unop.cpp @@ -83,6 +83,15 @@ template <typename JITAssembler> void Unop<JITAssembler>::generateUMinus(IR::Expr *source, IR::Expr *target) { IR::Temp *targetTemp = target->asTemp(); + + if (IR::Const *c = source->asConst()) { + if (c->value == 0 && source->type == IR::SInt32Type) { + // special case: minus integer 0 is 0, which is not what JS expects it to be, so always + // do a runtime call + generateRuntimeCall(_as, target, uMinus, PointerToValue(source)); + return; + } + } if (source->type == IR::SInt32Type) { typename JITAssembler::RegisterID tReg = JITAssembler::ScratchRegister; if (targetTemp && targetTemp->kind == IR::Temp::PhysicalRegister) |