Skip to content
This repository has been archived by the owner on Apr 3, 2020. It is now read-only.

Commit

Permalink
Merge pull request #2 from fenghaitao/master
Browse files Browse the repository at this point in the history
Handle specially the key of Float32x4Array and Int32x4Array element storing for arm and x64 port
  • Loading branch information
fenghaitao committed Mar 4, 2014
2 parents 68a92e4 + 0955b73 commit 112f47f
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 11 deletions.
4 changes: 3 additions & 1 deletion src/arm/lithium-arm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2174,10 +2174,12 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
(instr->is_external() &&
instr->elements()->representation().IsExternal()));
LOperand* val = UseRegister(instr->value());
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
LOperand* backing_store = UseRegister(instr->elements());
bool store_128bits_without_neon =
IsSIMD128ElementsKind(instr->elements_kind());
LOperand* key = store_128bits_without_neon
? UseRegisterOrConstant(instr->key())
: UseRegisterOrConstantAtStart(instr->key());
LStoreKeyed* result =
new(zone()) LStoreKeyed(backing_store, key, val,
store_128bits_without_neon ? TempRegister() : NULL);
Expand Down
9 changes: 4 additions & 5 deletions src/x64/lithium-codegen-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2994,12 +2994,12 @@ void LCodeGen::DoLoadKeyedSIMD128ExternalArray(LLoadKeyed* instr) {

// Allocate a SIMD128 object on the heap.
Register reg = ToRegister(instr->result());
Register tmp = ToRegister(instr->temp());
DeferredSIMD128ToTagged* deferred =
new(zone()) DeferredSIMD128ToTagged(this, instr,
static_cast<Runtime::FunctionId>(T::kRuntimeAllocatorId()));
if (FLAG_inline_new) {
__ AllocateSIMDHeapObject(Float32x4::kSize, reg, kScratchRegister,
deferred->entry(),
__ AllocateSIMDHeapObject(T::kSize, reg, tmp, deferred->entry(),
static_cast<Heap::RootListIndex>(T::kMapRootIndex()));
} else {
__ jmp(deferred->entry());
Expand All @@ -3018,9 +3018,8 @@ void LCodeGen::DoLoadKeyedSIMD128ExternalArray(LLoadKeyed* instr) {
elements_kind,
base_offset + offset,
instr->additional_index()));
__ movp(kScratchRegister, operand);
__ movp(FieldOperand(reg, Float32x4::kValueOffset + offset),
kScratchRegister);
__ movp(tmp, operand);
__ movp(FieldOperand(reg, T::kValueOffset + offset), tmp);
}
}

Expand Down
10 changes: 7 additions & 3 deletions src/x64/lithium-x64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2010,7 +2010,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
bool load_128bits_without_sse2 = IsSIMD128ElementsKind(elements_kind);
if (!instr->is_typed_elements()) {
LOperand* obj = UseRegisterAtStart(instr->elements());
result = new(zone()) LLoadKeyed(obj, key);
result = new(zone()) LLoadKeyed(obj, key, NULL);
} else {
ASSERT(
(instr->representation().IsInteger32() &&
Expand All @@ -2020,7 +2020,8 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
(instr->representation().IsTagged() &&
(IsSIMD128ElementsKind(instr->elements_kind()))));
LOperand* backing_store = UseRegister(instr->elements());
result = new(zone()) LLoadKeyed(backing_store, key);
result = new(zone()) LLoadKeyed(backing_store, key,
load_128bits_without_sse2 ? TempRegister() : NULL);
if (load_128bits_without_sse2) {
info()->MarkAsDeferredCalling();
AssignPointerMap(result);
Expand Down Expand Up @@ -2097,7 +2098,10 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
elements_kind == FLOAT32_ELEMENTS;
LOperand* val = val_is_temp_register ? UseTempRegister(instr->value())
: UseRegister(instr->value());
LOperand* key = UseRegisterOrConstantAtStart(instr->key());
bool clobbers_key = ExternalArrayOpRequiresPreScale(elements_kind);
LOperand* key = clobbers_key
? UseTempRegisterOrConstant(instr->key())
: UseRegisterOrConstantAtStart(instr->key());
LOperand* backing_store = UseRegister(instr->elements());
LStoreKeyed* result = new(zone()) LStoreKeyed(backing_store, key, val);
bool store_128bits_without_sse2 = IsSIMD128ElementsKind(elements_kind);
Expand Down
6 changes: 4 additions & 2 deletions src/x64/lithium-x64.h
Original file line number Diff line number Diff line change
Expand Up @@ -1526,11 +1526,12 @@ class LLoadExternalArrayPointer V8_FINAL
};


class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 1> {
public:
LLoadKeyed(LOperand* elements, LOperand* key) {
LLoadKeyed(LOperand* elements, LOperand* key, LOperand* temp) {
inputs_[0] = elements;
inputs_[1] = key;
temps_[0] = temp;
}

DECLARE_CONCRETE_INSTRUCTION(LoadKeyed, "load-keyed")
Expand All @@ -1547,6 +1548,7 @@ class LLoadKeyed V8_FINAL : public LTemplateInstruction<1, 2, 0> {
}
LOperand* elements() { return inputs_[0]; }
LOperand* key() { return inputs_[1]; }
LOperand* temp() { return temps_[0]; }
virtual void PrintDataTo(StringStream* stream) V8_OVERRIDE;
uint32_t additional_index() const { return hydrogen()->index_offset(); }
ElementsKind elements_kind() const {
Expand Down

0 comments on commit 112f47f

Please sign in to comment.