Commit ab301a54 authored by danno@chromium.org's avatar danno@chromium.org

MIPS: Remove redundant loads in DoCheckMaps Hoist the loop-invariant load out...

MIPS: Remove redundant loads in DoCheckMaps Hoist the loop-invariant load out of the loop and call the other CheckMap function

Port r13253 (5af29105)

BUG=
TEST=

Review URL: https://codereview.chromium.org/11784014
Patch from Akos Palfi <palfia@homejinni.com>.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@13321 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 4246ac30
...@@ -4645,32 +4645,32 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) { ...@@ -4645,32 +4645,32 @@ void LCodeGen::DoCheckFunction(LCheckFunction* instr) {
} }
void LCodeGen::DoCheckMapCommon(Register reg, void LCodeGen::DoCheckMapCommon(Register map_reg,
Register scratch,
Handle<Map> map, Handle<Map> map,
CompareMapMode mode, CompareMapMode mode,
LEnvironment* env) { LEnvironment* env) {
Label success; Label success;
__ CompareMapAndBranch(reg, scratch, map, &success, eq, &success, mode); __ CompareMapAndBranch(map_reg, map, &success, eq, &success, mode);
DeoptimizeIf(al, env); DeoptimizeIf(al, env);
__ bind(&success); __ bind(&success);
} }
void LCodeGen::DoCheckMaps(LCheckMaps* instr) { void LCodeGen::DoCheckMaps(LCheckMaps* instr) {
Register scratch = scratch0(); Register map_reg = scratch0();
LOperand* input = instr->value(); LOperand* input = instr->value();
ASSERT(input->IsRegister()); ASSERT(input->IsRegister());
Register reg = ToRegister(input); Register reg = ToRegister(input);
Label success; Label success;
SmallMapList* map_set = instr->hydrogen()->map_set(); SmallMapList* map_set = instr->hydrogen()->map_set();
__ lw(map_reg, FieldMemOperand(reg, HeapObject::kMapOffset));
for (int i = 0; i < map_set->length() - 1; i++) { for (int i = 0; i < map_set->length() - 1; i++) {
Handle<Map> map = map_set->at(i); Handle<Map> map = map_set->at(i);
__ CompareMapAndBranch( __ CompareMapAndBranch(
reg, scratch, map, &success, eq, &success, REQUIRE_EXACT_MAP); map_reg, map, &success, eq, &success, REQUIRE_EXACT_MAP);
} }
Handle<Map> map = map_set->last(); Handle<Map> map = map_set->last();
DoCheckMapCommon(reg, scratch, map, REQUIRE_EXACT_MAP, instr->environment()); DoCheckMapCommon(map_reg, map, REQUIRE_EXACT_MAP, instr->environment());
__ bind(&success); __ bind(&success);
} }
...@@ -4727,28 +4727,30 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) { ...@@ -4727,28 +4727,30 @@ void LCodeGen::DoClampTToUint8(LClampTToUint8* instr) {
void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) { void LCodeGen::DoCheckPrototypeMaps(LCheckPrototypeMaps* instr) {
ASSERT(instr->temp()->Equals(instr->result())); ASSERT(instr->temp()->Equals(instr->result()));
Register temp1 = ToRegister(instr->temp()); Register prototype_reg = ToRegister(instr->temp());
Register temp2 = ToRegister(instr->temp2()); Register map_reg = ToRegister(instr->temp2());
Handle<JSObject> holder = instr->holder(); Handle<JSObject> holder = instr->holder();
Handle<JSObject> current_prototype = instr->prototype(); Handle<JSObject> current_prototype = instr->prototype();
// Load prototype object. // Load prototype object.
__ LoadHeapObject(temp1, current_prototype); __ LoadHeapObject(prototype_reg, current_prototype);
// Check prototype maps up to the holder. // Check prototype maps up to the holder.
while (!current_prototype.is_identical_to(holder)) { while (!current_prototype.is_identical_to(holder)) {
DoCheckMapCommon(temp1, temp2, __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
DoCheckMapCommon(map_reg,
Handle<Map>(current_prototype->map()), Handle<Map>(current_prototype->map()),
ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
current_prototype = current_prototype =
Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype())); Handle<JSObject>(JSObject::cast(current_prototype->GetPrototype()));
// Load next prototype object. // Load next prototype object.
__ LoadHeapObject(temp1, current_prototype); __ LoadHeapObject(prototype_reg, current_prototype);
} }
// Check the holder map. // Check the holder map.
DoCheckMapCommon(temp1, temp2, __ lw(map_reg, FieldMemOperand(prototype_reg, HeapObject::kMapOffset));
DoCheckMapCommon(map_reg,
Handle<Map>(current_prototype->map()), Handle<Map>(current_prototype->map()),
ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment()); ALLOW_ELEMENT_TRANSITION_MAPS, instr->environment());
} }
......
...@@ -126,7 +126,7 @@ class LCodeGen BASE_EMBEDDED { ...@@ -126,7 +126,7 @@ class LCodeGen BASE_EMBEDDED {
void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr, void DoDeferredInstanceOfKnownGlobal(LInstanceOfKnownGlobal* instr,
Label* map_check); Label* map_check);
void DoCheckMapCommon(Register reg, Register scratch, Handle<Map> map, void DoCheckMapCommon(Register map_reg, Handle<Map> map,
CompareMapMode mode, LEnvironment* env); CompareMapMode mode, LEnvironment* env);
// Parallel move support. // Parallel move support.
......
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