Commit 4d4485e4 authored by haitao.feng@intel.com's avatar haitao.feng@intel.com

Sign extend the dehoisted key at the definition point for x64 port only; for...

Sign extend the dehoisted key at the definition point for x64 port only; for x32 port, we need to sign extend the dehoisted key at the use points.

R=verwaest@chromium.org

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@21806 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent d757f378
...@@ -275,6 +275,11 @@ void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) { ...@@ -275,6 +275,11 @@ void LCodeGen::GenerateBodyInstructionPost(LInstruction* instr) {
} }
if (instr->HasResult() && instr->MustSignExtendResult(chunk())) { if (instr->HasResult() && instr->MustSignExtendResult(chunk())) {
// We sign extend the dehoisted key at the definition point when the pointer
// size is 64-bit. For x32 port, we sign extend the dehoisted key at the use
// points and MustSignExtendResult is always false. We can't use
// STATIC_ASSERT here as the pointer size is 32-bit for x32.
ASSERT(kPointerSize == kInt64Size);
if (instr->result()->IsRegister()) { if (instr->result()->IsRegister()) {
Register result_reg = ToRegister(instr->result()); Register result_reg = ToRegister(instr->result());
__ movsxlq(result_reg, result_reg); __ movsxlq(result_reg, result_reg);
......
...@@ -2110,6 +2110,11 @@ LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) { ...@@ -2110,6 +2110,11 @@ LInstruction* LChunkBuilder::DoLoadRoot(HLoadRoot* instr) {
void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) { void LChunkBuilder::FindDehoistedKeyDefinitions(HValue* candidate) {
// We sign extend the dehoisted key at the definition point when the pointer
// size is 64-bit. For x32 port, we sign extend the dehoisted key at the use
// points and should not invoke this function. We can't use STATIC_ASSERT
// here as the pointer size is 32-bit for x32.
ASSERT(kPointerSize == kInt64Size);
BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds(); BitVector* dehoisted_key_ids = chunk_->GetDehoistedKeyIds();
if (dehoisted_key_ids->Contains(candidate->id())) return; if (dehoisted_key_ids->Contains(candidate->id())) return;
dehoisted_key_ids->Add(candidate->id()); dehoisted_key_ids->Add(candidate->id());
...@@ -2126,7 +2131,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) { ...@@ -2126,7 +2131,7 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
LOperand* key = UseRegisterOrConstantAtStart(instr->key()); LOperand* key = UseRegisterOrConstantAtStart(instr->key());
LInstruction* result = NULL; LInstruction* result = NULL;
if (instr->IsDehoisted()) { if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) {
FindDehoistedKeyDefinitions(instr->key()); FindDehoistedKeyDefinitions(instr->key());
} }
...@@ -2171,7 +2176,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) { ...@@ -2171,7 +2176,7 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) { LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
ElementsKind elements_kind = instr->elements_kind(); ElementsKind elements_kind = instr->elements_kind();
if (instr->IsDehoisted()) { if ((kPointerSize == kInt64Size) && instr->IsDehoisted()) {
FindDehoistedKeyDefinitions(instr->key()); FindDehoistedKeyDefinitions(instr->key());
} }
......
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