MIPS: Eliminate map checks of constant values.

Port r15819 (a453a0e)

BUG=

Review URL: https://codereview.chromium.org/19876006
Patch from Balazs Kilvady <kilvadyb@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@15831 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
palfia@homejinni.com 2013-07-23 14:29:04 +00:00
parent cb055f1732
commit f48a8d1ca4
2 changed files with 17 additions and 9 deletions

View File

@ -5187,6 +5187,7 @@ void LCodeGen::DoCheckMapCommon(Register map_reg,
void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
if (instr->hydrogen()->CanOmitMapChecks()) return;
Register map_reg = scratch0();
LOperand* input = instr->value();
ASSERT(input->IsRegister());
@ -5255,6 +5256,8 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
if (instr->hydrogen()->CanOmitPrototypeChecks()) return;
Register prototype_reg = ToRegister(instr->temp());
Register map_reg = ToRegister(instr->temp2());
@ -5263,12 +5266,10 @@ void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
ASSERT(prototypes->length() == maps->length());
if (!instr->hydrogen()->CanOmitPrototypeChecks()) {
for (int i = 0; i < prototypes->length(); i++) {
__ LoadHeapObject(prototype_reg, prototypes->at(i));
__ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
DoCheckMapCommon(map_reg, maps->at(i), instr->environment());
}
for (int i = 0; i < prototypes->length(); i++) {
__ LoadHeapObject(prototype_reg, prototypes->at(i));
__ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
DoCheckMapCommon(map_reg, maps->at(i), instr->environment());
}
}

View File

@ -1951,9 +1951,14 @@ LInstruction* LChunkBuilder::DoCheckInstanceType(HCheckInstanceType* instr) {
LInstruction* LChunkBuilder::DoCheckPrototypeMaps(HCheckPrototypeMaps* instr) {
LUnallocated* temp1 = TempRegister();
LOperand* temp2 = TempRegister();
LUnallocated* temp1 = NULL;
LOperand* temp2 = NULL;
if (!instr->CanOmitPrototypeChecks()) {
temp1 = TempRegister();
temp2 = TempRegister();
}
LCheckPrototypeMaps* result = new(zone()) LCheckPrototypeMaps(temp1, temp2);
if (instr->CanOmitPrototypeChecks()) return result;
return AssignEnvironment(result);
}
@ -1965,8 +1970,10 @@ LInstruction* LChunkBuilder::DoCheckFunction(HCheckFunction* instr) {
LInstruction* LChunkBuilder::DoCheckMaps(HCheckMaps* instr) {
LOperand* value = UseRegisterAtStart(instr->value());
LOperand* value = NULL;
if (!instr->CanOmitMapChecks()) value = UseRegisterAtStart(instr->value());
LInstruction* result = new(zone()) LCheckMaps(value);
if (instr->CanOmitMapChecks()) return result;
return AssignEnvironment(result);
}