Remove unnecessary environment from LStoreKeyedFastElements.
This was a left-over from a time when bounds-check was performed as part of this instruction. I also refactored and improved the code for smi-only arrays. R=vegorov@chromium.org Review URL: http://codereview.chromium.org/9023006 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@10300 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
857e89f5b3
commit
70056762f1
@ -1938,8 +1938,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
|
||||
LOperand* key = needs_write_barrier
|
||||
? UseTempRegister(instr->key())
|
||||
: UseRegisterOrConstantAtStart(instr->key());
|
||||
|
||||
return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
|
||||
return new LStoreKeyedFastElement(obj, key, val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3404,13 +3404,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
|
||||
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
|
||||
Register scratch = scratch0();
|
||||
|
||||
// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
|
||||
// conversion, so it deopts in that case.
|
||||
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
|
||||
__ tst(value, Operand(kSmiTagMask));
|
||||
DeoptimizeIf(ne, instr->environment());
|
||||
}
|
||||
|
||||
// Do the store.
|
||||
if (instr->key()->IsConstantOperand()) {
|
||||
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
||||
|
@ -3933,10 +3933,6 @@ class HStoreKeyedFastElement: public HTemplateInstruction<3> {
|
||||
}
|
||||
}
|
||||
|
||||
bool ValueNeedsSmiCheck() {
|
||||
return value_is_smi();
|
||||
}
|
||||
|
||||
virtual void PrintDataTo(StringStream* stream);
|
||||
|
||||
DECLARE_CONCRETE_INSTRUCTION(StoreKeyedFastElement)
|
||||
|
@ -3513,6 +3513,9 @@ void HGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
|
||||
|
||||
switch (boilerplate_elements_kind) {
|
||||
case FAST_SMI_ONLY_ELEMENTS:
|
||||
// Smi-only arrays need a smi check.
|
||||
AddInstruction(new(zone()) HCheckSmi(value));
|
||||
// Fall through.
|
||||
case FAST_ELEMENTS:
|
||||
AddInstruction(new(zone()) HStoreKeyedFastElement(
|
||||
elements,
|
||||
@ -4223,12 +4226,20 @@ HInstruction* HGraphBuilder::BuildFastElementAccess(HValue* elements,
|
||||
bool is_store) {
|
||||
if (is_store) {
|
||||
ASSERT(val != NULL);
|
||||
if (elements_kind == FAST_DOUBLE_ELEMENTS) {
|
||||
return new(zone()) HStoreKeyedFastDoubleElement(
|
||||
elements, checked_key, val);
|
||||
} else { // FAST_ELEMENTS or FAST_SMI_ONLY_ELEMENTS.
|
||||
return new(zone()) HStoreKeyedFastElement(
|
||||
elements, checked_key, val, elements_kind);
|
||||
switch (elements_kind) {
|
||||
case FAST_DOUBLE_ELEMENTS:
|
||||
return new(zone()) HStoreKeyedFastDoubleElement(
|
||||
elements, checked_key, val);
|
||||
case FAST_SMI_ONLY_ELEMENTS:
|
||||
// Smi-only arrays need a smi check.
|
||||
AddInstruction(new(zone()) HCheckSmi(val));
|
||||
// Fall through.
|
||||
case FAST_ELEMENTS:
|
||||
return new(zone()) HStoreKeyedFastElement(
|
||||
elements, checked_key, val, elements_kind);
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
// It's an element load (!is_store).
|
||||
@ -4399,9 +4410,6 @@ HValue* HGraphBuilder::HandlePolymorphicElementAccess(HValue* object,
|
||||
if (elements_kind == FAST_SMI_ONLY_ELEMENTS ||
|
||||
elements_kind == FAST_ELEMENTS ||
|
||||
elements_kind == FAST_DOUBLE_ELEMENTS) {
|
||||
if (is_store && elements_kind == FAST_SMI_ONLY_ELEMENTS) {
|
||||
AddInstruction(new(zone()) HCheckSmi(val));
|
||||
}
|
||||
if (is_store && elements_kind != FAST_DOUBLE_ELEMENTS) {
|
||||
AddInstruction(new(zone()) HCheckMap(
|
||||
elements, isolate()->factory()->fixed_array_map(),
|
||||
|
@ -3315,13 +3315,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
|
||||
Register elements = ToRegister(instr->object());
|
||||
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
|
||||
|
||||
// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
|
||||
// conversion, so it deopts in that case.
|
||||
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
|
||||
__ test(value, Immediate(kSmiTagMask));
|
||||
DeoptimizeIf(not_zero, instr->environment());
|
||||
}
|
||||
|
||||
// Do the store.
|
||||
if (instr->key()->IsConstantOperand()) {
|
||||
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
||||
|
@ -2023,8 +2023,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
|
||||
LOperand* key = needs_write_barrier
|
||||
? UseTempRegister(instr->key())
|
||||
: UseRegisterOrConstantAtStart(instr->key());
|
||||
|
||||
return AssignEnvironment(new(zone()) LStoreKeyedFastElement(obj, key, val));
|
||||
return new(zone()) LStoreKeyedFastElement(obj, key, val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3311,13 +3311,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
|
||||
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
|
||||
Register scratch = scratch0();
|
||||
|
||||
// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
|
||||
// conversion, so it deopts in that case.
|
||||
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
|
||||
__ And(at, value, Operand(kSmiTagMask));
|
||||
DeoptimizeIf(ne, instr->environment(), at, Operand(zero_reg));
|
||||
}
|
||||
|
||||
// Do the store.
|
||||
if (instr->key()->IsConstantOperand()) {
|
||||
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
||||
|
@ -1941,8 +1941,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
|
||||
LOperand* key = needs_write_barrier
|
||||
? UseTempRegister(instr->key())
|
||||
: UseRegisterOrConstantAtStart(instr->key());
|
||||
|
||||
return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
|
||||
return new LStoreKeyedFastElement(obj, key, val);
|
||||
}
|
||||
|
||||
|
||||
|
@ -3200,13 +3200,6 @@ void LCodeGen::DoStoreKeyedFastElement(LStoreKeyedFastElement* instr) {
|
||||
Register elements = ToRegister(instr->object());
|
||||
Register key = instr->key()->IsRegister() ? ToRegister(instr->key()) : no_reg;
|
||||
|
||||
// This instruction cannot handle the FAST_SMI_ONLY_ELEMENTS -> FAST_ELEMENTS
|
||||
// conversion, so it deopts in that case.
|
||||
if (instr->hydrogen()->ValueNeedsSmiCheck()) {
|
||||
Condition cc = masm()->CheckSmi(value);
|
||||
DeoptimizeIf(NegateCondition(cc), instr->environment());
|
||||
}
|
||||
|
||||
// Do the store.
|
||||
if (instr->key()->IsConstantOperand()) {
|
||||
ASSERT(!instr->hydrogen()->NeedsWriteBarrier());
|
||||
|
@ -1929,8 +1929,7 @@ LInstruction* LChunkBuilder::DoStoreKeyedFastElement(
|
||||
LOperand* key = needs_write_barrier
|
||||
? UseTempRegister(instr->key())
|
||||
: UseRegisterOrConstantAtStart(instr->key());
|
||||
|
||||
return AssignEnvironment(new LStoreKeyedFastElement(obj, key, val));
|
||||
return new LStoreKeyedFastElement(obj, key, val);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user