Commit c8583b59 authored by ishell@chromium.org's avatar ishell@chromium.org

HLoadKeyed for Smis optimized for x64

R=verwaest@chromium.org

Review URL: https://codereview.chromium.org/108933002

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@18359 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 99ded7d2
...@@ -6407,7 +6407,11 @@ class HLoadKeyed V8_FINAL ...@@ -6407,7 +6407,11 @@ class HLoadKeyed V8_FINAL
(!IsHoleyElementsKind(elements_kind) || (!IsHoleyElementsKind(elements_kind) ||
mode == NEVER_RETURN_HOLE)) { mode == NEVER_RETURN_HOLE)) {
set_type(HType::Smi()); set_type(HType::Smi());
set_representation(Representation::Smi()); if (SmiValuesAre32Bits() && !RequiresHoleCheck()) {
set_representation(Representation::Integer32());
} else {
set_representation(Representation::Smi());
}
} else { } else {
set_representation(Representation::Tagged()); set_representation(Representation::Tagged());
} }
......
...@@ -3057,6 +3057,7 @@ void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) { ...@@ -3057,6 +3057,7 @@ void LCodeGen::DoLoadKeyedFixedDoubleArray(LLoadKeyed* instr) {
void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
HLoadKeyed* hinstr = instr->hydrogen();
Register result = ToRegister(instr->result()); Register result = ToRegister(instr->result());
LOperand* key = instr->key(); LOperand* key = instr->key();
if (!key->IsConstantOperand()) { if (!key->IsConstantOperand()) {
...@@ -3066,24 +3067,37 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) { ...@@ -3066,24 +3067,37 @@ void LCodeGen::DoLoadKeyedFixedArray(LLoadKeyed* instr) {
// gets replaced during bound check elimination with the index // gets replaced during bound check elimination with the index
// argument to the bounds check, which can be tagged, so that // argument to the bounds check, which can be tagged, so that
// case must be handled here, too. // 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 // Sign extend key because it could be a 32 bit negative value
// and the dehoisted address computation happens in 64 bits // and the dehoisted address computation happens in 64 bits
__ movsxlq(key_reg, key_reg); __ movsxlq(key_reg, key_reg);
} }
} }
// Load the result. bool requires_hole_check = hinstr->RequiresHoleCheck();
__ movq(result, int offset = FixedArray::kHeaderSize - kHeapObjectTag;
Representation representation = hinstr->representation();
if (representation.IsInteger32() &&
hinstr->elements_kind() == FAST_SMI_ELEMENTS) {
ASSERT(!requires_hole_check);
// Read int value directly from upper half of the smi.
STATIC_ASSERT(kSmiTag == 0);
STATIC_ASSERT(kSmiTagSize + kSmiShiftSize == 32);
offset += kPointerSize / 2;
}
__ Load(result,
BuildFastArrayOperand(instr->elements(), BuildFastArrayOperand(instr->elements(),
key, key,
FAST_ELEMENTS, FAST_ELEMENTS,
FixedArray::kHeaderSize - kHeapObjectTag, offset,
instr->additional_index())); instr->additional_index()),
representation);
// Check for the hole value. // Check for the hole value.
if (instr->hydrogen()->RequiresHoleCheck()) { if (requires_hole_check) {
if (IsFastSmiElementsKind(instr->hydrogen()->elements_kind())) { if (IsFastSmiElementsKind(hinstr->elements_kind())) {
Condition smi = __ CheckSmi(result); Condition smi = __ CheckSmi(result);
DeoptimizeIf(NegateCondition(smi), instr->environment()); DeoptimizeIf(NegateCondition(smi), instr->environment());
} else { } else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment