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

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

Issue 11299328: Implement basic array prefetching hints in Hydrogen. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 8 years 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-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ia32/lithium-codegen-ia32.cc
===================================================================
--- src/ia32/lithium-codegen-ia32.cc (revision 13123)
+++ src/ia32/lithium-codegen-ia32.cc (working copy)
@@ -2849,6 +2849,14 @@
break;
}
}
+
+ if (instr->prefetch_distance() != NULL) {
+ InsertArrayPrefetch(
+ operand,
+ instr->prefetch_distance(),
+ elements_kind,
+ ToRegister(instr->temp()));
+ }
}
@@ -2876,20 +2884,30 @@
FixedDoubleArray::kHeaderSize - kHeapObjectTag,
instr->additional_index());
__ movdbl(result, double_load_operand);
+
+ if (instr->prefetch_distance() != NULL) {
+ InsertArrayPrefetch(
+ double_load_operand,
+ instr->prefetch_distance(),
+ FAST_DOUBLE_ELEMENTS,
+ ToRegister(instr->temp()));
+ }
}
void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
Register result = ToRegister(instr->result());
+ Operand load_operand = BuildFastArrayOperand(
+ instr->elements(),
+ instr->key(),
+ instr->hydrogen()->key()->representation(),
+ FAST_ELEMENTS,
+ FixedArray::kHeaderSize - kHeapObjectTag,
+ instr->additional_index());
+
// Load the result.
- __ mov(result,
- BuildFastArrayOperand(instr->elements(),
- instr->key(),
- instr->hydrogen()->key()->representation(),
- FAST_ELEMENTS,
- FixedArray::kHeaderSize - kHeapObjectTag,
- instr->additional_index()));
+ __ mov(result, load_operand);
// Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) {
@@ -2901,6 +2919,14 @@
DeoptimizeIf(equal, instr->environment());
}
}
+
+ if (instr->prefetch_distance() != NULL) {
+ InsertArrayPrefetch(
+ load_operand,
+ instr->prefetch_distance(),
+ FAST_ELEMENTS,
+ ToRegister(instr->temp()));
+ }
}
@@ -2915,6 +2941,26 @@
}
+void LCodeGen::InsertArrayPrefetch(
+ const Operand& operand,
+ LOperand* prefetch_distance,
+ ElementsKind elements_kind,
+ Register scratch) {
+ __ lea(scratch, operand);
+ int shift_size = ElementsKindToShiftSize(elements_kind);
+ if (prefetch_distance->IsConstantOperand()) {
+ __ prefetch(Operand(scratch,
+ ToInteger32(LConstantOperand::cast(prefetch_distance)) << shift_size),
+ 1);
+ } else {
+ ASSERT(prefetch_distance->IsRegister());
+ ScaleFactor scale_factor = static_cast<ScaleFactor>(shift_size);
+ __ prefetch(
+ Operand(scratch, ToRegister(prefetch_distance), scale_factor, 0), 1);
+ }
+}
+
+
Operand LCodeGen::BuildFastArrayOperand(
LOperand* elements_pointer,
LOperand* key,
« no previous file with comments | « src/ia32/lithium-codegen-ia32.h ('k') | src/ia32/lithium-ia32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698