Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(386)

Unified Diff: src/x64/lithium-x64.cc

Issue 179773002: [x64] Improve key value sign-extension of dehoisted LoadKeyed/StoreKeyed (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: some refine Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/x64/lithium-x64.cc
diff --git a/src/x64/lithium-x64.cc b/src/x64/lithium-x64.cc
index d42d3824e2f37d2b9ee94888e0d4c8bbcc8eb286..f810c8263716ecb0e6b6b7d65711c7b995ffe466 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -175,6 +175,49 @@ bool LGoto::HasInterestingComment(LCodeGen* gen) const {
}
+ArrayInstructionInterface* CheckLoadStroeKeyed(HValue* value) {
+ if (value->IsLoadKeyed()) return HLoadKeyed::cast(value);
+ if (value->IsStoreKeyed()) return HStoreKeyed::cast(value);
+ return NULL;
+}
+
+
+bool KeyForKeyedOpNeedsSignExtension(HValue* hinstr) {
+ if (hinstr->HasRange() && !hinstr->range()->CanBeNegative()) {
+ return false;
+ }
+
+ ArrayInstructionInterface* array_operation;
+ for (HUseIterator it(hinstr->uses()); !it.Done(); it.Advance()) {
+ HValue* value = it.value();
+ array_operation = CheckLoadStroeKeyed(value);
+ if (array_operation != NULL && array_operation->GetKey() == hinstr) {
+ if (array_operation->IsDehoisted()) {
+ return true;
+ }
+ } else if (value->IsPhi() && HPhi::cast(value)->HasRealUses()) {
+ for (HUseIterator itp(value->uses()); !itp.Done(); itp.Advance()) {
+ array_operation = CheckLoadStroeKeyed(itp.value());
+ if (array_operation != NULL && array_operation->GetKey() == value) {
+ if (array_operation->IsDehoisted()) {
danno 2014/03/12 14:26:08 This doesn't work completely, if you have phi node
+ return true;
+ }
+ }
+ }
+ }
+ }
+
+ return false;
+}
+
+
+template<int R>
+bool LTemplateResultInstruction<R>::MustSignExtendResult() const {
+ return this->hydrogen_value() != NULL &&
+ KeyForKeyedOpNeedsSignExtension(this->hydrogen_value());
+}
+
+
void LGoto::PrintDataTo(StringStream* stream) {
stream->Add("B%d", block_id());
}
@@ -2017,7 +2060,7 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
Representation value_representation = instr->value()->representation();
if (value_representation.IsDouble()) {
object = UseRegisterAtStart(instr->elements());
- val = UseTempRegister(instr->value());
+ val = UseRegisterAtStart(instr->value());
key = UseRegisterOrConstantAtStart(instr->key());
} else {
ASSERT(value_representation.IsSmiOrTagged() ||
« no previous file with comments | « src/x64/lithium-x64.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698