Simple elimination of redundant array-hole checks.
If the result of an fast elements load is converted to an untagged representation we can omit the hole check if the value is not used anywhere else except for HChange instructions converting it to an untagged representation since those will deoptimize for the hole value anyway. Review URL: http://codereview.chromium.org/6964012 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7827 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
2fb4556bfe
commit
45d07bcd32
@ -2473,9 +2473,11 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
|
||||
__ ldr(result, FieldMemOperand(scratch, FixedArray::kHeaderSize));
|
||||
|
||||
// Check for the hole value.
|
||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||
__ LoadRoot(scratch, Heap::kTheHoleValueRootIndex);
|
||||
__ cmp(result, scratch);
|
||||
DeoptimizeIf(eq, instr->environment());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -1263,6 +1263,15 @@ void HLoadKeyedFastElement::PrintDataTo(StringStream* stream) {
|
||||
}
|
||||
|
||||
|
||||
bool HLoadKeyedFastElement::RequiresHoleCheck() const {
|
||||
for (HUseIterator it(uses()); !it.Done(); it.Advance()) {
|
||||
HValue* use = it.value();
|
||||
if (!use->IsChange()) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
void HLoadKeyedGeneric::PrintDataTo(StringStream* stream) {
|
||||
object()->PrintNameTo(stream);
|
||||
stream->Add("[");
|
||||
|
@ -3255,6 +3255,8 @@ class HLoadKeyedFastElement: public HBinaryOperation {
|
||||
|
||||
virtual void PrintDataTo(StringStream* stream);
|
||||
|
||||
bool RequiresHoleCheck() const;
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(LoadKeyedFastElement)
|
||||
|
||||
protected:
|
||||
|
@ -2384,8 +2384,10 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
|
||||
FixedArray::kHeaderSize));
|
||||
|
||||
// Check for the hole value.
|
||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||
__ cmp(result, factory()->the_hole_value());
|
||||
DeoptimizeIf(equal, instr->environment());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -2394,8 +2394,10 @@ void LCodeGen::DoLoadKeyedFastElement(LLoadKeyedFastElement* instr) {
|
||||
FixedArray::kHeaderSize));
|
||||
|
||||
// Check for the hole value.
|
||||
if (instr->hydrogen()->RequiresHoleCheck()) {
|
||||
__ CompareRoot(result, Heap::kTheHoleValueRootIndex);
|
||||
DeoptimizeIf(equal, instr->environment());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user