ARM64: Sign extension on MemOperand for keyed ops

SXTW extend mode is usually cheaper on loads and stores than arithmetic,
so move it to the memory accesses where possible for Keyed loads and
stores.

BUG=
R=ulan@chromium.org

Review URL: https://codereview.chromium.org/268483002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21172 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9be0c4d3
...@@ -411,6 +411,12 @@ Operand Operand::UntagSmiAndScale(Register smi, int scale) { ...@@ -411,6 +411,12 @@ Operand Operand::UntagSmiAndScale(Register smi, int scale) {
} }
MemOperand::MemOperand()
: base_(NoReg), regoffset_(NoReg), offset_(0), addrmode_(Offset),
shift_(NO_SHIFT), extend_(NO_EXTEND), shift_amount_(0) {
}
MemOperand::MemOperand(Register base, ptrdiff_t offset, AddrMode addrmode) MemOperand::MemOperand(Register base, ptrdiff_t offset, AddrMode addrmode)
: base_(base), regoffset_(NoReg), offset_(offset), addrmode_(addrmode), : base_(base), regoffset_(NoReg), offset_(offset), addrmode_(addrmode),
shift_(NO_SHIFT), extend_(NO_EXTEND), shift_amount_(0) { shift_(NO_SHIFT), extend_(NO_EXTEND), shift_amount_(0) {
......
...@@ -669,6 +669,7 @@ class Operand { ...@@ -669,6 +669,7 @@ class Operand {
// MemOperand represents a memory operand in a load or store instruction. // MemOperand represents a memory operand in a load or store instruction.
class MemOperand { class MemOperand {
public: public:
inline explicit MemOperand();
inline explicit MemOperand(Register base, inline explicit MemOperand(Register base,
ptrdiff_t offset = 0, ptrdiff_t offset = 0,
AddrMode addrmode = Offset); AddrMode addrmode = Offset);
......
...@@ -1666,10 +1666,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { ...@@ -1666,10 +1666,9 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
ASSERT(instr->key()->representation().IsSmiOrInteger32()); ASSERT(instr->key()->representation().IsSmiOrInteger32());
ElementsKind elements_kind = instr->elements_kind(); ElementsKind elements_kind = instr->elements_kind();
LOperand* elements = UseRegister(instr->elements()); LOperand* elements = UseRegister(instr->elements());
LOperand* key = UseRegisterOrConstant(instr->key());
if (!instr->is_typed_elements()) { if (!instr->is_typed_elements()) {
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
if (instr->representation().IsDouble()) { if (instr->representation().IsDouble()) {
LOperand* temp = (!instr->key()->IsConstant() || LOperand* temp = (!instr->key()->IsConstant() ||
instr->RequiresHoleCheck()) instr->RequiresHoleCheck())
...@@ -1697,7 +1696,6 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { ...@@ -1697,7 +1696,6 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
(instr->representation().IsDouble() && (instr->representation().IsDouble() &&
IsDoubleOrFloatElementsKind(instr->elements_kind()))); IsDoubleOrFloatElementsKind(instr->elements_kind())));
LOperand* key = UseRegisterOrConstant(instr->key());
LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister(); LOperand* temp = instr->key()->IsConstant() ? NULL : TempRegister();
LInstruction* result = DefineAsRegister( LInstruction* result = DefineAsRegister(
new(zone()) LLoadKeyedExternal(elements, key, temp)); new(zone()) LLoadKeyedExternal(elements, key, temp));
...@@ -2301,6 +2299,7 @@ LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) { ...@@ -2301,6 +2299,7 @@ LInstruction* LChunkBuilder::DoStoreGlobalCell(HStoreGlobalCell* instr) {
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
LOperand* key = UseRegisterOrConstant(instr->key());
LOperand* temp = NULL; LOperand* temp = NULL;
LOperand* elements = NULL; LOperand* elements = NULL;
LOperand* val = NULL; LOperand* val = NULL;
...@@ -2327,19 +2326,16 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { ...@@ -2327,19 +2326,16 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
instr->elements()->representation().IsTagged()) || instr->elements()->representation().IsTagged()) ||
(instr->is_external() && (instr->is_external() &&
instr->elements()->representation().IsExternal())); instr->elements()->representation().IsExternal()));
LOperand* key = UseRegisterOrConstant(instr->key());
return new(zone()) LStoreKeyedExternal(elements, key, val, temp); return new(zone()) LStoreKeyedExternal(elements, key, val, temp);
} else if (instr->value()->representation().IsDouble()) { } else if (instr->value()->representation().IsDouble()) {
ASSERT(instr->elements()->representation().IsTagged()); ASSERT(instr->elements()->representation().IsTagged());
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp); return new(zone()) LStoreKeyedFixedDouble(elements, key, val, temp);
} else { } else {
ASSERT(instr->elements()->representation().IsTagged()); ASSERT(instr->elements()->representation().IsTagged());
ASSERT(instr->value()->representation().IsSmiOrTagged() || ASSERT(instr->value()->representation().IsSmiOrTagged() ||
instr->value()->representation().IsInteger32()); instr->value()->representation().IsInteger32());
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
return new(zone()) LStoreKeyedFixed(elements, key, val, temp); return new(zone()) LStoreKeyedFixed(elements, key, val, temp);
} }
} }
......
This diff is collapsed.
...@@ -256,11 +256,13 @@ class LCodeGen: public LCodeGenBase { ...@@ -256,11 +256,13 @@ class LCodeGen: public LCodeGenBase {
int constant_key, int constant_key,
ElementsKind elements_kind, ElementsKind elements_kind,
int additional_index); int additional_index);
void CalcKeyedArrayBaseRegister(Register base, MemOperand PrepareKeyedArrayOperand(Register base,
Register elements, Register elements,
Register key, Register key,
bool key_is_tagged, bool key_is_tagged,
ElementsKind elements_kind); ElementsKind elements_kind,
Representation representation,
int additional_index);
void RegisterEnvironmentForDeoptimization(LEnvironment* environment, void RegisterEnvironmentForDeoptimization(LEnvironment* environment,
Safepoint::DeoptMode mode); Safepoint::DeoptMode mode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment