Reviewers: Jakob,
Message:
PTAL.
Description:
Support register as right operand in min/max support.
[email protected]
BUG=chromium:145961
TEST=test/mjsunit/regress/regress-crbug-145961.js
Please review this at https://chromiumcodereview.appspot.com/10914072/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files:
M src/x64/lithium-codegen-x64.cc
A + test/mjsunit/regress/regress-crbug-145961.js
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
27bfe15e3378e93db232e51441784415a41e7a63..60f1644ce9342cd557414740f88ad11ed75fdbc8
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -1421,6 +1421,11 @@ void LCodeGen::DoMathMinMax(LMathMinMax* instr) {
__ cmpq(left_reg, right_imm);
__ j(condition, &return_left, Label::kNear);
__ movq(left_reg, right_imm);
+ } else if (right->IsRegister()) {
+ Register right_reg = ToRegister(right);
+ __ cmpq(left_reg, right_reg);
+ __ j(condition, &return_left, Label::kNear);
+ __ movq(left_reg, right_reg);
} else {
Operand right_op = ToOperand(right);
__ cmpq(left_reg, right_op);
Index: test/mjsunit/regress/regress-crbug-145961.js
diff --git a/test/mjsunit/compiler/regress-96989.js
b/test/mjsunit/regress/regress-crbug-145961.js
similarity index 87%
copy from test/mjsunit/compiler/regress-96989.js
copy to test/mjsunit/regress/regress-crbug-145961.js
index
aedeb243187f7df2adfa343e910ce9bc5c68b998..564fa088c73ce11bea8e78c25b220b8e6f97c2a0
100644
--- a/test/mjsunit/compiler/regress-96989.js
+++ b/test/mjsunit/regress/regress-crbug-145961.js
@@ -25,19 +25,16 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
+// This test causes the operands to be passed in as Integer32 registers.
// Flags: --allow-natives-syntax
-
-// Test correct handling of uninitialized const.
-
function test() {
- for (var i = 41; i < 42; i++) {
- var c = t ^ i;
- }
- const t;
- return c;
+ a = new Int32Array(2);
+ x = a[0];
+ a[1] = -1;
+ return Math.min(a[0], a[1]);
}
-for (var i=0; i<10; i++) test();
+assertEquals(-1, test());
+assertEquals(-1, test());
%OptimizeFunctionOnNextCall(test);
-assertEquals(41, test());
+assertEquals(-1, test());
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev