Reviewers: Toon Verwaest,
Description:
HLoadKeyed for Smis optimized for x64
Please review this at https://codereview.chromium.org/108933002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+23, -8 lines):
M src/hydrogen-instructions.h
M src/x64/lithium-codegen-x64.cc
Index: src/hydrogen-instructions.h
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
index
23dbbd289c6c5d5a9e07697368e9fba6ab05e22d..bd3834898bde77cdbcc4edc25e03909b86c256d0
100644
--- a/src/hydrogen-instructions.h
+++ b/src/hydrogen-instructions.h
@@ -6416,7 +6416,11 @@ class HLoadKeyed V8_FINAL
(!IsHoleyElementsKind(elements_kind) ||
mode == NEVER_RETURN_HOLE)) {
set_type(HType::Smi());
- set_representation(Representation::Smi());
+ if (SmiValuesAre32Bits() && !RequiresHoleCheck()) {
+ set_representation(Representation::Integer32());
+ } else {
+ set_representation(Representation::Smi());
+ }
} else {
set_representation(Representation::Tagged());
}
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
7c9949a1fad8da5b441e7ecd79d96ab41dbea073..e8287e2aaec1fdf907b7d4fb670e5da30ac95c64
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -3053,6 +3053,7 @@ void
LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
+ HLoadKeyed* hinstr = instr->hydrogen();
Register result = ToRegister(instr->result());
LOperand* key = instr->key();
if (!key->IsConstantOperand()) {
@@ -3062,24 +3063,34 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed*
instr) {
// gets replaced during bound check elimination with the index
// argument to the bounds check, which can be tagged, so that
// case must be handled here, too.
- if (instr->hydrogen()->IsDehoisted()) {
+ if (hinstr->IsDehoisted()) {
// Sign extend key because it could be a 32 bit negative value
// and the dehoisted address computation happens in 64 bits
__ movsxlq(key_reg, key_reg);
}
}
- // Load the result.
- __ movq(result,
+ bool requires_hole_check = hinstr->RequiresHoleCheck();
+ int offs = FixedArray::kHeaderSize - kHeapObjectTag;
+ Representation representation = hinstr->representation();
+
+ if (hinstr->type().IsSmi() && representation.IsInteger32()) {
+ ASSERT(!requires_hole_check);
+ // Read int value directly from upper half of the smi.
+ offs += kPointerSize / 2;
+ }
+
+ __ Load(result,
BuildFastArrayOperand(instr->elements(),
key,
FAST_ELEMENTS,
- FixedArray::kHeaderSize - kHeapObjectTag,
- instr->additional_index()));
+ offs,
+ instr->additional_index()),
+ representation);
// Check for the hole value.
- if (instr->hydrogen()->RequiresHoleCheck()) {
- if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) {
+ if (requires_hole_check) {
+ if (IsFastSmiElementsKind(hinstr->elements_kind())) {
Condition smi = __ CheckSmi(result);
DeoptimizeIf(NegateCondition(smi), instr->environment());
} else {
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.