From 33ba8d084d10b0853ff1be22e0a8f7577907dabd Mon Sep 17 00:00:00 2001 From: Joel Dice Date: Fri, 6 Mar 2009 17:11:14 -0700 Subject: [PATCH] avoid unecessary subtraction in tableswitch --- src/compile.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/compile.cpp b/src/compile.cpp index ba7f3a2874..3b33189ebd 100644 --- a/src/compile.cpp +++ b/src/compile.cpp @@ -3730,9 +3730,12 @@ compile(MyThread* t, Frame* initialFrame, unsigned ip, saveStateAndCompile(t, frame, defaultIp); + Compiler::Operand* normalizedKey + = (bottom ? c->sub(4, c->constant(bottom), key) : key); + c->jmp(c->load(BytesPerWord, BytesPerWord, - c->memory(start, 0, c->sub(4, c->constant(bottom), key), - BytesPerWord), BytesPerWord)); + c->memory(start, 0, normalizedKey, BytesPerWord), + BytesPerWord)); Compiler::State* state = c->saveState();