| Index: src/ia32/lithium-ia32.cc
|
| ===================================================================
|
| --- src/ia32/lithium-ia32.cc (revision 13123)
|
| +++ src/ia32/lithium-ia32.cc (working copy)
|
| @@ -422,6 +422,10 @@
|
| } else {
|
| stream->Add("]");
|
| }
|
| + if (prefetch_distance() != NULL) {
|
| + stream->Add(" ");
|
| + prefetch_distance()->PrintTo(stream);
|
| + }
|
| }
|
|
|
|
|
| @@ -1958,6 +1962,23 @@
|
| }
|
|
|
|
|
| +static bool ShouldPrefetch(HValue* distance, ElementsKind elements_kind) {
|
| + bool should_prefetch = true;
|
| +
|
| + if (distance->IsConstant()) {
|
| + HConstant* prefetch_distance = HConstant::cast(distance);
|
| + ASSERT(prefetch_distance->HasInteger32Value());
|
| + int32_t distance_value = prefetch_distance->Integer32Value();
|
| + if (distance_value < 0) distance_value = -distance_value;
|
| + // Omit the nearby accesses which are supposed to hit the cache.
|
| + should_prefetch =
|
| + (distance_value >= (64 >> ElementsKindToShiftSize(elements_kind)));
|
| + }
|
| +
|
| + return should_prefetch;
|
| +}
|
| +
|
| +
|
| LInstruction* LChunkBuilder::DoLoadKeyed(HLoadKeyed* instr) {
|
| ASSERT(instr->key()->representation().IsInteger32() ||
|
| instr->key()->representation().IsTagged());
|
| @@ -1969,9 +1990,17 @@
|
| : UseRegisterOrConstantAtStart(instr->key());
|
| LLoadKeyed* result = NULL;
|
|
|
| + LOperand* prefetch = NULL;
|
| + LOperand* temp = NULL;
|
| + if (instr->prefetch_distance() != graph()->GetConstantUndefined() &&
|
| + ShouldPrefetch(instr->prefetch_distance(), elements_kind)) {
|
| + prefetch = UseRegisterOrConstant(instr->prefetch_distance());
|
| + temp = TempRegister();
|
| + }
|
| +
|
| if (!instr->is_external()) {
|
| LOperand* obj = UseRegisterAtStart(instr->elements());
|
| - result = new(zone()) LLoadKeyed(obj, key);
|
| + result = new(zone()) LLoadKeyed(obj, key, prefetch, temp);
|
| } else {
|
| ASSERT(
|
| (instr->representation().IsInteger32() &&
|
| @@ -1981,7 +2010,7 @@
|
| ((elements_kind == EXTERNAL_FLOAT_ELEMENTS) ||
|
| (elements_kind == EXTERNAL_DOUBLE_ELEMENTS))));
|
| LOperand* external_pointer = UseRegister(instr->elements());
|
| - result = new(zone()) LLoadKeyed(external_pointer, key);
|
| + result = new(zone()) LLoadKeyed(external_pointer, key, prefetch, temp);
|
| }
|
|
|
| DefineAsRegister(result);
|
|
|