Reviewers: Sven Panne,
Message:
PTAL
Description:
[x86] Disable invalid checked load/store optimization.
TEST=mjsunit/compiler/regress-lena
Please review this at https://codereview.chromium.org/784153006/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+17, -74 lines):
M src/compiler/ia32/instruction-selector-ia32.cc
M src/compiler/x64/instruction-selector-x64.cc
A test/mjsunit/compiler/regress-lena.js
Index: src/compiler/ia32/instruction-selector-ia32.cc
diff --git a/src/compiler/ia32/instruction-selector-ia32.cc
b/src/compiler/ia32/instruction-selector-ia32.cc
index
f31cc1f517d6f8c82fda7a80e512ccb50f422f5c..b49b69c60eed72e50b5161e1c5fff6d0f3df952a
100644
--- a/src/compiler/ia32/instruction-selector-ia32.cc
+++ b/src/compiler/ia32/instruction-selector-ia32.cc
@@ -454,29 +454,6 @@ void InstructionSelector::VisitCheckedLoad(Node* node)
{
UNREACHABLE();
return;
}
- if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
- Int32Matcher mlength(length);
- Int32BinopMatcher moffset(offset);
- if (mlength.HasValue() && moffset.right().HasValue() &&
- mlength.Value() > moffset.right().Value()) {
- Int32Matcher mbuffer(buffer);
- InstructionOperand* offset_operand =
g.UseRegister(moffset.left().node());
- InstructionOperand* length_operand =
- g.TempImmediate(mlength.Value() - moffset.right().Value());
- if (mbuffer.HasValue()) {
- Emit(opcode | AddressingModeField::encode(kMode_MRI),
- g.DefineAsRegister(node), offset_operand, length_operand,
- offset_operand,
- g.TempImmediate(mbuffer.Value() + moffset.right().Value()));
- } else {
- Emit(opcode | AddressingModeField::encode(kMode_MR1I),
- g.DefineAsRegister(node), offset_operand, length_operand,
- g.UseRegister(buffer), offset_operand,
- g.UseImmediate(moffset.right().node()));
- }
- return;
- }
- }
InstructionOperand* offset_operand = g.UseRegister(offset);
InstructionOperand* length_operand =
g.CanBeImmediate(length) ? g.UseImmediate(length) :
g.UseRegister(length);
@@ -525,28 +502,6 @@ void InstructionSelector::VisitCheckedStore(Node*
node) {
? g.UseImmediate(value)
: ((rep == kRepWord8 || rep == kRepBit) ?
g.UseByteRegister(value)
: g.UseRegister(value));
- if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
- Int32Matcher mbuffer(buffer);
- Int32Matcher mlength(length);
- Int32BinopMatcher moffset(offset);
- if (mlength.HasValue() && moffset.right().HasValue() &&
- mlength.Value() > moffset.right().Value()) {
- InstructionOperand* offset_operand =
g.UseRegister(moffset.left().node());
- InstructionOperand* length_operand =
- g.TempImmediate(mlength.Value() - moffset.right().Value());
- if (mbuffer.HasValue()) {
- Emit(opcode | AddressingModeField::encode(kMode_MRI), nullptr,
- offset_operand, length_operand, value_operand, offset_operand,
- g.TempImmediate(mbuffer.Value() + moffset.right().Value()));
- } else {
- Emit(opcode | AddressingModeField::encode(kMode_MR1I), nullptr,
- offset_operand, length_operand, value_operand,
- g.UseRegister(buffer), offset_operand,
- g.UseImmediate(moffset.right().node()));
- }
- return;
- }
- }
InstructionOperand* offset_operand = g.UseRegister(offset);
InstructionOperand* length_operand =
g.CanBeImmediate(length) ? g.UseImmediate(length) :
g.UseRegister(length);
Index: src/compiler/x64/instruction-selector-x64.cc
diff --git a/src/compiler/x64/instruction-selector-x64.cc
b/src/compiler/x64/instruction-selector-x64.cc
index
95ba8973ea1aa62cac352760b5013d2e7cfbe4d0..a8a9f9d58102dcd92ce69c7490f12218ce44317d
100644
--- a/src/compiler/x64/instruction-selector-x64.cc
+++ b/src/compiler/x64/instruction-selector-x64.cc
@@ -230,21 +230,6 @@ void InstructionSelector::VisitCheckedLoad(Node* node)
{
UNREACHABLE();
return;
}
- if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
- Int32Matcher mlength(length);
- Int32BinopMatcher moffset(offset);
- if (mlength.HasValue() && moffset.right().HasValue() &&
- mlength.Value() > moffset.right().Value()) {
- InstructionOperand* offset_operand =
g.UseRegister(moffset.left().node());
- InstructionOperand* length_operand =
- g.TempImmediate(mlength.Value() - moffset.right().Value());
- Emit(opcode | AddressingModeField::encode(kMode_MR1I),
- g.DefineAsRegister(node), offset_operand, length_operand,
- g.UseRegister(buffer), offset_operand,
- g.UseImmediate(moffset.right().node()));
- return;
- }
- }
InstructionOperand* offset_operand = g.UseRegister(offset);
InstructionOperand* length_operand =
g.CanBeImmediate(length) ? g.UseImmediate(length) :
g.UseRegister(length);
@@ -284,20 +269,6 @@ void InstructionSelector::VisitCheckedStore(Node*
node) {
}
InstructionOperand* value_operand =
g.CanBeImmediate(value) ? g.UseImmediate(value) :
g.UseRegister(value);
- if (offset->opcode() == IrOpcode::kInt32Add && CanCover(node, offset)) {
- Int32Matcher mlength(length);
- Int32BinopMatcher moffset(offset);
- if (mlength.HasValue() && moffset.right().HasValue() &&
- mlength.Value() > moffset.right().Value()) {
- InstructionOperand* offset_operand =
g.UseRegister(moffset.left().node());
- InstructionOperand* length_operand =
- g.TempImmediate(mlength.Value() - moffset.right().Value());
- Emit(opcode | AddressingModeField::encode(kMode_MR1I), nullptr,
- offset_operand, length_operand, value_operand,
g.UseRegister(buffer),
- offset_operand, g.UseImmediate(moffset.right().node()));
- return;
- }
- }
InstructionOperand* offset_operand = g.UseRegister(offset);
InstructionOperand* length_operand =
g.CanBeImmediate(length) ? g.UseImmediate(length) :
g.UseRegister(length);
Index: test/mjsunit/compiler/regress-lena.js
diff --git a/test/mjsunit/compiler/regress-lena.js
b/test/mjsunit/compiler/regress-lena.js
new file mode 100644
index
0000000000000000000000000000000000000000..288e2a44f188f89d53f8986b886629e9692cf413
--- /dev/null
+++ b/test/mjsunit/compiler/regress-lena.js
@@ -0,0 +1,17 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+function module(stdlib, foreign, heap) {
+ "use asm";
+ var MEM32 = new stdlib.Int32Array(heap);
+ function foo(i) {
+ i = i|0;
+ MEM32[0] = i;
+ return MEM32[i + 4 >> 2]|0;
+ }
+ return { foo: foo };
+}
+
+var foo = module(this, {}, new ArrayBuffer(64*1024)).foo;
+assertEquals(-4, foo(-4));
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.