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

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

Issue 11365084: Some improvements in register usage in lithium compilation of LoadKeyed/StoreKeyed operations. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Response to comments, thx! Created 8 years, 1 month 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/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/lithium-ia32.cc
diff --git a/src/ia32/lithium-ia32.cc b/src/ia32/lithium-ia32.cc
index 4207410cdf28c4dbc5c9c779da85436c7ac0a32f..ba9c97eba215922c87fc43ba459d75527452c364 100644
--- a/src/ia32/lithium-ia32.cc
+++ b/src/ia32/lithium-ia32.cc
@@ -1933,17 +1933,14 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
ASSERT(instr->key()->representation().IsInteger32() ||
instr->key()->representation().IsTagged());
ElementsKind elements_kind = instr->elements_kind();
- bool clobbers_key = ExternalArrayOpRequiresTemp(
- instr->key()->representation(), elements_kind);
- LOperand* key = clobbers_key
+ LOperand* elements = UseRegisterAtStart(instr->elements());
+ LOperand* key = instr->is_external() &&
+ ExternalArrayOpRequiresTemp<HLoadKeyed>(instr)
? UseTempRegister(instr->key())
: UseRegisterOrConstantAtStart(instr->key());
- LLoadKeyed* result = NULL;
- if (!instr->is_external()) {
- LOperand* obj = UseRegisterAtStart(instr->elements());
- result = new(zone()) LLoadKeyed(obj, key);
- } else {
+#ifdef DEBUG
+ if (instr->is_external()) {
ASSERT(
(instr->representation().IsInteger32() &&
(elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
@@ -1951,10 +1948,10 @@ LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
(instr->representation().IsDouble() &&
((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
(elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
- LOperand* external_pointer = UseRegister(instr->elements());
- result = new(zone()) LLoadKeyed(external_pointer, key);
}
+#endif
+ LLoadKeyed* result = new(zone()) LLoadKeyed(elements, key);
DefineAsRegister(result);
bool can_deoptimize = instr->RequiresHoleCheck() ||
(elements_kind == EXTERNAL_UNSIGNED_INT_ELEMENTS);
@@ -1976,34 +1973,27 @@ LInstruction* LChunkBuilder::DoLoadKeyedGeneric(HLoadKeyedGeneric* instr) {
LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
- LStoreKeyed* result = NULL;
+ ElementsKind elements_kind = instr->elements_kind();
+ LOperand* elements;
+ LOperand* val;
+ LOperand* key;
if (!instr->is_external()) {
ASSERT(instr->elements()->representation().IsTagged());
ASSERT(instr->key()->representation().IsInteger32() ||
instr->key()->representation().IsTagged());
- if (instr->value()->representation().IsDouble()) {
- LOperand* object = UseRegisterAtStart(instr->elements());
- LOperand* val = UseTempRegister(instr->value());
- LOperand* key = UseRegisterOrConstantAtStart(instr->key());
-
- result = new(zone()) LStoreKeyed(object, key, val);
+ if (instr->NeedsWriteBarrier() &&
+ !IsFastDoubleElementsKind(elements_kind)) {
+ val = UseTempRegister(instr->value());
+ key = UseTempRegister(instr->key());
+ elements = UseRegister(instr->elements());
} else {
- ASSERT(instr->value()->representation().IsTagged());
- bool needs_write_barrier = instr->NeedsWriteBarrier();
-
- LOperand* obj = UseRegister(instr->elements());
- LOperand* val = needs_write_barrier
- ? UseTempRegister(instr->value())
- : UseRegisterAtStart(instr->value());
- LOperand* key = needs_write_barrier
- ? UseTempRegister(instr->key())
- : UseRegisterOrConstantAtStart(instr->key());
- result = new(zone()) LStoreKeyed(obj, key, val);
+ val = UseRegisterAtStart(instr->value());
+ key = UseRegisterOrConstantAtStart(instr->key());
+ elements = UseRegisterAtStart(instr->elements());
}
} else {
- ElementsKind elements_kind = instr->elements_kind();
ASSERT(
(instr->value()->representation().IsInteger32() &&
(elements_kind != EXTERNAL_FLOAT_ELEMENTS) &&
@@ -2013,26 +2003,25 @@ LInstruction* LChunkBuilder::DoStoreKeyed(HStoreKeyed* instr) {
(elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
ASSERT(instr->elements()->representation().IsExternal());
- LOperand* external_pointer = UseRegister(instr->elements());
+ if (ExternalArrayOpRequiresTemp<HStoreKeyed>(instr)) {
+ key = UseTempRegister(instr->key());
+ elements = UseRegister(instr->elements());
+ } else {
+ key = UseRegisterOrConstantAtStart(instr->key());
+ elements = UseRegisterAtStart(instr->elements());
+ }
+
// Determine if we need a byte register in this case for the value.
bool val_is_fixed_register =
elements_kind == EXTERNAL_BYTE_ELEMENTS ||
elements_kind == EXTERNAL_UNSIGNED_BYTE_ELEMENTS ||
elements_kind == EXTERNAL_PIXEL_ELEMENTS;
-
- LOperand* val = val_is_fixed_register
+ val = val_is_fixed_register
? UseFixed(instr->value(), eax)
: UseRegister(instr->value());
- bool clobbers_key = ExternalArrayOpRequiresTemp(
- instr->key()->representation(), elements_kind);
- LOperand* key = clobbers_key
- ? UseTempRegister(instr->key())
- : UseRegisterOrConstantAtStart(instr->key());
- result = new(zone()) LStoreKeyed(external_pointer,
- key,
- val);
}
+ LStoreKeyed* result = new(zone()) LStoreKeyed(elements, key, val);
ASSERT(result != NULL);
return result;
}
« no previous file with comments | « src/ia32/lithium-ia32.h ('k') | src/x64/lithium-codegen-x64.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698