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);
? 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);
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);
}
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);
--- /dev/null
+// 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));