Commit f48a8d1c authored by palfia@homejinni.com's avatar palfia@homejinni.com

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
parent cb055f17
......@@ -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());
}
}
......
......@@ -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);
}
......
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