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

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

Issue 14364010: Lithium: avoid registers for constants when possible. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Last comments Created 7 years, 8 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 6707455efb7b2f66e6b9e9ea141bf5cc5320876a..5a9a65394db0b0c87032b72b82150655db700801 100644
--- a/src/x64/lithium-x64.cc
+++ b/src/x64/lithium-x64.cc
@@ -557,6 +557,11 @@ LOperand* LChunkBuilder::UseRegisterOrConstantAtStart(HValue* value) {
}
+LOperand* LChunkBuilder::UseConstant(HValue* value) {
+ return chunk_->DefineConstantOperand(HConstant::cast(value));
+}
+
+
LOperand* LChunkBuilder::UseAny(HValue* value) {
return value->IsConstant()
? chunk_->DefineConstantOperand(HConstant::cast(value))
@@ -2115,19 +2120,6 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
}
-// DoStoreKeyed and DoStoreNamedField have special considerations for allowing
-// use of a constant instead of a register.
-static bool StoreConstantValueAllowed(HValue* value) {
- if (value->IsConstant()) {
- HConstant* constant_value = HConstant::cast(value);
- return constant_value->HasSmiValue()
- || constant_value->HasDoubleValue()
- || constant_value->ImmortalImmovable();
- }
- return false;
-}
-
-
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
ElementsKind elements_kind = instr->elements_kind();
bool clobbers_key = instr->key()->representation().IsTagged();
@@ -2151,18 +2143,12 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
val = UseTempRegister(instr->value());
key = UseTempRegister(instr->key());
} else {
- if (StoreConstantValueAllowed(instr->value())) {
- val = UseRegisterOrConstantAtStart(instr->value());
- } else {
- val = UseRegisterAtStart(instr->value());
- }
+ val = UseRegisterOrConstantAtStart(instr->value());
if (clobbers_key) {
key = UseTempRegister(instr->key());
- } else if (StoreConstantValueAllowed(instr->key())) {
- key = UseRegisterOrConstantAtStart(instr->key());
} else {
- key = UseRegisterAtStart(instr->key());
+ key = UseRegisterOrConstantAtStart(instr->key());
}
}
}
@@ -2258,10 +2244,13 @@ LInstruction* LChunkBuilder::DoStoreNamedField(HStoreNamedField* instr) {
: UseRegisterAtStart(instr->object());
}
+ bool can_be_constant = instr->value()->IsConstant() &&
+ !HConstant::cast(instr->value())->InNewSpace();
+
LOperand* val;
if (needs_write_barrier) {
val = UseTempRegister(instr->value());
- } else if (StoreConstantValueAllowed(instr->value())) {
+ } else if (can_be_constant) {
val = UseRegisterOrConstant(instr->value());
} else {
val = UseRegister(instr->value());
@@ -2323,7 +2312,9 @@ LInstruction* LChunkBuilder::DoAllocateObject(HAllocateObject* instr) {
LInstruction* LChunkBuilder::DoAllocate(HAllocate* instr) {
info()->MarkAsDeferredCalling();
- LOperand* size = UseTempRegister(instr->size());
+ LOperand* size = instr->size()->IsConstant()
+ ? UseConstant(instr->size())
+ : UseTempRegister(instr->size());
LOperand* temp = TempRegister();
LAllocate* result = new(zone()) LAllocate(size, temp);
return AssignPointerMap(DefineAsRegister(result));
« 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